PostgreSQL 17.0 (upcoming) commit log

Remove redundant JSON parser typedefs

commit   : e00b4f79e7367272b436dea6f15d6f421f3d6e1a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 27 Apr 2024 07:02:57 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 27 Apr 2024 07:02:57 -0400    

Click here for diff

JsonNonTerminal and JsonParserSem were added in commit 3311ea86ed  
  
These names of these two enums are not actually used, so there is no  
need for typedefs. Instead use plain enums to declare the constants.  
  
Noticed by Alvaro Herera.  

M src/common/jsonapi.c
M src/tools/pgindent/typedefs.list

Small cosmetic fixes in radix tree template

commit   : ed52df3b19ee77cca7cb5f202950704f6b12feb9    
  
author   : John Naylor <[email protected]>    
date     : Sat, 27 Apr 2024 14:42:01 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 27 Apr 2024 14:42:01 +0700    

Click here for diff

- Bring memory context names in line with other naming  
- Fix typos, reported off-list by Alexander Lakhin  
- Remove copy-paste errors from comments  
- Remove duplicate #undef  

M src/include/lib/radixtree.h

Minor fixes to pg_combinebackup and its documentation.

commit   : 1713e3d6cd393fcc1d4873e75c7fa1f6c7023d75    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Apr 2024 08:42:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Apr 2024 08:42:42 -0400    

Click here for diff

The --tablespace-mapping option was specified with required_argument  
rather than no_argument, which is wrong. Since the actual argument  
string passed to getopt_long() included "T:", the single-character  
form of the option still worked, but the long form did not. Repair.  
  
The call to getopt_long() erroneously included "P", which doesn't  
correspond to any supported option. Remove.  
  
The help message used "do not" in one place and "don't" in another.  
Standardize on "do not".  
  
The documentation erroneously stated that the tablespace mappings  
would be applied relative to the pathnames in the first backup  
specified on the command line, rather than the final one. Fix.  
  
Thanks to Tomas Vondra and Daniel Gustafsson for alerting me to  
these mistakes.  
  
Discussion: http://postgr.es/m/CA+TgmoYFznwwaZhHSF1Ze7JeyBv-1yOoSrucKMw37WpF=7RP8g@mail.gmail.com  

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

pg_combinebackup: Detect checksum mismatches and document limitation.

commit   : 205db0114e03496f1d6febf276374900b6314e67    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 25 Apr 2024 14:58:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 25 Apr 2024 14:58:59 -0400    

Click here for diff

If not all backups have the same checksum status, but the final backup  
has checksums enabled, then the output directory may include pages  
with invalid checksums. Document this limitation and explain how to  
work around it.  
  
In a future release, we may want to teach pg_combinebackup to  
recompute page checksums when required, but as feature freeze has come  
and gone, it seems a bit too late to do that for this release.  
  
Patch by me, reviewed by Daniel Gustafsson  
  
Discussion: http://postgr.es/m/CA+TgmoZugzOSmgkx97u3pc0M7U8LycWvugqoyWBv6j15a4hE5g@mail.gmail.com  

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

Avoid unnecessary "touch meson.build" in vpath builds

commit   : 6d4bc96eb77bca6277880f218cd7a2f9e44bddc0    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Apr 2024 07:51:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Apr 2024 07:51:33 -0700    

Click here for diff

In e6927270cd1 I added a 'touch meson.build' to configure.ac, to ensure  
conflicts between in-tree configure based builds and meson builds are  
automatically detected. Unfortunately I omitted spaces around the condition  
restricting this to in-tree builds, leading to touch meson.build to also be  
executed in vpath builds. While the only consequence of this buglet is an  
unnecessary empty file in build directories, it seems worth backpatching.  
  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the meson based build was added  

M configure
M configure.ac

radixtree: Fix SIGSEGV at update of embeddable value to non-embeddable.

commit   : bb7f195ff78851e5fcee7230108a16d70be13579    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 25 Apr 2024 21:48:52 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 25 Apr 2024 21:48:52 +0900    

Click here for diff

Also, fix a memory leak when updating from non-embeddable to  
embeddable. Both were unreachable without adding C code.  
  
Reported-by: Noah Misch  
Author: Noah Misch  
Reviewed-by: Masahiko Sawada, John Naylor  
Discussion: https://postgr.es/m/20240424210319.4c.nmisch%40google.com  

M src/include/lib/radixtree.h
M src/test/modules/test_tidstore/expected/test_tidstore.out
M src/test/modules/test_tidstore/sql/test_tidstore.sql
M src/test/modules/test_tidstore/test_tidstore.c

commit   : e03ec4641d2493db6fbfc60ff78d0f0b36d2ead1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Apr 2024 14:03:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Apr 2024 14:03:42 +0200    

Click here for diff

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

M doc/src/sgml/func.sgml

Post-commit review fixes for slot synchronization.

commit   : db08e8c6fa89ba9d2e80616448abe53316ceeef8    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 25 Apr 2024 14:01:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 25 Apr 2024 14:01:44 +0530    

Click here for diff

Allow pg_sync_replication_slots() to error out during promotion of standby.  
This makes the behavior of the SQL function consistent with the slot sync  
worker. We also ensured that pg_sync_replication_slots() cannot be  
executed if sync_replication_slots is enabled and the slotsync worker is  
already running to perform the synchronization of slots. Previously, it  
would have succeeded in cases when the worker is idle and failed when it  
is performing sync which could confuse users.  
  
This patch fixes another issue in the slot sync worker where  
SignalHandlerForShutdownRequest() needs to be registered *before* setting  
SlotSyncCtx->pid, otherwise, the slotsync worker could miss handling  
SIGINT sent by the startup process(ShutDownSlotSync) if it is sent before  
worker could register SignalHandlerForShutdownRequest(). To be consistent,  
all signal handlers' registration is moved to a prior location before we  
set the worker's pid.  
  
Ensure that we clean up synced temp slots at the end of  
pg_sync_replication_slots() to avoid such slots being left over after  
promotion.  
  
Ensure that ShutDownSlotSync() captures SlotSyncCtx->pid under spinlock to  
avoid accessing invalid value as it can be reset by concurrent slot sync  
exit due to an error.  
  
Author: Shveta Malik  
Reviewed-by: Hou Zhijie, Bertrand Drouvot, Amit Kapila, Masahiko Sawada  
Discussion: https://postgr.es/m/CAJpy0uBefXUS_TSz=oxmYKHdg-fhxUT0qfjASW3nmqnzVC3p6A@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/tcop/postgres.c
M src/include/replication/slot.h

Remove unnecessary code from be_lo_put()

commit   : 0afa288911d5af7b0f5bd7a1aa09cdea7f02590c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Apr 2024 10:08:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Apr 2024 10:08:07 +0200    

Click here for diff

A permission check is performed in be_lo_put() just after returning  
from inv_open(), but the permission is already checked in inv_open(),  
so we can remove the second check.  
  
This check was added in 8d9881911f0, but then the refactoring in  
ae20b23a9e7 should have removed it.  
  
Author: Yugo NAGATA <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20240424185932.9789628b99a49ec81b020425%40sraoss.co.jp  

M src/backend/libpq/be-fsstubs.c

Fix the missing table sync due to improper invalidation handling.

commit   : aa79bde725650b4cfdce05bcc119008709590af6    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 25 Apr 2024 10:40:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 25 Apr 2024 10:40:52 +0530    

Click here for diff

We missed performing table sync if the invalidation happened while the  
non-ready tables list was being prepared. This occurs because the sync  
state was set to valid at the end of non-ready table list preparation  
irrespective of the invalidations processed while the list is being  
prepared.  
  
Fix it by changing the boolean variable to a tri-state enum and by setting  
table state to valid only if no invalidations have occurred while the list  
is being prepared.  
  
Reprted-by: Alexander Lakhin  
Diagnosed-by: Alexander Lakhin  
Author: Vignesh C  
Reviewed-by: Hou Zhijie, Alexander Lakhin, Ajin Cherian, Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/tablesync.c
M src/tools/pgindent/typedefs.list

Improve comment of DeallocateStmt->isall

commit   : ee3ef4af19d8ba140a8b33c6598d470d36eec10c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Apr 2024 10:20:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Apr 2024 10:20:49 +0900    

Click here for diff

This field is not used directly in the code, but it is important for  
query jumbling to be able to make a difference between a named  
DEALLOCATE and DEALLOCATE ALL (see bb45156f342c).  This behavior is  
tracked in the regression tests of pg_stat_statements, but the reason  
why this field is important can be easily missed, as a recent discussion  
has proved, so let's improve its comment to document the reason why it  
needs to be around.  
  
Wording has been suggested by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/parsenodes.h

Doc: fix minor oversight in ALTER DEFAULT PRIVILEGES ref page.

commit   : e51c2a46b54ee294c699499bedf76940ce2f392c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Apr 2024 10:18:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Apr 2024 10:18:16 -0400    

Click here for diff

Since schemas have more than one kind of privilege, we should  
use the synopsis form that shows the privilege being possibly  
repeated.  
  
Yugo Nagata  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_default_privileges.sgml

Add pg_logging_init() calls missing in commit ba3e6e2bca

commit   : cc893b82370b5d68e0a72f5bb1663644a3a0351d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Apr 2024 07:52:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Apr 2024 07:52:52 -0400    

Click here for diff

As noticed by Michael Paquier.  

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

Doc: fix prompt in psql crosstabview example

commit   : 9d353639c3b37efea7a29b63027cef81a7c7e335    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 13:09:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 13:09:50 +0200    

Click here for diff

The prompt in the crosstabview example was incorrectly indicating  
an open parenthesis where there is none in the example query. Fix  
by changing to the normal multi-line prompt.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix up spacing around verbatim DocBook elements

commit   : b53d58097d7d5712d819d06e0416dec0a7db2479    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 12:26:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 12:26:19 +0200    

Click here for diff

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/release_savepoint.sgml

pg_combinebackup: Add --version to --help output

commit   : 83751691e9c89af15103220b62d78cf5be73dbfd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 12:12:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 12:12:57 +0200    

Click here for diff

(It was already on the man page.)  

M src/bin/pg_combinebackup/pg_combinebackup.c

doc: Correct jsonpath string literal escapes description

commit   : b279e37015bba58f2e9752f177a6a4f4db2b1814    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 11:31:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 11:31:47 +0200    

Click here for diff

The paragraph describing the JavaScript string literals allowed in  
jsonpath expressions unnecessarily mentions JSON by erroneously  
listing \v as allowed by JSON and mentioning the \xNN and \u{N...}  
backslash escapes as deviations from JSON when in fact both are  
accepted by ECMAScript/JavaScript.  Fix this by only referring to  
JavaScript.  
  
Author: Erik Wienhold <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/json.sgml

pg_combinebackup: Put newer options in consistent order in --help and man page

commit   : 3886530caa01cac7179fed6b6e1d303710c027d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 10:47:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 10:47:35 +0200    

Click here for diff

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

Support SSL_R_VERSION_TOO_LOW when using LibreSSL

commit   : d80f2ce294653ce633984445c971dfb534578464    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:50 +0200    

Click here for diff

The SSL_R_VERSION_TOO_LOW error reason is supported in LibreSSL since  
LibreSSL 3.6.3, shipped in OpenBSD 7.2.  SSL_R_VERSION_TOO_HIGH is on  
the other hand not supported in any version of LibreSSL.  Previously  
we only checked for SSL_R_VERSION_TOO_HIGH and then applied both under  
that guard since OpenSSL has only ever supported both at the same time.  
This breaks the check into one per reason to allow SSL_R_VERSION_TOO_LOW  
to work when using LibreSSL.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Support disallowing SSL renegotiation when using LibreSSL

commit   : 44e27f0a6d07d194ee43e9e4095db75c0525112f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:42 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:42 +0200    

Click here for diff

LibreSSL doesn't support the SSL_OP_NO_RENEGOTIATION macro which is  
used by OpenSSL, instead it has invented a similar one for client-  
side renegotiation: SSL_OP_NO_CLIENT_RENEGOTIATION. This has been  
supported since LibreSSL 2.5.1 which by now can be considered well  
below the minimum requirement.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: Use past tense for things which happened in the past

commit   : 91d6429fad55f0e440643993754216614a9f6b11    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:36 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 24 Apr 2024 10:54:36 +0200    

Click here for diff

The paragraph on SSL compression is largely describing events which  
took place many years ago, so reword with past tense.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml

pg_dump: Put new options in consistent order in --help and man page

commit   : 256b4b060614f4e54e49bb43a54404af4f1ef61d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 10:00:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 10:00:58 +0200    

Click here for diff

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

doc: Fix order of options on pg_createsubscriber man page

commit   : 286eea5d3ae33a8c22d46a051f8ac6069c8b779d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 09:19:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 09:19:59 +0200    

Click here for diff

Some options were listed in an order that was inconsistent with the  
--help output and everything else.  

M doc/src/sgml/ref/pg_createsubscriber.sgml

pg_walsummary: Document --version option

commit   : f994ed89a98b9aed405c760f157a10125eb8d567    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 08:56:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 08:56:21 +0200    

Click here for diff

It was working, but it was not shown in the --help output or on the  
man page.  

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

Remove obsolete symbol from ecpg_config.h.in

commit   : c3fa85b249e457898a24cb3125a4a1b6b9c0e631    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 08:27:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Apr 2024 08:27:25 +0200    

Click here for diff

HAVE_LONG_LONG_INT was not added to ecpg_config.h.in by the meson  
build system, but rather than add it there, we decided to remove it  
from the makefile build system, to make both consistent that way.  
  
There is no documentation or examples that suggest that the presence  
of this symbol was publicly advertised, and of course the feature is  
required by C99 (but we don't necessarily require C99 for ecpg user  
code).  ecpg core code and ecpg tests use the symbol  
HAVE_LONG_LONG_INT_64 instead, which is still there.  
  
Discussion: https://www.postgresql.org/message-id/flat/bf35d032-02fc-4173-9f4f-840999cc3ef3%40eisentraut.org  

M src/interfaces/ecpg/include/ecpg_config.h.in

Try again to add test coverage for pg_combinebackup w/tablespaces.

commit   : 89ad3e1316bf0374f9e57456bf2888d14bf070f6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Apr 2024 16:33:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Apr 2024 16:33:19 -0400    

Click here for diff

My previous attempt to add this had to be reverted in commit  
82023d47de9e262730b1f9b4ea77fae201a89d0a. I've revised the problematic  
code a bit; hopefully it is OK now.  
  
Discussion: http://postgr.es/m/CA+Tgmobiv1QJR5PEJoDKeZDrJHZFRmi4XmWOqufN49DJj-3e2g@mail.gmail.com  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Post review fixes for test_json_parser test module

commit   : ba3e6e2bca97df14920375b0a1ebf4eab95b78b5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 23 Apr 2024 15:27:40 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 23 Apr 2024 15:27:40 -0400    

Click here for diff

. Add missing copytight notices  
. improve code coverage  
. put work files in a temp directory in the standard location  
. improve error checking in C code  
. indent perl files with perltidy  
. add some comments  
  
per comments from Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_json_parser/t/001_test_json_parser_incremental.pl
M src/test/modules/test_json_parser/t/002_inline.pl
M src/test/modules/test_json_parser/t/003_test_semantic.pl
M src/test/modules/test_json_parser/t/004_test_parser_perf.pl
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_json_parser/test_json_parser_perf.c
M src/test/modules/test_json_parser/tiny.json
M src/test/modules/test_json_parser/tiny.out

Remove some unnecessary fields from executor nodes.

commit   : b7d35d393edbe2d4333dde81496e8a362abc85bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2024 12:55:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2024 12:55:26 -0400    

Click here for diff

JsonExprState.input_finfo is only assigned to, never read, and  
it's really fairly useless since the value can be gotten out of  
the adjacent input_fcinfo field.  Let's remove it before someone  
starts to depend on it.  
  
While here, also remove TidScanState.tss_htup and AggState.combinedproj,  
which are referenced nowhere.  Those should have been removed by the  
commits that caused them to become disused, but were not.  
  
I don't think a catversion bump is necessary here, since plan trees  
are never stored on disk.  
  
Matthias van de Meent  
  
Discussion: https://postgr.es/m/CAEze2WjsY4d0TBymLNGK4zpttUcg_YZaTjyWz2VfDUV6YH8wXQ@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/include/nodes/execnodes.h

Fix code for probing availability of AVX-512.

commit   : 598e0114a3b16bb7edcaba6784b3794f816889ae    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 23 Apr 2024 10:54:04 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 23 Apr 2024 10:54:04 -0500    

Click here for diff

This commit fixes a few things:  
* Instead of checking for CPU support of the "xsave" extension, we  
  need to check for OS support of XGETBV instructions via the  
  "osxsave" flag.  
* We must check that additional XCR0 bits are set to be sure the  
  ZMM registers are fully enabled.  
* We should use the recommended ordering of steps.  Specifically,  
  we need to check that the ZMM registers are enabled prior to  
  checking for AVX-512 via CPUID.  
  
In passing, split this code into separate functions to improve  
readability.  
  
Reported-by: Andrew Kane  
Reviewed-by: Akash Shankaran, Raghuveer Devulapalli  
Discussion: https://postgr.es/m/20240418024459.GA3385227%40nathanxps13  

M src/port/pg_popcount_avx512_choose.c

Improve "out of range" error messages for GUCs.

commit   : bb3ca232398658291d4b1eaae12cd6e88dfc96a3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2024 11:52:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2024 11:52:40 -0400    

Click here for diff

If the GUC has a unit, label the minimum and maximum values  
with the unit explicitly.  Per suggestion from Jian He.  
  
Discussion: https://postgr.es/m/CACJufxFJo6FyVg9W8yvNAxbjP+EJ9wieE9d9vw5LpPzyLnLLOQ@mail.gmail.com  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out

Fix the handling of the failover option in subscription commands.

commit   : b29cbd3da4e37db17026b9fe58fb46fe83f467bf    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 23 Apr 2024 12:14:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 23 Apr 2024 12:14:57 +0530    

Click here for diff

Do not allow ALTER SUBSCRIPTION ... SET (failover = on|off) in a  
transaction block as the changed failover option of the slot can't be  
rolled back. For the same reason, we refrain from altering the replication  
slot's failover property if the subscription is created with a valid  
slot_name and create_slot=false.  
  
Reprted-by: Kuroda Hayato  
Author: Hou Zhijie  
Reviewed-by: Shveta Malik, Bertrand Drouvot, Kuroda Hayato  
Discussion: https://postgr.es/m/OS0PR01MB57165542B09DFA4943830BF294082@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/commands/subscriptioncmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Remove unneeded nbtree array preprocessing assert.

commit   : 480bc6e3ed3a5719cdec076d4943b119890e8171    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 22 Apr 2024 13:58:06 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 22 Apr 2024 13:58:06 -0400    

Click here for diff

Certain cases involving the use of cursors had assertion failures within  
_bt_preprocess_keys's recently added no-op return path.  The assertion  
in question made the faulty assumption that a second or third call to  
_bt_preprocess_keys (within the same btrescan) could only happen when  
another scheduled primitive index scan was just about to begin.  
  
It would be possible to address the problem by only allowing scans that  
have array keys to take the new no-op path, forcing affected cases to  
perform redundant preprocessing work.  It seems simpler to just remove  
the assertion, and reframe the no-op path as a more general mechanism.  
Take this simpler approach.  
  
The important underlying principle is that we only need to perform  
preprocessing once per btrescan (at most).  This is expected regardless  
of whether or not the scan happens to have array keys.  
  
Oversight in commit 1b134ca5, which enhanced nbtree ScalarArrayOp  
execution.  
  
Reported-By: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Update src/common/unicode/.gitignore

commit   : 7e44ac3741dd2ebf8c668d6ac6a10fa6ed7301b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 21 Apr 2024 18:41:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 21 Apr 2024 18:41:57 +0200    

Click here for diff

for new downloaded files and new build results.  

M src/common/unicode/.gitignore

Update Unicode data to CLDR 45

commit   : 9e2e4f08bb6cc86710cb84459b7fd0f407e596a7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 21 Apr 2024 18:40:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 21 Apr 2024 18:40:21 +0200    

Click here for diff

No actual changes result.  

M src/Makefile.global.in

Fix dumps of partitioned tables with table AMs

commit   : f46bee346c3b6aab0a0f3f39dc734732b79ce1ed    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Apr 2024 15:15:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Apr 2024 15:15:36 +0900    

Click here for diff

pg_dump/restore failed to properly set the table access method for  
partitioned tables, as it relies on SET queries that would change  
default_table_access_method.  However, SET affects only tables and  
materialized views, not partitioned tables which would always be  
restored with their pg_class.relam set to 0, losing their table AM set  
by either a CREATE TABLE .. USING or by a ALTER TABLE .. SET ACCESS  
METHOD.  
  
Appending a USING clause to the definition of CREATE TABLE is not  
possible as users may specify --no-table-access-method at restore or for  
a dump, meaning that the table AM portions may have to be skipped.  
Rather than SET, the solution used by this commit is to generate an  
extra ALTER TABLE .. SET ACCESS METHOD when restoring a partitioned  
table, based on the table AM set in its TOC entry.  The choice of using  
a SET query or an ALTER TABLE query for a relation requires the addition  
of the relkind to the TOC entry to be able to choose between one or the  
other.  Note that using ALTER TABLE SET ACCESS METHOD on a relation with  
physical storage would require a full rewrite, which would be costly for  
one.  This also creates problems with binary upgrades where the rewrite  
would not be able to keep the OID of the relation consistent across the  
upgrade.  
  
This commit would normally require a protocol bump, but a45c78e3284b has  
already done one for this release cycle.  
  
Regression tests are adjusted with the new expected output, with some  
tweaks for the table AMs of the partitions to make the output more  
readable.  
  
Issue introduced by 374c7a229042, that has added support for table AMs  
in partitioned tables.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Remove overzealous array element type assertion.

commit   : eff6a757fde3ba072a03dd06edc2eafeac5e602d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 21 Apr 2024 22:51:56 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 21 Apr 2024 22:51:56 -0400    

Click here for diff

This led to spurious assertion failures in certain scenarios involving  
pseudo types.  
  
Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp  
execution.  
  
Reported-By: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs48f5rDOwxaT76Zd40m7n9iGZQcjEk7vG_5p3YWNh6oPfA@mail.gmail.com  

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

createdb: compare strategy case-insensitive

commit   : 8c239ee15a4b093523ebe30bdc9af186aaccebfd    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 21 Apr 2024 21:21:26 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 21 Apr 2024 21:21:26 +0200    

Click here for diff

When specifying the createdb strategy, the documentation suggests valid  
options are FILE_COPY and WAL_LOG, but the code does case-sensitive  
comparison and accepts only "file_copy" and "wal_log" as valid.  
  
Fixed by doing a case-insensitive comparison using pg_strcasecmp(), same  
as for other string parameters nearby.  
  
While at it, apply fmtId() to a nearby "locale_provider". This already  
did the comparison in case-insensitive way, but the value would not be  
double-quoted, confusing the parser and the error message.  
  
Backpatch to 15, where the strategy was introduced.  
  
Backpatch-through: 15  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Make postgres_fdw request remote time zone 'GMT' not 'UTC'.

commit   : a3021aafcecbc5225bf99f235db4130546d543c1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Apr 2024 13:46:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Apr 2024 13:46:20 -0400    

Click here for diff

This should have the same results for all practical purposes.  
The advantage of selecting 'GMT' is that it's guaranteed to work  
even when the remote system's timezone database is missing  
entries, because pg_tzset() hard-wires handling of that,  
at least in 9.2 and later.  
  
(It seems like it would be a good idea to similarly hard-wire  
correct handling of 'UTC', but that'll be a little more invasive  
than I want to consider back-patching.  Leave that for another  
day when we're not in feature freeze.)  
  
Per trouble report from Adnan Dautovic.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c

createdb: Correct parameter name in SGML docs

commit   : f4fdc24aa35c2268f519905a3a66658ebd55a466    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 20 Apr 2024 18:54:09 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 20 Apr 2024 18:54:09 +0200    

Click here for diff

Commit 9c08aea6a309 introduced -S/--strategy option, but forgot to  
rename the parameter when copying the -T/--template bit.  

M doc/src/sgml/ref/createdb.sgml

Remove resowner_private.h

commit   : 06a0f4d52be3a52a74725dd29c66cd486256a209    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 20 Apr 2024 18:01:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 20 Apr 2024 18:01:03 +0900    

Click here for diff

This header is not used since the refactoring of resource owners done in  
b8bff07daa85, and all the functions declared in it became (well, mostly)  
static inline local to each resowner kind's code path.  
  
Author: Xing Guo  
Discussion: https://postgr.es/m/CACpMh+BFmtK5Z=b6PvH4HLKhUpWa_VtRTZSrB4-yK-tQejpWGw@mail.gmail.com  

D src/include/utils/resowner_private.h

Doc: document cases where queryid is stable

commit   : 2d3389c28c5c8235221d2ae0776df4ab812b15c8    
  
author   : David Rowley <[email protected]>    
date     : Sat, 20 Apr 2024 13:53:35 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 20 Apr 2024 13:53:35 +1200    

Click here for diff

The documents were clear that queryid should not be assumed to be stable  
between major versions but said nothing about minor versions and left  
the reader to guess if that was implied by the mention of the  
instability of queryid between major versions.  
  
Here we give minor versions an explicit mention to indicate queryid can  
generally be assumed stable between minor versions.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/pgstatstatements.sgml

Revert recent ill-advised test case changes.

commit   : 82023d47de9e262730b1f9b4ea77fae201a89d0a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 17:21:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 17:21:56 -0400    

Click here for diff

Commit 6bf5c42b5546984df29289918f952e6211069c54 cannot work on Windows,  
because it lacks symlink support. While the bug fix in commit  
cd64dc42d1e1b03e57e6ba3d316e4f9dec52a78d is correct as far as I know,  
the test case changes depend on the previous commit, so this will  
have to live without test coverage until we can come up with a better  
solution. Commit fa7036dd6644d13233b475874a94754a5903e35a was a test  
case bug fix on top of those two, to prevent failures on Linux, so that  
has to come out as well.  
  
Per the buildfarm, CI, and Thomas Munro.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Use tempdir_short instead of tempdir.

commit   : fa7036dd6644d13233b475874a94754a5903e35a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 15:50:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 15:50:02 -0400    

Click here for diff

After cd64dc42d1e1b03e57e6ba3d316e4f9dec52a78d, a significant  
percentage of the buildfarm got unhappy, because pg_basebackup chokes  
if it tries to create a tarfile with symlink more than 99 characters  
in length. To try to fix that problem, use tempdir_short instead of  
tempdir, as we do in pg_verifybackup's 003_corruption.pl.  
  
There's a more complicated workaround for the same issue in  
pg_basebackup's 010_pg_basebackup.pl, but I'm not clear whether  
there's any reason to do it that way here. For now, let's try this,  
to at least get the buildfarm green again.  
  
A better long-term fix would be to figure out how to generate tar  
files containing long symlinks, but that will have to wait for  
another time.  

M src/bin/pg_combinebackup/t/002_compare_backups.pl

pg_combinebackup: Fix incorrect tablespace handling.

commit   : cd64dc42d1e1b03e57e6ba3d316e4f9dec52a78d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 13:30:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Apr 2024 13:30:42 -0400    

Click here for diff

The previous coding mangled the pathname calculation for  
incremental files located in user-defined tablespaces.  
  
Enhance the test cases to cover such cases, as I should have  
done originally. Thanks to Andres Freund for alerting me to the  
lack of test coverage.  
  
Discussion: http://postgr.es/m/CA+TgmoYdXTjo9iQeoipTccDpWZzvBNS6EndY2uARM+T4yG_yDg@mail.gmail.com  

M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/t/002_compare_backups.pl

Make PostgreSQL::Test::Cluster::init_from_backup handle tablespaces.

commit   : 6bf5c42b5546984df29289918f952e6211069c54    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 17 Apr 2024 15:56:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 17 Apr 2024 15:56:33 -0400    

Click here for diff

This commit doesn't use this infrastructure for anything new, although  
it does adapt 010_pg_basebackup.pl to use it. However, a future commit  
will use this to improve test coverage for pg_combinebackup.  
  
Patch by me, reviewed (but not fully endorsed) by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoYdXTjo9iQeoipTccDpWZzvBNS6EndY2uARM+T4yG_yDg@mail.gmail.com  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Add missing index_insert_cleanup calls

commit   : 41d2c6f952edc4841763d05296b65f3c0edad4f2    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 19 Apr 2024 15:47:48 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 19 Apr 2024 15:47:48 +0200    

Click here for diff

The optimization for inserts into BRIN indexes added by c1ec02be1d79  
relies on a cache that needs to be explicitly released after calling  
index_insert(). The commit however failed to invoke the cleanup in  
validate_index(), which calls index_insert() indirectly through  
table_index_validate_scan().  
  
After inspecting index_insert() callers, it seems unique_key_recheck()  
is missing the call too.  
  
Fixed by adding the two missing index_insert_cleanup() calls.  
  
The commit does two additional improvements. The aminsertcleanup()  
signature is modified to have the index as the first argument, to make  
it more like the other AM callbacks. And the aminsertcleanup() callback  
is invoked even if the ii_AmCache is NULL, so that it can decide if the  
cleanup is necessary.  
  
Author: Alvaro Herrera, Tomas Vondra  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/index/indexam.c
M src/backend/catalog/index.c
M src/backend/commands/constraint.c
M src/include/access/amapi.h
M src/include/access/brin_internal.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Fix a couple typos in BRIN code

commit   : 95d14b7ae26db5ed85d9945e29121bb0e9b59863    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 19 Apr 2024 15:43:14 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 19 Apr 2024 15:43:14 +0200    

Click here for diff

Typos introduced by commits c1ec02be1d79, b43757171470 and dae761a87eda.  
  
Author: Alvaro Herrera  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c

Doc: Remove mention of @ and ~ GiST operators

commit   : e6488fcb057b36f32d52f1c4dcbecda461ed7445    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 14:50:10 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 14:50:10 +0200    

Click here for diff

These operators were removed by 2f70fdb0644c in the v14 cycle but they were  
accidentally left in the table of build-in operator classes. Backpatch down  
to v14 where the operators where removed.  
  
Author: Aleksander Alekseev <[email protected]>  
Reported-by: Colin Caine <[email protected]>  
Discussion: https://postgr.es/m/CADwQTQbbr2UQ_fpbyc+8ay=RwEYgYk=TZxH3+RHDqAQfoG+EWA@mail.gmail.com  
Backpatch-through: v14  

M doc/src/sgml/gist.sgml

Better handle indirect constraint drops

commit   : 0cd711271d42b0888d36f8eda50e1092c2fed4b3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Apr 2024 12:37:33 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Apr 2024 12:37:33 +0200    

Click here for diff

It is possible for certain cases to remove not-null constraints without  
maintaining the attnotnull in its correct state; for example if you drop  
a column that's part of the primary key, and the other columns of the PK don't  
have not-null constraints, then we should reset the attnotnull flags for  
those other columns; up to this commit, we didn't.  Handle those cases  
better by doing the attnotnull reset in RemoveConstraintById() instead  
of in dropconstraint_internal().  
  
However, there are some cases where we must not do so.  For example if  
those other columns are in replica identity indexes or are generated  
identity columns, we must keep attnotnull set, even though it results in  
the catalog inconsistency that no not-null constraint supports that.  
  
Because the attnotnull reset now happens in more places than before, for  
instance when a column of the primary key changes type, we need an  
additional trick to reinstate it as necessary.  Introduce a new  
alter-table pass that does this, which needs simply reschedule some  
AT_SetAttNotNull subcommands that were already being generated and  
ignored.  
  
Because of the exceptions in which attnotnull is not reset noted above,  
we also include a pg_dump hack to include a not-null constraint when the  
attnotnull flag is set even if no pg_constraint row exists.  This part  
is undesirable but necessary, because failing to handle the case can  
result in unrestorable dumps.  
  
Reported-by: Tender Wang <[email protected]>  
Co-authored-by: Tender Wang <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://postgr.es/m/CAHewXN=hMbNa3d43NOR=OCgdgpTt18S-1fmueCoEGesyeK4bqw@mail.gmail.com  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.

commit   : 2e068db56e31dfb510fe7416e52b7affe26f278f    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 19 Apr 2024 09:40:20 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 19 Apr 2024 09:40:20 +0100    

Click here for diff

Code quality improvement for 0294df2f1f84.  
  
Aleksander Alekseev, reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com  

M src/backend/optimizer/prep/prepjointree.c
M src/backend/parser/parse_merge.c
M src/include/nodes/execnodes.h
M src/include/nodes/primnodes.h

Remove unused function prototype

commit   : f6e845133630fe08acf7ad640f6d8443f13b134a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 09:58:04 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 09:58:04 +0200    

Click here for diff

Commit aafc05de1bf5 removed StartSlotSyncWorker() but mistakenly left  
the prototype in slotsync.h.  Fix by removing.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/replication/slotsync.h

Fix incorrect parameter name in prototype

commit   : 9c58bf1507bee00b8cda837a232401fec21e6873    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 09:58:00 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Apr 2024 09:58:00 +0200    

Click here for diff

The function declaration for select_next_encryption_method use the  
variable name have_valid_connection, so fix the prototype in the  
header to match that.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : 84db9a0eb10dd1dbee6db509c0e427fa237177dc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 18 Apr 2024 23:02:39 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 18 Apr 2024 23:02:39 +0200    

Click here for diff

This updates the link from pg_createsubscriber to initial data sync  
to actually link to the subsection in question as opposed to the  
main logical replication section.  
  
Author: Pavel Luzanov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_createsubscriber.sgml

Fix typos and duplicate words

commit   : 950d4a2cb1d5f427dbccf70dbad510479cc4d8e6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 18 Apr 2024 21:28:07 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 18 Apr 2024 21:28:07 +0200    

Click here for diff

This fixes various typos, duplicated words, and tiny bits of whitespace  
mainly in code comments but also in docs.  
  
Author: Daniel Gustafsson <[email protected]>  
Author: Heikki Linnakangas <[email protected]>  
Author: Alexander Lakhin <[email protected]>  
Author: David Rowley <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/meson.build
M src/backend/access/gin/ginbtree.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/system_functions.sql
M src/backend/commands/amcmds.c
M src/backend/commands/copyfrom.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execExpr.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/storage/aio/read_stream.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/generation.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_upgrade/t/004_subscription.pl
M src/common/unicode_category.c
M src/include/access/heapam_xlog.h
M src/include/common/hashfn_unstable.h
M src/include/lib/radixtree.h
M src/include/nodes/pathnodes.h
M src/include/nodes/primnodes.h
M src/include/storage/proc.h
M src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/isolation/expected/temp-schema-cleanup.out
M src/test/isolation/specs/temp-schema-cleanup.spec
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/copy.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/copy.sql
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/publication.sql
M src/test/regress/sql/tsdicts.sql
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/026_stats.pl

Remove spurious "the".

commit   : fbed6ebe41beb72d9b7978a414ed4e8515ed1b19    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 13:06:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 13:06:27 -0400    

Click here for diff

Spotted by Martin Marqués.  
  
Discussion: http://postgr.es/m/CABeG9LvQMtsKrOkhcA_mKJu1duArw4v+smeJKurYGjPVBZFecg@mail.gmail.com  

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

Don't try to fix eliminated nbtree array scan keys.

commit   : f22e17f76cf569a797c45268081feadc8ebd68c7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 18 Apr 2024 11:48:41 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 18 Apr 2024 11:48:41 -0400    

Click here for diff

Preprocessing for nbtree index scans allowed array "input" scan keys  
already marked eliminated during array-specific preprocessing to be  
"fixed up" during preprocessing proper.  This allowed eliminated scan  
keys on DESC index columns to spurious have their strategy commuted,  
causing assertion failures.  
  
To fix, teach _bt_fix_scankey_strategy to ignore these scan keys.  This  
brings it in line with its only caller, _bt_preprocess_keys.  
  
Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp  
execution.  
  
Reported-By: Donghang Lin <[email protected]>  
Discussion: https://postgr.es/m/CAA=D8a2sHK6CAzZ=0CeafC-Y-MFXbYxnRSHvZTi=+JHu6kAa8Q@mail.gmail.com  

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

Restrict where INCREMENTAL.${NAME} files are recognized.

commit   : 9e72f6bfae1707fca1a297db433f6145d582a1c2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 11:00:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 11:00:38 -0400    

Click here for diff

Previously, they were recognized anywhere in an incremental backup  
directory; now, we restrict this to places where they are expected to  
appear. That means this code will need updating if we ever do  
incremental backups of files in other places (e.g. SLRU files), but  
it lets you create a file called INCREMENTAL.config (or something like  
that) at the top level of the data directory and still have things  
work.  
  
Patch by me, per request from David Steele, who also reviewed.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/t/005_integrity.pl

Don't try to assign smart names to constraints

commit   : d72d32f52d26c9588256de90b9bc54fe312cee60    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Apr 2024 16:10:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Apr 2024 16:10:53 +0200    

Click here for diff

This part of my previous commit seems to have broken pg_upgrade on  
crake, at least from 9.2.  I'll see if there's a better fix, but in the  
meantime this should suffice to keep the buildfarm green.  

M src/bin/pg_dump/pg_dump.c

docs: Mention that pg_combinebackup does not verify backups.

commit   : 2e2d4604d94318a304d350aee478bda91a521339    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 09:52:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Apr 2024 09:52:19 -0400    

Click here for diff

We don't want users to think that pg_combinebackup is trying to check  
the validity of individual backups, because it isn't. Adjust the wording  
about sanity checks to make it clear that verification of individual  
backups is the job of pg_verifybackup, and that the checks performed  
by pg_combinebackup are around the relationships between the backups.  
  
Per discussion with David Steele.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix restore of not-null constraints with inheritance

commit   : d9f686a72ee91f6773e5d2bc52994db8d7157a8e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Apr 2024 15:35:15 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Apr 2024 15:35:15 +0200    

Click here for diff

In tables with primary keys, pg_dump creates tables with primary keys by  
initially dumping them with throw-away not-null constraints (marked "no  
inherit" so that they don't create problems elsewhere), to later drop  
them once the primary key is restored.  Because of a unrelated  
consideration, on tables with children we add not-null constraints to  
all columns of the primary key when it is created.  
  
If both a table and its child have primary keys, and pg_dump happens to  
emit the child table first (and its throw-away not-null) and later its  
parent table, the creation of the parent's PK will fail because the  
throw-away not-null constraint collides with the permanent not-null  
constraint that the PK wants to add, so the dump fails to restore.  
  
We can work around this problem by letting the primary key "take over"  
the child's not-null.  This requires no changes to pg_dump, just two  
changes to ALTER TABLE: first, the ability to convert a no-inherit  
not-null constraint into a regular inheritable one (including recursing  
down to children, if there are any); second, the ability to "drop" a  
constraint that is defined both directly in the table and inherited from  
a parent (which simply means to mark it as no longer having a local  
definition).  
  
Secondarily, change ATPrepAddPrimaryKey() to acquire locks all the way  
down the inheritance hierarchy, in case we need to recurse when  
propagating constraints.  
  
These two changes allow pg_dump to reproduce more cases involving  
inheritance from versions 16 and older.  
  
Lastly, make two changes to pg_dump: 1) do not try to drop a not-null  
constraint that's marked as inherited; this allows a dump to restore  
with no errors if a table with a PK inherits from another which also has  
a PK; 2) avoid giving inherited constraints throwaway names, for the  
rare cases where such a constraint survives after the restore.  
  
Reported-by: Andrew Bille <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CAJnzarwkfRu76_yi3dqVF_WL-MpvT54zMwAxFwJceXdHB76bOA@mail.gmail.com  
Discussion: https://postgr.es/m/Zh0aAH7tbZb-9HbC@pryzbyj2023  

M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Update src/tools/pginclude/README to match recent changes to cpluspluscheck

commit   : e0d51e3bf45436bdf84d096916daea2af2c7ba6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Apr 2024 11:32:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Apr 2024 11:32:22 +0200    

Click here for diff

Commit 7b8e2ae2f has turned cpluspluscheck from separate script into a  
--cplusplus option for headerscheck.  Update README correspondingly.  
  
Author: Anton Voloshin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/tools/pginclude/README

Fix object name clash in recently introduced test

commit   : 2c7cea5a8e741b7f7f9f12700d59b49b376301a1    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 17:16:26 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 17:16:26 +0900    

Click here for diff

c0fc0751862 wasn't careful about naming the DOMAIN used in some new  
tests in sqljson_queryfunc.sql so as not to clash with the name of a  
DOMAIN used in the nearby sqljson_jsontable.sql.  Fix by using a  
different name for the newly added DOMAIN in sqljson_queryfuncs.sql.  
  
Per buildfarm members canebrake and urutu.  
  
Discussion: https://postgr.es/m/CA+HiwqEjkbDxqqD3VJamc6R9+B102H7=SFYYOM7gKrxzJO35TQ@mail.gmail.com  

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

SQL/JSON: Miscellaneous fixes and improvements

commit   : ef744ebb7340d42361ebd88d068b27b17e69de18    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:38:12 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:38:12 +0900    

Click here for diff

This addresses some post-commit review comments for commits 6185c973,  
de3600452, and 9425c596a0, with the following changes:  
  
* Fix JSON_TABLE() syntax documentation to use the term  
  "path_expression" for JSON path expressions instead of  
  "json_path_specification" to be consistent with the other SQL/JSON  
  functions.  
  
* Fix a typo in the example code in JSON_TABLE() documentation.  
  
* Rewrite some newly added comments in jsonpath.h.  
  
* In JsonPathQuery(), add missing cast to int before printing an enum  
  value.  
  
Reported-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/jsonpath.h

SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY

commit   : c0fc0751862d4e9b7ca9d51f2cd79344690ec873    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:46:35 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:46:35 +0900    

Click here for diff

SQL/JSON query functions allow specifying an expression to return  
when either of ON ERROR or ON EMPTY condition occurs when evaluating  
the JSON path expression.  The parser (transformJsonBehavior()) checks  
that the specified expression is one of the supported expressions, but  
there are two issues with how the check is done that are fixed in this  
commit:  
  
* No check for some expressions related to coercion, such as  
  CoerceViaIO, that may appear in the transformed user-specified  
  expressions that include cast(s)  
  
* An unsupported expression may be masked by a coercion-related  
  expression, which must be flagged by checking the latter's  
  argument expression recursively  
  
Author: Jian He <[email protected]>  
Author: Amit Langote <[email protected]>  
Reported-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4%[email protected]  
Discussion: https://postgr.es/m/CACJufxGOerH1QJknm1noh-Kz5FqU4p7QfeZSeVT2tN_4SLXYNg@mail.gmail.com  

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

SQL/JSON: Improve some error messages

commit   : b4fad46b6bc8a9bf46ff689bcb1bd4edf8f267af    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:33:47 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 18 Apr 2024 14:33:47 +0900    

Click here for diff

This improves some error messages emitted by SQL/JSON query functions  
by mentioning column name when available, such as when they are  
invoked as part of evaluating JSON_TABLE() columns.  To do so, a new  
field column_name is added to both JsonFuncExpr and JsonExpr that is  
only populated when creating those nodes for transformed JSON_TABLE()  
columns.  
  
While at it, relevant error messages are reworded for clarity.  
  
Reported-by: Jian He <[email protected]>  
Suggested-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com  

M src/backend/executor/execExprInterp.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/utils/jsonpath.h
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_jsontable.sql

Refactoring for CommitTransactionCommand()/AbortCurrentTransaction()

commit   : 40126ac68f2ff96351cd6071350eb2d5cbd50145    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 18 Apr 2024 00:29:41 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 18 Apr 2024 00:29:41 +0300    

Click here for diff

fefd9a3fed turned tail recursion of CommitTransactionCommand() and  
AbortCurrentTransaction() into iteration.  However, it splits the handling of  
cases between different functions.  
  
This commit puts the handling of all the cases into  
AbortCurrentTransactionInternal() and CommitTransactionCommandInternal().  
Now CommitTransactionCommand() and AbortCurrentTransaction() are just doing  
the repeated calls of internal functions.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20240415224834.w6piwtefskoh32mv%40awork3.anarazel.de  
Author: Andres Freund  

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

Remove GlobalVisTestNonRemovable[Full]Horizon, not used anymore

commit   : 3ab8cf92754d5ee4390af4e4840fb45d5bc25007    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2024 11:21:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2024 11:21:17 -0700    

Click here for diff

GlobalVisTestNonRemovableHorizon() was only used for the implementation of  
snapshot_too_old, which was removed in f691f5b80a8. As using  
GlobalVisTestNonRemovableHorizon() is not particularly efficient, no new uses  
for it should be added. Therefore remove.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/procarray.c
M src/include/utils/snapmgr.h

Cleanup parallel BRIN index build code

commit   : 0c2f5552d5d47c702f5077a2df131d3125d96132    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 18:31:43 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 18:31:43 +0200    

Click here for diff

Commit b43757171470 added support for parallel builds of BRIN indexes,  
using code similar to BTREE. But there were to be a couple unnecessary  
differences, particularly in how the leader waits for the workers, and  
merges the results. So remove these, to make the code more similar.  
  
The leader never waited on the workersdonecv condition variable, but  
simply called WaitForParallelWorkersToFinish() in _brin_end_parallel()  
and then merged the per-worker results. This worked correctly, but it  
seems better to do the wait and merge before _brin_end_parallel().  
  
This commit moves the relevant code to _brin_parallel_heapscan/merge(),  
which means  _brin_end_parallel() remains responsible only for exiting  
the parallel mode and accumulating WAL usage data.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Stabilize test of BRIN parallel create

commit   : 0bd4b0689ba1f12fbbd9919ca76a71df3e7702a2    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 16:14:44 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 16:14:44 +0200    

Click here for diff

As explained in 4d916dd876, the test instability is caused by delayed  
cleanup of deleted rows. This commit removes the DELETE, stabilizing the  
test without accidentally disabling parallel builds.  
  
The intent of the delete however was to produce empty ranges, and test  
that the parallel index build populates those correctly. But there's  
another way to create empty ranges - partial indexes, which does not  
rely on cleanup of deleted rows.  
  
Idea to use partial indexes by Matthias van de Meent, patch by me.  
  
Discussion: https://postgr.es/m/95d9cd43-5a92-407c-b7e4-54cd303630fe%40enterprisedb.com  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/sql/brin.sql

Revert "Stabilize test of BRIN parallel create"

commit   : a89cd7bfcdbb45a2c23b4b6004f4503f04f83bd7    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 16:12:03 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Apr 2024 16:12:03 +0200    

Click here for diff

This reverts commit 4d916dd876c3. The goal of that commit was to  
stabilize a test of parallel BRIN build, but using a TEMPORARY table  
disables parallel index builds on that table, making the test useless.  
  
Discussion: https://postgr.es/m/95d9cd43-5a92-407c-b7e4-54cd303630fe%40enterprisedb.com  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/sql/brin.sql

meson: Add some missing LLVM function checks

commit   : 5165d43680dafafcc3d8c1a0a781b9aa33064ea6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 15:16:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 15:16:39 +0200    

Click here for diff

The checks for  
  
HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER and  
HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER  
  
are in configure but are missing on the meson side.  This adds those.  
  
Reported-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M meson.build

Remove dead code

commit   : ca89db5f9d0b03a10706312bbe8b8a43b1ec7538    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 10:46:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 10:46:43 +0200    

Click here for diff

The configure check for HAVE_DECL_LLVMORCREGISTERPERF was removed by  
e9a9843e138, but some code guarded by it was left.  (That commit  
removed the "register" calls but left the "unregister" calls.)  That  
code cannot be reached anymore, so remove it.  
  
Reported-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Add missing source file to libpq/nls.mk

commit   : 2e75492b3c33beaf226981b796d81b6127544fea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 09:09:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Apr 2024 09:09:53 +0200    

Click here for diff

M src/interfaces/libpq/nls.mk

doc: Fix COPY ON_ERROR option syntax synopsis.

commit   : f6f8ac8e75c9af5a599fa658d9125875f16ab08c    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 17 Apr 2024 16:10:18 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 17 Apr 2024 16:10:18 +0900    

Click here for diff

ON_ERROR option values don't require quotations, which was  
inconsistent with the syntax synopsis in the documentation.  
  
Oversight in b725b7eec43.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoC%3Dn4xR3%2BKQiqodnfT9chSB62XwZqmMff39H%3Dx9DS4scQ%40mail.gmail.com  

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

Fix typos with function name in event_trigger.c

commit   : 91fe092a966e6c08c0ead80388f474ac989dc9a3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2024 14:56:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2024 14:56:31 +0900    

Click here for diff

Databases exist, contrary to datatabases.  
  
Oversight in e83d1b0c40cc.  
  
Author: Japin Li  
Discussion: https://postgr.es/m/ME3P282MB316611A2F7BF43919F695228B6082@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM  

M src/backend/commands/event_trigger.c

Disallow specifying ON_ERROR option without value.

commit   : a6d0fa5ef840bc98e14cb34ecf672e6e2e245517    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 17 Apr 2024 11:31:27 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 17 Apr 2024 11:31:27 +0900    

Click here for diff

The ON_ERROR option of the COPY command previously allowed omitting  
its value, which was inconsistent with the syntax synopsis in the  
documentation and the behavior of other non-boolean COPY options.  
  
This change enforces providing a value for the ON_ERROR option,  
ensuring consistency across other non-boolean options and aligning  
with the documented syntax.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/a9770bf57646d90dedc3d54cf32634b2%40oss.nttdata.com  

M src/backend/commands/copy.c

Update mmgr's README to mention BumpContext

commit   : 58cf2e120e8aee2daed5a9b9ee4471574f712b3b    
  
author   : David Rowley <[email protected]>    
date     : Wed, 17 Apr 2024 10:49:09 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 17 Apr 2024 10:49:09 +1200    

Click here for diff

Oversight in 29f6a959c.  
  
In passing, since we now have 4 memory context types to choose from,  
provide a brief overview of the specialities of each memory context  
type.  
  
Reported-by: Amul Sul  
Author: Amul Sul, David Rowley  
Discussion: https://postgr.es/m/CAAJ_b94U2s9nHh--DEK=sPEZUQ+x7vQJ7529fF8UAH97QJ9NXg@mail.gmail.com  

M src/backend/utils/mmgr/README

Push dedicated BumpBlocks to the tail of the blocks list

commit   : 6d2fd66b9908d1557d7e49b1bdb4c597192f3729    
  
author   : David Rowley <[email protected]>    
date     : Wed, 17 Apr 2024 10:40:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 17 Apr 2024 10:40:31 +1200    

Click here for diff

BumpContext relies on using the head block from its 'blocks' field to  
use as the current block to allocate new chunks to.  When we receive an  
allocation request larger than allocChunkLimit, we place these chunks on  
a new dedicated block and, until now, we pushed the block onto the  
*head* of the 'blocks' list.  
  
This behavior caused the previous bump block to no longer be available  
for new normal-sized (non-large) allocations and would result in blocks  
only being partially filled if a large allocation request arrived before  
the block became full.  
  
Here adjust the code to push these dedicated blocks onto the *tail* of  
the blocks list so that the head block remains intact and available to  
be used by normal allocation request sizes until it becomes full.  
  
In passing, make the elog(ERROR) calls for the unsupported callbacks  
consistent.  Likewise for the header comments for those functions.  
  
Discussion: https://postgr.es/m/CAApHDvp9___r-ayJj0nZ6GD3MeCGwGZ0_6ZptWpwj+zqHtmwCw@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvqerXpzUnuDQfUEi3DZA+9=Ud9WSt3ruxN5b6PcOosx2g@mail.gmail.com  

M src/backend/utils/mmgr/bump.c
M src/test/regress/expected/sysviews.out

Mark some new location fields as ParseLoc

commit   : 2ea5d8bece85518b4b8c052ff134c294c21543e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2024 20:22:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2024 20:22:41 +0200    

Click here for diff

Some new code probably didn't see 605721f819f and continued to use  
type int for parse location fields.  Fix those.  

M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Clean up more indent breakage from 6377e12a5.

commit   : ec07d0d7fae9ac990061bef1aa8995f842839a40    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 13:00:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 13:00:40 -0400    

Click here for diff

Per buildfarm member koel.  

M src/include/foreign/fdwapi.h

Fix assorted bugs in ecpg's macro mechanism.

commit   : 6f0cef9353fcef50e74c31bb06c96c40207fd535    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 12:31:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 12:31:32 -0400    

Click here for diff

The code associated with EXEC SQL DEFINE was unreadable and full of  
bugs, notably:  
  
* It'd attempt to free a non-malloced string if the ecpg program  
tries to redefine a macro that was defined on the command line.  
  
* Possible memory stomp if user writes "-D=foo".  
  
* Undef'ing or redefining a macro defined on the command line would  
change the state visible to the next file, when multiple files are  
specified on the command line.  (While possibly that could have been  
an intentional choice, the code clearly intends to revert to the  
original macro state; it's just failing to consider this interaction.)  
  
* Missing "break" in defining a new macro meant that redefinition  
of an existing name would cause an extra entry to be added to the  
definition list.  While not immediately harmful, a subsequent undef  
would result in the prior entry becoming visible again.  
  
* The interactions with input buffering are subtle and were entirely  
undocumented.  
  
It's not that surprising that we hadn't noticed these bugs,  
because there was no test coverage at all of either the -D  
command line switch or multiple input files.  This patch adds  
such coverage (in a rather hacky way I guess).  
  
In addition to the code bugs, the user documentation was confused  
about whether the -D switch defines a C macro or an ecpg one, and  
it failed to mention that you can write "-Dsymbol=value".  
  
These problems are old, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/ref/ecpg-ref.sgml
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/sql-define.c
M src/interfaces/ecpg/test/expected/sql-define.stderr
M src/interfaces/ecpg/test/expected/sql-define.stdout
M src/interfaces/ecpg/test/sql/Makefile
M src/interfaces/ecpg/test/sql/define.pgc
A src/interfaces/ecpg/test/sql/define_prelim.pgc
M src/interfaces/ecpg/test/sql/meson.build

Fix nbtree "deduce NOT NULL" scan key comment.

commit   : c62d2ebd9e6f94758f5ed3a28cf08861229ae421    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 12:04:20 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 12:04:20 -0400    

Click here for diff

Oversight in commit c9c0589fda.  

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

Undo incorrect typedefs.list change.

commit   : 984c0eccd0ccfcd7df8df47586e3b935a8124a15    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 11:37:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 11:37:51 -0400    

Click here for diff

6377e12a5 should not have removed AcquireSampleRowsFunc,  
as that's still in use.  Per buildfarm member koel.  

M src/tools/pgindent/typedefs.list

Stabilize test of BRIN parallel create

commit   : 4d916dd876c3d9a4ceff5a0c54c5c58a0d1052e3    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2024 17:31:03 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2024 17:31:03 +0200    

Click here for diff

The test for parallel create of BRIN indexes added by commit 8225c2fd40  
happens to be unstable - a background transaction (e.g. auto-analyze)  
may hold back global xmin for the initial VACUUM / CREATE INDEX. If the  
cleanup happens before the next CREATE INDEX, the indexes will not be  
exactly the same.  
  
This is the same issue as e2933a6e11, so fix it the same way by making  
the table TEMPORARY, which uses an up-to-date cutoff xmin that is not  
held back by other processes.  
  
Reported by Alexander Lakhin, who also suggested the fix.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/sql/brin.sql

Ensure generated join clauses for child rels have correct relids.

commit   : 03107b4eda7f2946bb78308cb088a513b718c793    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 11:03:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Apr 2024 11:03:43 -0400    

Click here for diff

When building a join clause derived from an EquivalenceClass, if the  
clause is to be used with an appendrel child relation then make sure  
its clause_relids include the relids of that child relation.  
Normally this would be true already because the EquivalenceMember  
would be a Var of that relation.  However, if the appendrel represents  
a flattened UNION ALL construct then some child EquivalenceMembers  
could be constants with no relids.  The resulting under-marked clause  
is problematic because it could mislead join_clause_is_movable_into  
about where the clause should be evaluated.  We do not have an example  
showing incorrect plan generation, but there are existing cases in  
the regression tests that will fail the Asserts this patch adds to  
get_baserel_parampathinfo.  A similarly wrong conclusion about a  
clause being considered by get_joinrel_parampathinfo would lead to  
wrong placement of the clause.  (This also squares with the way  
that clause_relids is calculated for non-equijoin clauses in  
adjust_appendrel_attrs.)  
  
The other reason for wanting these new Asserts is that the previous  
blithe assumption that the results of generate_join_implied_equalities  
"necessarily satisfy join_clause_is_movable_into" turns out to be  
wrong pre-v16.  If it's still wrong it'd be good to find out.  
  
Per bug #18429 from Benoît Ryder.  The bug as filed was fixed by  
commit 2489d76c4, but these changes correlate with the fix we  
will need to apply in pre-v16 branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/util/relnode.c

Fix nbtree posting list comment.

commit   : f6987041557f2b2b96f116c1f3150f9ed9a77c89    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 11:20:41 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 11:20:41 -0400    

Click here for diff

Oversight in commit 0d861bbb70.  

M src/include/access/nbtree.h

Fix nbtree page recycling comment.

commit   : aa1def44c301ce7fae9ae33f0a95bc01efa297a3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 11:14:36 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 16 Apr 2024 11:14:36 -0400    

Click here for diff

Oversight in commit e5d8a99903.  

M src/include/access/nbtree.h

revert: Generalize relation analyze in table AM interface

commit   : 6377e12a5a5278446bb0d215439b4825ef8996d1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 16 Apr 2024 13:14:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 16 Apr 2024 13:14:20 +0300    

Click here for diff

This commit reverts 27bc1772fc and dd1f6b0c17.  Per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240415201057.khoyxbwwxfgzomeo%40awork3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/analyze.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/vacuum.h
M src/include/foreign/fdwapi.h
M src/tools/pgindent/typedefs.list

Improve test coverage in bump.c

commit   : bea97cd02ebb347ab469b78673c2b33a72109669    
  
author   : David Rowley <[email protected]>    
date     : Tue, 16 Apr 2024 16:21:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 16 Apr 2024 16:21:31 +1200    

Click here for diff

There were no callers of BumpAllocLarge() in the regression tests, so  
here we add a sort with a tuple large enough to use that path in bump.c.  
  
Also, BumpStats() wasn't being called, so add a test to sysviews.sql to  
call pg_backend_memory_contexts() while a bump context exists in the  
backend.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/sysviews.out
M src/test/regress/expected/tuplesort.out
M src/test/regress/sql/sysviews.sql
M src/test/regress/sql/tuplesort.sql

Add missing PGDLLIMPORT markings

commit   : 768ceeeaa127a8001d60ad6a62846a8be3f35d93    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Apr 2024 09:38:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Apr 2024 09:38:46 +0900    

Click here for diff

All backend-side variables should be marked with PGDLLIMPORT, as per  
policy introduced in 8ec569479f.  aafc05de1bf5 has forgotten  
MyClientSocket, and 05c3980e7f47 LoadedSSL.  
  
These can be spotted with a command like this one (be careful of not  
switching __pg_log_level):  
src/tools/mark_pgdllimport.pl $(git ls-files src/include/)  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/include/postmaster/postmaster.h

docs: Consolidate into new "WAL for Extensions" chapter.

commit   : 09d9800e52822ed20d69d98aaa39d3fb10769c44    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 Apr 2024 15:46:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 Apr 2024 15:46:19 -0400    

Click here for diff

Previously, we had consecutive, very short chapters called "Generic  
WAL" and "Custom WAL Resource Managers," explaining different approaches  
to the same problem. Merge them into a single chapter. Explain most  
of the differences between the approaches in the chapter's  
introductory text, rather than in the individual sections.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/generic-wal.sgml
M doc/src/sgml/postgres.sgml
A doc/src/sgml/wal-for-extensions.sgml

doc: Note exceptions for SET ROLE's effect on privilege checks.

commit   : 953cf49e166a1a64e1eaf2b091b84e02848b8c75    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 15 Apr 2024 14:03:24 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 15 Apr 2024 14:03:24 -0500    

Click here for diff

The documentation for SET ROLE states that superusers who switch to  
a non-superuser role lose their superuser privileges.  While this  
is true for most commands, there are exceptions such as SET ROLE  
and SET SESSION AUTHORIZATION, which continue to use the current  
session user and the authenticated user, respectively.  
Furthermore, the description of this command already describes its  
effect, so it is arguably unnecessary to include this special case.  
This commit removes the note about the superuser case and adds a  
sentence about the aforementioned exceptions to the description.  
  
Co-authored-by: Yurii Rashkovskii  
Reviewed-by: Shubham Khanna, Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/CA%2BRLCQysHtME0znk2KUMJN343ksboSRQSU-hCnOjesX6VK300Q%40mail.gmail.com  

M doc/src/sgml/ref/set_role.sgml

Fix type-checking of RECORD-returning functions in FROM, redux.

commit   : e0df80828abc0c01fcde123389032370b98f2015    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2024 12:56:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2024 12:56:56 -0400    

Click here for diff

Commit 2ed8f9a01 intended to institute a policy that if a  
RangeTblFunction has a coldeflist, then the function return type is  
certainly RECORD, and we should use the coldeflist as the source of  
truth about what the columns of the record type are.  When the  
original function has been folded to a constant, inspection of the  
constant might give a different answer.  This situation will lead to  
a tuple-type-mismatch error at execution, but up until that point we  
need to consistently believe the coldeflist, or we'll have problems  
from different bits of code reaching different conclusions.  
  
expandRTE didn't get that memo though, and would try to produce a  
tupdesc based on the constant in this situation, leading to an  
assertion failure.  (Desultory testing suggests that non-assert  
builds often manage to give the expected error, although I also  
saw a "cache lookup failed for type 0" error, and it seems at  
least possible that a crash could happen.)  
  
Some other callers of get_expr_result_type and get_expr_result_tupdesc  
were also being incautious about this.  While none of them seem to  
have actual bugs, they're working harder than necessary in this case,  
besides which it seems safest to have an explicit policy of not using  
those functions on an RTE with a coldeflist.  Adjust the code  
accordingly, and add commentary to funcapi.c about this policy.  
  
Also fix an obsolete comment that claimed "get_expr_result_type()  
doesn't know how to extract type info from a RECORD constant".  
That hasn't been true since commit d57534740.  
  
Per bug #18422 from Alexander Lakhin.  
As with the previous commit, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_relation.c
M src/backend/utils/fmgr/funcapi.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

ATTACH PARTITION: Don't match a PK with a UNIQUE constraint

commit   : cee8db3f680b737b64d747530b48d30828cf4790    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Apr 2024 15:07:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Apr 2024 15:07:47 +0200    

Click here for diff

When matching constraints in AttachPartitionEnsureIndexes() we weren't  
testing the constraint type, which could make a UNIQUE key lacking a  
not-null constraint incorrectly satisfy a primary key requirement.  Fix  
this by testing that the constraint types match.  (Other possible  
mismatches are verified by comparing index properties.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Grammar fixes for split/merge partitions code

commit   : 9dfcac8e15acc3b4d4d5bc02383a56ccb07229fe    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Apr 2024 15:41:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Apr 2024 15:41:37 +0300    

Click here for diff

The fixes relate to comments, error messages, and corresponding expected output  
of regression tests.  
  
Discussion: https://postgr.es/m/CAMbWs49DDsknxyoycBqiE72VxzL_sYHF6zqL8dSeNehKPJhkKg%40mail.gmail.com  
Discussion: https://postgr.es/m/86bfd241-a58c-479a-9a72-2c67a02becf8%40postgrespro.ru  
Discussion: https://postgr.es/m/CAHewXNkGMPU50QG7V6Q60JGFORfo8LfYO1_GCkCa0VWbmB-fEw%40mail.gmail.com  
Author: Richard Guo, Dmitry Koval, Tender Wang  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/test/isolation/specs/partition-merge.spec
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_merge.sql
M src/test/regress/sql/partition_split.sql

Fix propagating attnotnull in multiple inheritance

commit   : c3709100be73ad5af7ff536476d4d713bca41b1a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Apr 2024 12:20:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Apr 2024 12:20:56 +0200    

Click here for diff

In one of the many strange corner cases of multiple inheritance being  
used, commit b0e96f311985 missed a CommandCounterIncrement() call after  
updating the attnotnull flag during ALTER TABLE ADD COLUMN, which caused  
a catalog tuple to be update attempted twice in the same command, giving  
rise to a "tuple already updated by self" error.  Add the missing call  
to solve that, and a test case that reproduces the scenario.  
  
As a (perhaps surprising) secondary effect, this CCI addition triggers  
another behavior change: when a primary key is added to a parent  
partitioned table and the column in an existing partition does not have  
a not-null constraint, we no longer error out.  This will probably be a  
welcome change by some users, and I think it's unlikely that anybody  
will miss the old behavior.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

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

psql: Make output of \dD more stable

commit   : 6ff21c05302592874b8149421711e06043b954fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2024 09:28:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2024 09:28:48 +0200    

Click here for diff

\dD showed domain check constraints in arbitrary order, which can  
cause regression test failures, which was exposed by commit  
9895b35cb8.  To fix, order the constraints by conname, which matches  
what psql does in other queries listing constraints.  

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

Fix ALTER DOMAIN NOT NULL syntax

commit   : 9895b35cb88edc30b836661dbc26d7665716b5a0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2024 08:20:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2024 08:20:34 +0200    

Click here for diff

This addresses a few problems with commit e5da0fe3c22 ("Catalog domain  
not-null constraints").  
  
In CREATE DOMAIN, a NOT NULL constraint looks like  
  
    CREATE DOMAIN d1 AS int [ CONSTRAINT conname ] NOT NULL  
  
(Before e5da0fe3c22, the constraint name was accepted but ignored.)  
  
But in ALTER DOMAIN, a NOT NULL constraint looks like  
  
    ALTER DOMAIN d1 ADD [ CONSTRAINT conname ] NOT NULL VALUE  
  
where VALUE is where for a table constraint the column name would be.  
(This works as of e5da0fe3c22.  Before e5da0fe3c22, this syntax  
resulted in an internal error.)  
  
But for domains, this latter syntax is confusing and needlessly  
inconsistent between CREATE and ALTER.  So this changes it to just  
  
    ALTER DOMAIN d1 ADD [ CONSTRAINT conname ] NOT NULL  
  
(None of these syntaxes are per SQL standard; we are just living with  
the bits of inconsistency that have built up over time.)  
  
In passing, this also changes the psql \dD output to not show not-null  
constraints in the column "Check", since it's already shown in the  
column "Nullable".  This has also been off since e5da0fe3c22.  
  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/9ec24d7b-633d-463a-84c6-7acff769c9e8%40eisentraut.org  

M doc/src/sgml/ref/create_domain.sgml
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/describe.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Put back initialization of 'sslmode', to silence Coverity

commit   : d21d61b96f7a4d89e4b2e7cc9b9a1ec3f642fa12    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 14 Apr 2024 23:02:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 14 Apr 2024 23:02:43 +0300    

Click here for diff

Coverity pointed out that the function checks for conn->sslmode !=  
NULL, which implies that it might be NULL, but later we access it  
without a NULL-check anyway. It doesn't know that it is in fact always  
initialized earlier, in conninfo_add_defaults(), and hence the  
NULL-check is not necessary. However, there is a lot of distance  
between conninfo_add_defaults() and pqConnectOptions2(), so it's not  
surprising that it doesn't see that. Put back the initialization code,  
as it existed before commit 05fd30c0e7, to silence the warning.  
  
In the long run, I'd like to refactor the libpq options handling and  
initalization code. It seems silly to strdup() and copy strings, for  
things like sslmode that have a limited set of possible values; it  
should be an enum. But that's for another day.  

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

Fix unnecessary padding in incremental backups

commit   : cd4b6af620975bb9802c464a06d2289d2f97cbf4    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 20:34:29 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 20:34:29 +0200    

Click here for diff

Commit 10e3226ba13d added padding to incremental backups to ensure the  
block data is properly aligned. The code in sendFile() however failed to  
consider that the header may be a multiple of BLCKSZ and thus already  
aligned, adding a full BLCKSZ of unnecessary padding.  
  
Not only does this make the incremental file a bit larger, but the other  
places calculating the amount of padding did realize it's not needed and  
did not include it in the formula. This resulted in pg_basebackup  
getting confused while parsing the data stream, trying to access files  
with invalid filenames (e.g. with binary data etc.) and failing.  

M src/backend/backup/basebackup.c

Add regression test for BRIN parallel builds

commit   : 8225c2fd40cd9f7d60a826affeacdd8bf0de7bee    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 18:58:30 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 18:58:30 +0200    

Click here for diff

Adds a regression test for parallel CREATE INDEX for BRIN indexes, to  
improve coverage for BRIN code, particularly code to allow parallel  
index builds introduced by b43757171470.  
  
The test is added to pageinspect, as that allows comparing the index to  
one built without parallelism. Another option would be to just build the  
index with parallelism and then check it produces correct results. But  
checking the index is exactly as if built without parallelism makes  
these query checks unnecessary.  
  
Discussion: https://postgr.es/m/1df00a66-db5a-4e66-809a-99b386a06d86%40enterprisedb.com  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/sql/brin.sql

Use the correct PG_DETOAST_DATUM macro in BRIN

commit   : bb616ed3e6a2b263be320026e1660bd36827c858    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 18:19:52 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 18:19:52 +0200    

Click here for diff

Commit 6bcda4a721 replaced PG_DETOAST_DATUM with PG_DETOAST_DATUM_PACKED  
in two BRIN output functions, for minmax-multi and bloom opclasses. But  
this is incorrect - the code is accessing the data through structs that  
already include a 4B header, so the detoast needs to match that. But the  
PACKED macro may keep the 1B header, which means the struct fields will  
point to incorrect data.  
  
Backpatch-through: 16  
Discussion: https://postgr.es/m/1df00a66-db5a-4e66-809a-99b386a06d86%40enterprisedb.com  

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

Update nbits_set in brin_bloom_union

commit   : 2f20ced1eb53de396d8a420fa5cffca2a2376de4    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 17:58:59 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 14 Apr 2024 17:58:59 +0200    

Click here for diff

Properly update the number of bits set in the bitmap after merging the  
filters in brin_bloom_union.  
  
This is mostly harmless, as the counter is used only in the output  
function, which means pageinspect may show incorrect information about  
the BRIN summary. The counter does not affect correctness.  
  
Discovered while adding a regression test comparing indexes built with  
and without parallelism. The parallel index builds exercise the union  
procedure when merging results from workers, which is otherwise very  
hard to do in a test. Which is why this went unnoticed until now.  
  
Backpatch through 14, where the BRIN bloom opclasses were introduced.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/1df00a66-db5a-4e66-809a-99b386a06d86%40enterprisedb.com  

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

freespace: Don't return blocks past the end of the main fork.

commit   : 93582974315174d544592185d797a2b44696d1e5    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2024 08:34:20 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2024 08:34:20 -0700    

Click here for diff

GetPageWithFreeSpace() callers assume the returned block exists in the  
main fork, failing with "could not read block" errors if that doesn't  
hold.  Make that assumption reliable now.  It hadn't been guaranteed,  
due to the weak WAL and data ordering of participating components.  Most  
operations on the fsm fork are not WAL-logged.  Relation extension is  
not WAL-logged.  Hence, an fsm-fork block on disk can reference a  
main-fork block that no WAL record has initialized.  That could happen  
after an OS crash, a replica promote, or a PITR restore.  wal_log_hints  
makes the trouble easier to hit; a replica promote or PITR ending just  
after a relevant fsm-fork FPI_FOR_HINT may yield this broken state.  The  
v16 RelationAddBlocks() mechanism also makes the trouble easier to hit,  
since it bulk-extends even without extension lock waiters.  Commit  
917dc7d2393ce680dea7a59418be9ff341df3c14 stopped trouble around  
truncation, but vectors involving PageIsNew() pages remained.  
  
This implementation adds a RelationGetNumberOfBlocks() call when the  
cached relation size doesn't confirm a block exists.  We've been unable  
to identify a benchmark that slows materially, but this may show up as  
additional time in lseek().  An alternative without that overhead would  
be a new ReadBufferMode such that ReadBufferExtended() returns NULL  
after a 0-byte read, with all other errors handled normally.  However,  
each GetFreeIndexPage() caller would then need code for the return-NULL  
case.  Back-patch to v14, due to earlier versions not caching relation  
size and the absence of a pre-v16 problem report.  
  
Ronan Dunklau.  Reported by Ronan Dunklau.  
  
Discussion: https://postgr.es/m/1878547.tdWV9SEqCh%40aivenlaptop  

M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/smgr/smgr.c
M src/test/recovery/t/008_fsm_truncation.pl

Correct "improve role option documentation".

commit   : 68ba46dfe38c0bdb1078e25222322ad1043abd87    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2024 07:56:14 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2024 07:56:14 -0700    

Click here for diff

This corrects doc commit 21912e3c0262e2cfe64856e028799d6927862563.  
Back-patch to v16, like that one.  
  
Reviewed by David G. Johnston.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Document PG_TEST_EXTRA=libpq_encryption and also check 'kerberos'

commit   : 4cc1c76fe9f13aa96bae14f4fcfdf6d508af72a4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:39 +0300    

Click here for diff

In the libpq encryption negotiation tests, don't run the GSSAPI tests  
unless PG_TEST_EXTRA='kerberos' is also set. That makes it possible to  
still run most of the tests when GSSAPI support is compiled in, but  
there's no MIT Kerberos installation.  

M doc/src/sgml/regress.sgml
M src/interfaces/libpq/t/005_negotiate_encryption.pl

Move libpq encryption negotiation tests

commit   : 65dfe9d167e925cd8892dedb51dde29f69b7388d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:37 +0300    

Click here for diff

The test targets libpq's options, so 'src/test/interfaces/libpq/t' is  
a more natural place for it.  
  
While doing this, I noticed that I had missed adding the  
libpq_encryption subdir to the Makefile. That's why this commit only  
needs to remove it from the meson.build file.  
  
Per Peter Eisentraut's suggestion.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/interfaces/libpq/Makefile
M src/interfaces/libpq/meson.build
R099 src/test/libpq_encryption/t/001_negotiate_encryption.pl src/interfaces/libpq/t/005_negotiate_encryption.pl
D src/test/libpq_encryption/Makefile
D src/test/libpq_encryption/README
D src/test/libpq_encryption/meson.build
M src/test/meson.build

Fix compilation with --with-gssapi --without-openssl

commit   : 084cae55131f71f32e15a6b2b7897aa1c7382c0a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:34 +0300    

Click here for diff

The #define is spelled ENABLE_GSS, not USE_GSS. Introduced in commit  
05fd30c0e7, reported by Thomas Munro.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKG%2BHRTtB%2Bx%[email protected]  

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

Fix libpq_encryption tests when compiled without SSL support

commit   : 0a5f2291891ffca96ccd3ef29c9c1541a9277970    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Apr 2024 19:52:28 +0300    

Click here for diff

It correctly skipped tests involving SSL in the server when SSL  
support was not compiled in, but even when SSL is not enabled in the  
server and the connection is established without SSL, libpq behaves  
differently in many of the test scenarios when libpq is compiled  
without SSL support. For example, with sslmode=prefer, if libpq is  
compiled with SSL support it will attempt to use SSL, but without SSL  
support it will try authenticating in plaintext mode directly. The  
expected test output didn't take that into account.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKG%2BHRTtB%2Bx%[email protected]  

M src/test/libpq_encryption/t/001_negotiate_encryption.pl

Don't allocate large buffer on the stack in pg_verifybackup

commit   : 929c05774b512bdf7ea4a5912fa2f4d63fc90712    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 Apr 2024 10:52:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 Apr 2024 10:52:25 -0400    

Click here for diff

Per complaint from Andres Freund. Follow his suggestion to allocate the  
buffer once in the calling routine instead.  
  
Also make a tiny indentation improvement.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/pg_verifybackup.c

Assorted minor cleanups in the test_json_parser module

commit   : 42fa4b660143b66bea1fb90793ec90054e170c93    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 15:30:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 15:30:48 -0400    

Click here for diff

Per gripes from Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Along the way, also clean up a handful of typos in 3311ea86ed and  
ea7b4e9a2a, found by Alexander Lakhin, and a couple of stylistic  
snafus noted by Daniel Westermann and Daniel Gustafsson.  

M src/backend/backup/basebackup_incremental.c
M src/common/jsonapi.c
M src/common/parse_manifest.c
M src/test/modules/test_json_parser/README
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_json_parser/test_json_parser_perf.c

Shrink test file for test_json_parser module

commit   : b8a7bfa33324bc40c7180cb946a39378fb48309c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 14:35:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 14:35:08 -0400    

Click here for diff

Also delete live URLs  
  
Jacob Champion  
  
Discussion: https://postgr.es/m/CAOYmi+mtH=V1wZKAOauCd5QqQWr61hnXMJbJ9h-CZXAa1JXd3w@mail.gmail.com  

M src/test/modules/test_json_parser/tiny.json
M src/test/modules/test_json_parser/tiny.out

Add a TAP test for test_json_parser_perf

commit   : daf554dbeabf0957a25c9e37488d42c047c0ce23    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 14:23:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 14:23:20 -0400    

Click here for diff

This just makes sure the test can run with a single iteration. A real  
performance test would test with many more.  

M src/test/modules/test_json_parser/meson.build
A src/test/modules/test_json_parser/t/004_test_parser_perf.pl

Fix some memory leaks associated with parsing json and manifests

commit   : 661ab4e185784db79c194b5758555b1db3f30483    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 09:07:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Apr 2024 09:07:14 -0400    

Click here for diff

Coverity complained about not freeing some memory associated with  
incrementally parsing backup manifests. To fix that, provide and use a new  
shutdown function for the JsonManifestParseIncrementalState object, in  
line with a suggestion from Tom Lane.  
  
While analysing the problem, I noticed a buglet in freeing memory for  
incremental json lexers. To fix that remove a bogus condition on  
freeing the memory allocated for them.  

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

Fix recently introduced typo in code comment

commit   : b9ecefecc7aaad117e0255b56b759f524f0f4363    
  
author   : David Rowley <[email protected]>    
date     : Fri, 12 Apr 2024 23:15:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 12 Apr 2024 23:15:52 +1200    

Click here for diff

Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49kAsZUsj7-0SBLvE9+uKz0RCqMEmM3NVytc1YvS8sTrQ@mail.gmail.com  

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

Fix the review comments and a bug in the slot sync code.

commit   : 3741f2a09d5205ec32bd8af5d1f397e08995932b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 12 Apr 2024 15:03:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 12 Apr 2024 15:03:28 +0530    

Click here for diff

Ensure that when updating the catalog_xmin of the synced slots, it is  
first written to disk before changing the in-memory value  
(effective_catalog_xmin). This is to prevent a scenario where the  
in-memory value change triggers a vacuum to remove catalog tuples before  
the catalog_xmin is written to disk. In the event of a crash before the  
catalog_xmin is persisted, we would not know that some required catalog  
tuples have been removed and the synced slot would be invalidated.  
  
Change the sanity check to ensure that remote_slot's confirmed_flush LSN  
can't precede the local/synced slot during slot sync. Note that the  
restart_lsn of the synced/local slot can be ahead of remote_slot. This can  
happen when slot advancing machinery finds a running xacts record after  
reaching the consistent state at a later point than the primary where it  
serializes the snapshot and updates the restart_lsn.  
  
Make the check to sync slots robust by allowing to sync only when the  
confirmed_lsn, restart_lsn, or catalog_xmin of the remote slot is ahead of  
the synced/local slot.  
  
Reported-by: Amit Kapila and Shveta Malik  
Author: Hou Zhijie, Shveta Malik  
Reviewed-by: Amit Kapila, Bertrand Drouvot  
Discussion: https://postgr.es/m/OS0PR01MB57162B67D3CB01B2756FBA6D94062@OS0PR01MB5716.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/CAJpy0uCSS5zmdyUXhvw41HSdTbRqX1hbYqkOfHNj7qQ+2zn0AQ@mail.gmail.com  

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

Fix IS [NOT] NULL qual optimization for inheritance tables

commit   : 3af7040985b6df504a72cd307aad5d69ac5f5384    
  
author   : David Rowley <[email protected]>    
date     : Fri, 12 Apr 2024 20:07:53 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 12 Apr 2024 20:07:53 +1200    

Click here for diff

b262ad440 added code to have the planner remove redundant IS NOT NULL  
quals and eliminate needless scans for IS NULL quals on tables where the  
qual's column has a NOT NULL constraint.  
  
That commit failed to consider that an inheritance parent table could  
have differing NOT NULL constraints between the parent and the child.  
This caused issues as if we eliminated a qual on the parent, when  
applying the quals to child tables in apply_child_basequals(), the qual  
might not have been added to the parent's baserestrictinfo.  
  
Here we fix this by not applying the optimization to remove redundant  
quals to RelOptInfos belonging to inheritance parents and applying the  
optimization again in apply_child_basequals().  Effectively, this means  
that the parent and child are considered independently as the parent has  
both an inh=true and inh=false RTE and we still apply the optimization  
to the RelOptInfo corresponding to the inh=false RTE.  
  
We're able to still apply the optimization in add_base_clause_to_rel()  
for partitioned tables as the NULLability of partitions must match that  
of their parent.  And, if we ever expand restriction_is_always_false()  
and restriction_is_always_true() to handle partition constraints then we  
can apply the same logic as, even in multi-level partitioned tables,  
there's no way to route values to a partition when the qual does not  
match the partition qual of the partitioned table's parent partition.  
The same is true for CHECK constraints as those must also match between  
arent partitioned tables and their partitions.  
  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAMbWs4930gQSZmjR7aANzEapdy61gCg6z8dT-kAEYD0sYWKPdQ@mail.gmail.com  

M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql

Doc: fix bogus to_date() examples.

commit   : 6d4f062714953ed0ec865ff96d5af122b8c3e77f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2024 11:09:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2024 11:09:00 -0400    

Click here for diff

November doesn't have 31 days.  Remarkably, this thinko  
has escaped detection since commit 3f1998727.  
  
Noted by Y. Saburov.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Revert: Implement pg_wal_replay_wait() stored procedure

commit   : 772faafca1b288c4dd66b7150a7831c27b768003    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 16:30:32 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 16:30:32 +0300    

Click here for diff

This commit reverts 06c418e163, e37662f221, bf1e650806, 25f42429e2,  
ee79928441, and 74eaf66f98 per review by Heikki Linnakangas.  
  
Discussion: https://postgr.es/m/b155606b-e744-4218-bda5-29379779da1a%40iki.fi  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/system_functions.sql
M src/backend/commands/Makefile
M src/backend/commands/meson.build
D src/backend/commands/waitlsn.c
M src/backend/lib/pairingheap.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
D src/include/commands/waitlsn.h
M src/include/lib/pairingheap.h
M src/include/storage/lwlocklist.h
M src/test/recovery/meson.build
D src/test/recovery/t/043_wal_replay_wait.pl
M src/tools/pgindent/typedefs.list

Revert: Allow table AM to store complex data structures in rd_amcache

commit   : 922c4c461d213a422ee7eb6c38e399607539210a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:54:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:54:25 +0300    

Click here for diff

This commit reverts 02eb07ea89 per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h
M src/include/utils/rel.h

Revert: Allow table AM tuple_insert() method to return the different slot

commit   : 8dd0bb84da7d56a9e41241b26bfbf6b79644d574    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:53:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:53:26 +0300    

Click here for diff

This commit reverts c35a3fb5e0 per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h

Revert: Allow locking updated tuples in tuple_update() and tuple_delete()

commit   : 193e6d18e553a104d315ff81892d509d89a30fd8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:51:35 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:51:35 +0300    

Click here for diff

This commit reverts 87985cc925 and 818861eb57 per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/trigger.h

Revert: Let table AM insertion methods control index insertion

commit   : da841aa4dc279bb0053de56121c927ec943edff3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:47:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:47:53 +0300    

Click here for diff

This commit reverts b1484a3f19 per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/catalog/indexing.c
M src/backend/commands/copyfrom.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/tableam.h

Revert: Custom reloptions for table AM

commit   : bc1e2092ebb857802a9713d0d3588079e2f0216a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:46:35 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Apr 2024 15:46:35 +0300    

Click here for diff

This commit reverts 9bd99f4c26 and 422041542f per review by Andres Freund.  
  
Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/createas.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/relcache.c
M src/include/access/reloptions.h
M src/include/access/tableam.h
M src/include/utils/rel.h
M src/test/modules/Makefile
M src/test/modules/meson.build
D src/test/modules/test_tam_options/.gitignore
D src/test/modules/test_tam_options/Makefile
D src/test/modules/test_tam_options/expected/test_tam_options.out
D src/test/modules/test_tam_options/meson.build
D src/test/modules/test_tam_options/sql/test_tam_options.sql
D src/test/modules/test_tam_options/test_tam_options–1.0.sql
D src/test/modules/test_tam_options/test_tam_options.c
D src/test/modules/test_tam_options/test_tam_options.control
M src/tools/pgindent/typedefs.list

meson: Remove obsolete function test

commit   : 87840b9741864dfdb9f63b0056e2783cdb49b8a5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Apr 2024 12:44:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Apr 2024 12:44:54 +0200    

Click here for diff

The test for pstat was removed from configure by 9db300ce6e3 but not  
from meson.build.  Do that now.  

M meson.build

postgres_fdw: Improve comment about handling of asynchronous requests.

commit   : 56c6703bd0beb1ade7816d6bdc4372c4933ec461    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 11 Apr 2024 19:25:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 11 Apr 2024 19:25:00 +0900    

Click here for diff

We updated this comment in back branches (see commit f6f61a4bd et al);  
let's do so in HEAD as well for consistency.  
  
Discussion: https://postgr.es/m/CAPmGK142V1kqDfjo2H%2Bb54JTn2woVBrisFq%2B%3D9jwXwxr0VvbgA%40mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c

Use correct datatype for xmin variables in slot.c

commit   : 8f136af3c41c3b7e6474d6dd05238f11059f26f1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Apr 2024 17:19:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Apr 2024 17:19:20 +0900    

Click here for diff

Two variables storing a slot's effective_xmin and effective_catalog_xmin  
were saved as XLogRecPtr, which is incorrect as these should be  
TransactionIds.  
  
Oversight in 818fefd8fd44.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVPSB74mrDTFezz-LV3Oi6F3SN71QA0oUHvndzi5dwTNg@mail.gmail.com  
Backpatch-through: 16  

M src/backend/replication/slot.c

Revert indexed and enlargable binary heap implementation.

commit   : 810f64a01567610af7b92b0de930f16f3e20064e    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 11 Apr 2024 17:18:05 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 11 Apr 2024 17:18:05 +0900    

Click here for diff

This reverts commit b840508644 and bcb14f4abc. These commits were made  
for commit 5bec1d6bc5 (Improve eviction algorithm in ReorderBuffer  
using max-heap for many subtransactions). However, per discussion,  
commit efb8acc0d0 replaced binary heap + index with pairing heap, and  
made these commits unnecessary.  
  
Reported-by: Jeff Davis  
Discussion: https://postgr.es/m/12747c15811d94efcc5cda72d6b35c80d7bf3443.camel%40j-davis.com  

M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump_sort.c
M src/common/binaryheap.c
M src/include/lib/binaryheap.h
M src/tools/pgindent/typedefs.list

Replace binaryheap + index with pairingheap in reorderbuffer.c

commit   : efb8acc0d05894e0c6c20dfc00513b53098780f0    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 11 Apr 2024 17:04:38 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 11 Apr 2024 17:04:38 +0900    

Click here for diff

A pairing heap can perform the same operations as the binary heap +  
index, with as good or better algorithmic complexity, and that's an  
existing data structure so that we don't need to invent anything new  
compared to v16. This commit makes the new binaryheap functionality  
that was added in commits b840508644 and bcb14f4abc unnecessary, but  
they will be reverted separately.  
  
Remove the optimization to only build and maintain the heap when the  
amount of memory used is close to the limit, becuase the bookkeeping  
overhead with the pairing heap seems to be small enough that it  
doesn't matter in practice.  
  
Reported-by: Jeff Davis  
Author: Heikki Linnakangas  
Reviewed-by: Michael Paquier, Hayato Kuroda, Masahiko Sawada  
Discussion: https://postgr.es/m/12747c15811d94efcc5cda72d6b35c80d7bf3443.camel%40j-davis.com  

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

Fix grammar.

commit   : 942219996c632ae9e66c2c4a759e93abc92014ff    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 11 Apr 2024 14:35:42 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 11 Apr 2024 14:35:42 +1200    

Click here for diff

Reported-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/ZhdKqj5DwoOzirFv%40paquier.xyz  

M src/backend/backup/basebackup_incremental.c

Fix potential stack overflow in incremental backup.

commit   : d8f5acbdb9b22106db583e3cbb177d34e6b18eeb    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 11 Apr 2024 13:19:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 11 Apr 2024 13:19:29 +1200    

Click here for diff

The user can set RELSEG_SIZE to a high number at compile time, so we  
can't use it to control the size of an array on the stack: it could be  
many gigabytes in size.  On closer inspection, we don't really need that  
intermediate array anyway.  Let's just write directly into the output  
array, and then perform the absolute->relative adjustment in place.  
This fixes new code from commit dc212340058.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B2hZ0sBztPW4mkLfng0qfkNtAHFUfxOMLizJ0BPmi5%2Bg%40mail.gmail.com  

M src/backend/backup/basebackup_incremental.c

Fix inconsistency with replay of hash squeeze record for clean buffers

commit   : f56a9def71bb1d2ccf4fa01a4d1e082c1063d921    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Apr 2024 09:20:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Apr 2024 09:20:51 +0900    

Click here for diff

aa5edbe379d6 has tweaked _hash_freeovflpage() so as the write buffer's  
LSN is updated only when necessary, when REGBUF_NO_CHANGE is not used.  
  
The replay code was not consistent with that, causing the write buffer's  
LSN to be updated and its page to be marked as dirty even if the buffer  
was registered in a "clean" state.  This was possible for the case of a  
squeeze record when there are no tuples to add to the write buffer, for  
(is_prim_bucket_same_wrt && !is_prev_bucket_same_wrt).  
  
I have performed some validation of this commit with  
wal_consistency_checking and a change in WAL that logs REGBUF_NO_CHANGE  
to a new BKPIMAGE_*.  Thanks to that, it is possible to know at replay  
if a buffer was clean when it was registered, then cross-checked the LSN  
of the "clean" page copy coming from WAL with the LSN of the block once  
the record has been replayed.  This eats one bit in bimg_info, which is  
not acceptable to be integrated as-is, but it could become handy in the  
future.  I didn't spot other areas than the one fixed by this commit at  
the extent of what the main regression test suite covers.  
  
As this is an oversight in aa5edbe379d6, no backpatch is required.  
  
Reported-by: Zubeyr Eryilmaz  
Author: Hayato Kuroda  
Reviewed-by: Amit Kapila, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c

Fix plpgsql's handling of -- comments following expressions.

commit   : 5392dd3d2ad5a371c95e648442fd121d8a8a5c42    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Apr 2024 15:45:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Apr 2024 15:45:58 -0400    

Click here for diff

Up to now, read_sql_construct() has collected all the source text from  
the statement or expression's initial token up to the character just  
before the "until" token.  It normally tries to strip trailing  
whitespace from that, largely for neatness.  If there was a "-- text"  
comment after the expression, this resulted in removing the newline  
that terminates the comment, which creates a hazard if we try to paste  
the collected text into a larger SQL construct without inserting a  
newline after it.  In particular this caused our handling of CASE  
constructs to fail if there's a comment after a WHEN expression.  
  
Commit 4adead1d2 noticed a similar problem with cursor arguments,  
and worked around it through the rather crude hack of suppressing  
the whitespace-trimming behavior for those.  Rather than do that  
and leave the hazard open for future hackers to trip over, let's  
fix it properly.  pl_scanner.c already has enough infrastructure  
to report the end location of the expression's last token, so  
we can copy up to that location and never collect any trailing  
whitespace or comment to begin with.  
  
Erik Wienhold and Tom Lane, per report from Michal Bartak.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAAVzF_FjRoi8fOVuLCZhQJx6HATQ7MKm=aFOHWZODFnLmjX-xA@mail.gmail.com  

M src/pl/plpgsql/src/expected/plpgsql_control.out
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_control.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

commit   : 52b49b796cc7fd976f4da6aa49c9679ecdae8bd5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Apr 2024 13:53:25 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Apr 2024 13:53:25 +0200    

Click here for diff

The tools.ietf.org site has been decommissioned and replaced by a  
number of sites serving various purposes.  Links to RFCs and BCPs  
are now 301 redirected to their new respective IETF sites.  Since  
this serves no purpose and only adds network overhead, update our  
links to the new locations.  
  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/uuid-ossp.sgml

Make GIN tests using injection points concurrent-safe

commit   : 5105c90796811f62711538155d207e5311eacf9b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Apr 2024 13:48:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Apr 2024 13:48:13 +0900    

Click here for diff

f587338dec87 has introduced in the test module injection_points a SQL  
function called injection_points_set_local(), that can be used to make  
all the injection points linked to the process where they are attached,  
discarded automatically if any remain once the process exits.  
  
e2e3b8ae9ed7 has added a NO_INSTALLCHECK to the test module to prevent  
the use of installcheck.  Now that there is a way to make the test  
concurrent-safe, let's use it and remove the installcheck restriction.  
  
Concurrency issues could be easily reproduced by running in a tight  
loop a command like this one, in src/test/modules/gin/ (hardcoding  
pg_sleep() after attaching injection points enlarges the race window)  
and a second test suite like contrib/btree_gin/:  
  
  make installcheck USE_MODULE_DB=1  
  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/gin/Makefile
M src/test/modules/gin/expected/gin_incomplete_splits.out
M src/test/modules/gin/meson.build
M src/test/modules/gin/sql/gin_incomplete_splits.sql

Fix a test in failover slots regression test.

commit   : 7e85d1c75f299b0772fbeb145706e019629530bd    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Apr 2024 08:44:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Apr 2024 08:44:17 +0530    

Click here for diff

Wait for the standby to catch up before syncing the slots with  
pg_sync_replication_slots(), otherwise, the logical slot could be ahead  
and the sync would fail.  
  
The other way to fix the test is to change it to use slotsync worker and  
poll for the sync to get finished but the current approach is better as  
this is a predictable way to write the test.  
  
Per buildfarm  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB571665359F2F5DCD3ADABC9F94002@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Fix illegal attribute propagation in LLVM JIT.

commit   : 53c8d6c9f157f2bc8211b8de02417e55fefddbc7    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2024 10:46:15 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2024 10:46:15 +1200    

Click here for diff

Commit 72559438 started copying more attributes from AttributeTemplate  
to the functions we generate on the fly.  In the case of deform  
functions, which return void, this meant that "noundef", from  
AttributeTemplate's return value (a Datum) was copied to a void type.  
Older LLVM releases were OK with that, but LLVM 18 crashes.  
  
Update our llvm_copy_attributes() function to skip copying the attribute  
for the return value, if the target function returns void.  
  
Thanks to Dmitry Dolgov for help chasing this down.  
  
Back-patch to all supported releases, like 72559438.  
  
Reported-by: Pavel Stehule <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Discussion: https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com  

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

Fixup various StringInfo function usages

commit   : 8461424fd717877ead0706984ef9b6440b2a97ad    
  
author   : David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 11:53:32 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 11:53:32 +1200    

Click here for diff

This adjusts various appendStringInfo* function calls to use a more  
appropriate and efficient function with the same behavior.  For example,  
use appendStringInfoChar() when appending a single character rather than  
appendStringInfo() and appendStringInfoString() when no formatting is  
required rather than using appendStringInfo().  
  
All adjustments made here are in code that's new to v17, so it makes  
sense to fix these now rather than wait a few years and make  
backpatching harder.  
  
Discussion: https://postgr.es/m/CAApHDvojY2UvMiO+9_55ArTj10P1LBNJyyoGB+C65BLDNT0GsQ@mail.gmail.com  
Reviewed-by: Nathan Bossart, Tom Lane  

M contrib/postgres_fdw/deparse.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c

revert: Transform OR clauses to ANY expression

commit   : ff9f72c68f678ded340b431c3e280fe56644a3e7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 10 Apr 2024 02:07:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 10 Apr 2024 02:07:34 +0300    

Click here for diff

This commit reverts 72bd38cc99 due to implementation and design issues.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/3604469.1712628736%40sss.pgh.pa.us  

M doc/src/sgml/config.sgml
M src/backend/nodes/queryjumblefuncs.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/queryjumble.h
M src/include/optimizer/optimizer.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/partition_prune.sql
M src/tools/pgindent/typedefs.list

Remove unused BumpBlockIsValid macro

commit   : 5a15bdea3b791223b4cc708d4953a0086f4332a6    
  
author   : David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 11:10:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 11:10:16 +1200    

Click here for diff

The bump allocator was recently added in 29f6a959c.  Our other  
allocators have a similar macro to this, but seemingly the version of  
the macro for those allocators is only used in places where the chunk  
header is decoded.  Since the bump allocator has no chunk header, none  
of those functions exist for bump therefore macro is unused.  Remove it.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

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

Checks for ALTER TABLE ... SPLIT/MERGE PARTITIONS ... commands

commit   : c99ef1811a064a94fb78917f35bb5853059a92b7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 10 Apr 2024 01:47:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 10 Apr 2024 01:47:00 +0300    

Click here for diff

Check that the target partition actually belongs to the parent table.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/cd842601-cf1a-9806-f7b7-d2509b93ba61%40gmail.com  
Author: Dmitry Koval  

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

Doc: use "an SQL" instead of "a SQL"

commit   : b1b13d2b524e64e3bf3538441366bdc8f6d3beda    
  
author   : David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 10:43:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 10 Apr 2024 10:43:31 +1200    

Click here for diff

Although which is correct depends entirely on whether you pronounce SQL  
as "ess-que-ell" or "sequel", we have standardized on the former in our  
user-facing documentation, so use the correct article according to that  
pronunciation.  
  
Discussion: https://postgr.es/m/CAApHDvp3osQwQam+wNTp9BdhP+QfWO6aY6ZTixQQMfM-UArKCw@mail.gmail.com  

M doc/src/sgml/ddl.sgml

doc: Remove stray comma from list of psql options

commit   : ad55cc984519232a5c64cae585b22a46ede21b31    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 9 Apr 2024 23:39:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 9 Apr 2024 23:39:38 +0200    

Click here for diff

Back in 7.2 the list of options had short options and long options  
on the same line separated by comma, but since 7.3 they are listed  
separate lines. The comma on -X was left behind so fix by removing  
and backpatching all the way.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

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

Fix incorrect format placeholders

commit   : 27074bce08e994daf6b8fe9a84877ac257210fdd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 14:33:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 14:33:06 +0200    

Click here for diff

M src/backend/commands/explain.c

Update config.guess and config.sub

commit   : cfd6ea3ac04113b756e3e722af5d9247ff2da35f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 14:21:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 14:21:57 +0200    

Click here for diff

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

Fix whitespace

commit   : 43a9cab4844b9c933f1a24e24a38311ee24deefd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 11:32:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2024 11:32:48 +0200    

Click here for diff

M doc/src/sgml/ddl.sgml
M src/test/modules/test_json_parser/t/003_test_semantic.pl

Get rid of anonymous struct

commit   : bf183f168c447355ba82151f1c7305368a95c834    
  
author   : John Naylor <[email protected]>    
date     : Tue, 9 Apr 2024 16:16:01 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 9 Apr 2024 16:16:01 +0700    

Click here for diff

This is a C11 feature, and we require C99. While at it, go the further  
step and get rid of the surrounding union (with uintptr_t) entirely,  
as there is currently no use case for this file to access the header of  
BlocktableEntry as a uintptr_t, and there are no additional alignment  
requirements. The least invasive way seems to be to transfer the old  
union name to this struct.  
  
Reported by Pavel Borisov and Andres Freund, per buildfarm member mylodon  
Reviewed by Pavel Borisov  
  
Discussion: https://postgr.es/m/CALT9ZEH11NYV8AOzKb1bWhCf6J0H=H31f0MgT9xX+HdqvcA1rw@mail.gmail.com  

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

libpq error message fixes

commit   : baa82b78dc97459b6d2a5843cc77fcf755809269    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2024 08:06:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2024 08:06:31 +0300    

Click here for diff

Remove stray paren, capitalize SSL and ALPN.  
  
Author: Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix typo in docs

commit   : e9f29233fd67bd6b6667b61c88aa1f37f61f353a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2024 08:04:20 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2024 08:04:20 +0300    

Click here for diff

Author: Erik Rijkers  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/libpq.sgml

Add missing set_pglocale_pgservice() for pg_walsummary and pg_combinebackup

commit   : deca6ac136f4cd09280b3385dc5de3e8ec57e9ba    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Apr 2024 14:01:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Apr 2024 14:01:33 +0900    

Click here for diff

These calls are required to make both tools work with NLS.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

injection_points: Fix race condition with local injection point tests

commit   : f4083c49751018ae2140de8bf752b8d60485a6ca    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Apr 2024 10:31:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Apr 2024 10:31:12 +0900    

Click here for diff

The module relies on a shmem exit callback to clean up any injection  
points linked to a specific process.  One of the tests checks for the  
case of an injection point name reused in a second connection where the  
first connection should clean it up, but it did not count for the fact  
that the shmem exit callback of the first connection may not have run  
when the second connection begins its work.  
  
The regress library includes a wait_pid() that can be used for this  
purpose, instead of a custom wait logic, so let's rely on it to wait for  
the first connection to exit before working with the second connection.  
The module gains a REGRESS_OPTS to be able to look at the regress  
library's dlpath.  
  
This issue could be reproduced with a hardcoded sleep() in the shmem  
exit callback, and the CI has been able to trigger it sporadically.  
  
Oversight in f587338dec87.  
  
Reported-by: Bharath Rupireddy  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/meson.build
M src/test/modules/injection_points/sql/injection_points.sql

In psql, avoid leaking a PGresult after a query is cancelled.

commit   : f463de59d90c10f3d0daf2d5b132ca58e4111a08    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2024 17:00:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2024 17:00:07 -0400    

Click here for diff

After a query cancel, the tail end of ExecQueryAndProcessResults  
took care to clear any not-yet-read PGresults; but it forgot about  
the one it has already read.  There would only be such a result  
when handling a multi-command string made with "\;", so that you'd  
have to cancel an earlier command in such a string to reach the  
bug at all.  Even then, there would only be leakage of a single  
PGresult per cancel, so it's not surprising nobody noticed this.  
But a leak is a leak.  
  
Noted while re-reviewing 90f517821, but this is independent of that:  
it dates to 7844c9918.  Back-patch to v15 where that came in.  

M src/bin/psql/common.c

Further review for re-implementation of psql's FETCH_COUNT feature.

commit   : c21d4c416ad61b78cf450f11861bbafbdfb7eebc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2024 15:49:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2024 15:49:10 -0400    

Click here for diff

Alexander Lakhin noted an obsolete comment, which led me to revisit  
some other important comments in the patch, and that study turned up a  
couple of unintended ways in which the chunked-fetch code path didn't  
match the normal code path in ExecQueryAndProcessResults.  The only  
nontrivial problem is that it didn't call PrintQueryStatus, so that  
we'd not print the final status result from DML ... RETURNING  
commands.  To avoid code duplication, move the filter for whether a  
result is from RETURNING from PrintQueryResult to PrintQueryStatus.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/common.c

Teach radix tree to embed values at runtime

commit   : 0fe5f64367bc2fc70baa1f0f993638830f8aa6a5    
  
author   : John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 18:54:35 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 18:54:35 +0700    

Click here for diff

Previously, the decision to store values in leaves or within the child  
pointer was made at compile time, with variable length values using  
leaves by necessity. This commit allows introspecting the length of  
variable length values at runtime for that decision. This requires  
the ability to tell whether the last-level child pointer is actually  
a value, so we use a pointer tag in the lowest level bit.  
  
Use this in TID store. This entails adding a byte to the header to  
reserve space for the tag. Commit f35bd9bf3 stores up to three offsets  
within the header with no bitmap, and now the header can be embedded  
as above. This reduces worst-case memory usage when TIDs are sparse.  
  
Reviewed (in an earlier version) by Masahiko Sawada  
  
Discussion: https://postgr.es/m/CANWCAZYw+_KAaUNruhJfE=h6WgtBKeDG32St8vBJBEY82bGVRQ@mail.gmail.com  
Discussion: https://postgr.es/m/CAD21AoBci3Hujzijubomo1tdwH3XtQ9F89cTNQ4bsQijOmqnEw@mail.gmail.com  

M src/backend/access/common/tidstore.c
M src/include/lib/radixtree.h

Teach TID store to skip bitmap for small numbers of offsets

commit   : f35bd9bf359d3d740063997e1cbab9b69df7af99    
  
author   : John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 18:38:11 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 18:38:11 +0700    

Click here for diff

The header portion of BlocktableEntry has enough padding space for  
an array of 3 offsets (1 on 32-bit platforms). Use this space instead  
of having a sparse bitmap array. This will take up a constant amount  
of space no matter what the offsets are.  
  
Reviewed (in an earlier version) by Masahiko Sawada  
  
Discussion: https://postgr.es/m/CANWCAZYw+_KAaUNruhJfE=h6WgtBKeDG32St8vBJBEY82bGVRQ@mail.gmail.com  
Discussion: https://postgr.es/m/CAD21AoBci3Hujzijubomo1tdwH3XtQ9F89cTNQ4bsQijOmqnEw@mail.gmail.com  

M src/backend/access/common/tidstore.c
M src/test/modules/test_tidstore/expected/test_tidstore.out
M src/test/modules/test_tidstore/sql/test_tidstore.sql

Provide a way block-level table AMs could re-use acquire_sample_rows()

commit   : dd1f6b0c172a643a73d6b71259fa2d10378b39eb    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 14:30:30 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 14:30:30 +0300    

Click here for diff

While keeping API the same, this commit provides a way for block-level table  
AMs to re-use existing acquire_sample_rows() by providing custom callbacks  
for getting the next block and the next tuple.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20240407214001.jgpg5q3yv33ve6y3%40awork3.anarazel.de  
Reviewed-by: Pavel Borisov  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/analyze.c
M src/include/access/tableam.h
M src/include/commands/vacuum.h
M src/tools/pgindent/typedefs.list

Fix some grammer errors from error messages and codes comments

commit   : df64c81ca9cba7b0fcb0ded5f735e99e676671c1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 14:39:28 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 14:39:28 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAHewXNkGMPU50QG7V6Q60JGFORfo8LfYO1_GCkCa0VWbmB-fEw%40mail.gmail.com  
Author: Tender Wang  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/partition_split.out

Fill CommonRdOptions with default values in extract_autovac_opts()

commit   : 422041542f313f23ca66cad26e9b2b99c4d1999a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 12:11:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 12:11:56 +0300    

Click here for diff

Reported-by: Thomas Munro  
Reported-by: Pavel Borisov  
Discussion: https://postgr.es/m/CA%2BhUKGLZzLR50RBvuqOO3MZ%3DF54ETz-rTp1PDX9uDGP_GqyYqA%40mail.gmail.com  

M src/backend/access/common/reloptions.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/cache/relcache.c
M src/include/access/reloptions.h

Adjust wording of trace_connection_negotiation GUC's description

commit   : 3dbd2ff78654b2ac484a8d08ace788c492117894    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 12:14:20 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 12:14:20 +0300    

Click here for diff

We're not very consistent about this across all the GUCs, but the  
"Logs ..." phrasing is more common than "Log ...", and is used by the  
neighboring "log_connections" and "log_disconnections" GUCs, so switch  
to that.  
  
Author: Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Custom reloptions for table AM

commit   : 9bd99f4c26fe37b8ee2f199aa868a0e2fdba4c43    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 11:23:28 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 11:23:28 +0300    

Click here for diff

Let table AM define custom reloptions for its tables. This allows specifying  
AM-specific parameters by the WITH clause when creating a table.  
  
The reloptions, which could be used outside of table AM, are now extracted  
into the CommonRdOptions data structure.  These options could be by decision  
of table AM directly specified by a user or calculated in some way.  
  
The new test module test_tam_options evaluates the ability to set up custom  
reloptions and calculate fields of CommonRdOptions on their base.  
  
The code may use some parts from prior work by Hao Wu.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Discussion: https://postgr.es/m/AMUA1wBBBxfc3tKRLLdU64rb.1.1683276279979.Hmail.wuhao%40hashdata.cn  
Reviewed-by: Reviewed-by: Pavel Borisov, Matthias van de Meent, Jess Davis  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/createas.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/relcache.c
M src/include/access/reloptions.h
M src/include/access/tableam.h
M src/include/utils/rel.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_tam_options/.gitignore
A src/test/modules/test_tam_options/Makefile
A src/test/modules/test_tam_options/expected/test_tam_options.out
A src/test/modules/test_tam_options/meson.build
A src/test/modules/test_tam_options/sql/test_tam_options.sql
A src/test/modules/test_tam_options/test_tam_options–1.0.sql
A src/test/modules/test_tam_options/test_tam_options.c
A src/test/modules/test_tam_options/test_tam_options.control
M src/tools/pgindent/typedefs.list

Fix the intermittent buildfarm failures in 040_standby_failover_slots_sync.

commit   : 6f3d8d5e7cc2f2e2367cd6da6f8affe98d1f5729    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 8 Apr 2024 13:21:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 8 Apr 2024 13:21:55 +0530    

Click here for diff

It is possible that even if the primary waits for the subscriber to catch  
up and then disables the subscription, the XLOG_RUNNING_XACTS record gets  
inserted between the two steps by bgwriter and walsender processes it.  
This can move the restart_lsn of the corresponding slot in an  
unpredictable way which further leads to slot sync failure.  
  
To ensure predictable behaviour, we drop the subscription and manually  
create the slot before the test. The other idea we discussed to write a  
predictable test is to use injection points to control the bgwriter  
logging XLOG_RUNNING_XACTS but that needs more analysis. We can add a  
separate test using injection points.  
  
Per buildfarm  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila, Shveta Malik  
Discussion: https://postgr.es/m/CAA4eK1JD8h_XLRsK_o_Xh=5MhTzm+6d4Cb4_uPgFJ2wSQDah=g@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Use bump context for TID bitmaps stored by vacuum

commit   : 8a1b31e6e59631807a08a4e9465134c343bbdf5e    
  
author   : John Naylor <[email protected]>    
date     : Sun, 7 Apr 2024 12:27:34 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 7 Apr 2024 12:27:34 +0700    

Click here for diff

Vacuum does not pfree individual entries, and only frees the entire  
storage space when finished with it. This allows using a bump context,  
eliminating the chunk header in each leaf allocation. Most leaf  
allocations will be 16 to 32 bytes, so that's a significant savings.  
TidStoreCreateLocal gets a boolean parameter to indicate that the  
created store is insert-only.  
  
This requires a separate tree context for iteration, since we free  
the iteration state after iteration completes.  
  
Discussion: https://postgr.es/m/CANWCAZac%3DpBePg3rhX8nXkUuaLoiAJJLtmnCfZsPEAS4EtJ%3Dkg%40mail.gmail.com  
Discussion: https://postgr.es/m/CANWCAZZQFfxvzO8yZHFWtQV+Z2gAMv1ku16Vu7KWmb5kZQyd1w@mail.gmail.com  

M src/backend/access/common/tidstore.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/tidstore.h
M src/include/lib/radixtree.h
M src/test/modules/test_tidstore/test_tidstore.c

JSON_TABLE: Add support for NESTED paths and columns

commit   : bb766cde63b4f624d029b34c9cdd3d0a94fd5b46    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 15:58:58 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 15:58:58 +0900    

Click here for diff

A NESTED path allows to extract data from nested levels of JSON  
objects given by the parent path expression, which are projected as  
columns specified using a nested COLUMNS clause, just like the parent  
COLUMNS clause.  Rows comprised from a NESTED columns are "joined"  
to the row comprised from the parent columns.  If a particular NESTED  
path evaluates to 0 rows, then the nested COLUMNS will emit NULLs,  
making it an OUTER join.  
  
NESTED columns themselves may include NESTED paths to allow  
extracting data from arbitrary nesting levels, which are likewise  
joined against the rows at the parent level.  
  
Multiple NESTED paths at a given level are called "sibling" paths  
and their rows are combined by UNIONing them, that is, after being  
joined against the parent row as described above.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Jian He <[email protected]>  
  
Reviewers have included (in no particular order):  
  
Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup,  
Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson,  
Justin Pryzby, Álvaro Herrera, Jian He  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.c
M src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.stderr
M src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.stdout
M src/interfaces/ecpg/test/sql/sqljson_jsontable.pgc
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/sql/sqljson_jsontable.sql
M src/tools/pgindent/typedefs.list

Fix JsonExpr deparsing to emit QUOTES and WRAPPER correctly

commit   : f6a2529920cff76cb6e37ea840122574404dde8b    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 16:02:40 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 16:02:40 +0900    

Click here for diff

Currently, get_json_expr_options() does not emit the default values  
for QUOTES (KEEP QUOTES) and WRAPPER (WITHOUT WRAPPER).  That causes  
the deparsed JSON_TABLE() columns, such as those contained in a a  
view's query, to behave differently when executed than the original  
definition.  That's because the rules encoded in  
transformJsonTableColumns() will choose either JSON_VALUE() or  
JSON_QUERY() as implementation to execute a given column's path  
expression depending on the QUOTES and WRAPPER specificationd and  
they have slightly different semantics.  
  
Reported-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxEqhqsfrg_p7EMyo5zak3d767iFDL8vz_4%3DZBHpOtrghw%40mail.gmail.com  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/expected/sqljson_queryfuncs.out

Fix restriction on specifying KEEP QUOTES in JSON_QUERY()

commit   : 561b74ddb8781f8c0511f6473c51fb51c8c6b087    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 16:02:29 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 8 Apr 2024 16:02:29 +0900    

Click here for diff

Currently, transformJsonFuncExpr() enforces some restrictions on  
the combinations of QUOTES and WRAPPER clauses that can be specified  
in JSON_QUERY().  The intent was to only prevent the useless  
combination WITH WRAPPER OMIT QUOTES, but the coding prevented KEEP  
QUOTES too, which is not helpful. Fix that.  

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

Fix the wording of or_to_any_transform_limit description

commit   : b453a7a16a7ed2ba96522e521143bc652b74875f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 08:59:27 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 08:59:27 +0300    

Click here for diff

Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20240408.144657.1746688590065601661.horikyota.ntt%40gmail.com  

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

Fix the value of or_to_any_transform_limit in postgresql.conf.sample

commit   : 2af75e1174786a02fc35755c0cb98c522d72a065    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 08:51:07 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 08:51:07 +0300    

Click here for diff

Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/ZhM8jH8gsKm5Q-9p%40pryzbyj2023  

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

Remove references to old function name

commit   : e3b69be951597eeee9c546fbfc51f9f801c7b198    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2024 21:41:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2024 21:41:00 -0700    

Click here for diff

In a97bbe1f1df I accidentally referenced heapgetpage(), both in a function  
name and a comment. But since 44086b09753 the relevant function is named  
heap_prepare_pagescan().  Rename the new function to page_collect_tuples().  
  
Reported-by: Melanie Plageman <[email protected]>  
Reported-by: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAApHDvp4SniHopTrVeKWcEvNXFtdki0utAvO=5R7H6TNhtULRQ@mail.gmail.com  

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

Add pg_buffercache_evict() function for testing.

commit   : 13453eedd3f692f8dcf8e334396eee84f00fdde2    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 7 Apr 2024 09:13:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 7 Apr 2024 09:13:17 +1200    

Click here for diff

When testing buffer pool logic, it is useful to be able to evict  
arbitrary blocks.  This function can be used in SQL queries over the  
pg_buffercache view to set up a wide range of buffer pool states.  Of  
course, buffer mappings might change concurrently so you might evict a  
block other than the one you had in mind, and another session might  
bring it back in at any time.  That's OK for the intended purpose of  
setting up developer testing scenarios, and more complicated interlocking  
schemes to give stronger guararantees about that would likely be less  
flexible for actual testing work anyway.  Superuser-only.  
  
Author: Palak Chaturvedi <[email protected]>  
Author: Thomas Munro <[email protected]> (docs, small tweaks)  
Reviewed-by: Nitin Jadhav <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Cary Huang <[email protected]>  
Reviewed-by: Cédric Villemain <[email protected]>  
Reviewed-by: Jim Nasby <[email protected]>  
Reviewed-by: Maxim Orlov <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CALfch19pW48ZwWzUoRSpsaV9hqt0UPyaBPC4bOZ4W+c7FF566A@mail.gmail.com  

M contrib/pg_buffercache/Makefile
M contrib/pg_buffercache/meson.build
A contrib/pg_buffercache/pg_buffercache–1.4–1.5.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M doc/src/sgml/pgbuffercache.sgml
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Fix alignment of stack variable

commit   : 0ea51bac3802dca9dcf5cbaaf7a19a1c1ae4781a    
  
author   : John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 10:40:20 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 8 Apr 2024 10:40:20 +0700    

Click here for diff

Declare with union similar to PGAlignedBlock.  
  
Report and fix by Andres Freund  
  
Discussion: https://postgr.es/m/20240407190731.izm3mdazednrsiqk%40awork3.anarazel.de  

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

Add more tab completion support for ALTER DEFAULT PRIVILEGES in psql.

commit   : 304b6b1a6b7116bae30ea24119f04474eba7f0ed    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 8 Apr 2024 12:15:10 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 8 Apr 2024 12:15:10 +0900    

Click here for diff

This adds tab completion of "GRANT" and "REVOKE [GRANT OPTION FOR]"  
for ALTER DEFAULT PRIVILEGES, and adds "WITH GRANT OPTION" for  
ALTER DEFAULT PRIVILEGES ... GRANT ... TO role.  
  
Author: Vignesh C, with cosmetic adjustments by me  
Reviewed-by: Shubham Khanna, Masahiko Sawada  
Discussion: https://postgr.es/m/CALDaNm1aEdJb-QJi%3DGWStkfj_%2BEDUK_VtDkn%2BTjQ2z7HyU0MBw%40mail.gmail.com  

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

Remove redundant nbtree preprocessing assertions.

commit   : 3b08133cd13c4ac985a94222280160282ba35838    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 7 Apr 2024 22:13:28 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 7 Apr 2024 22:13:28 -0400    

Click here for diff

One of the assertions was the subject of a false positive complaint from  
Coverity, but none of the assertions added much, so get rid of them.  
  
Reported-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

simplehash: Free collisions array in SH_STAT

commit   : af7e90a2778625d63add69165fb68c370509a199    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2024 19:00:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2024 19:00:11 -0700    

Click here for diff

While SH_STAT() is only used for debugging, the allocated array can be large,  
and therefore should be freed.  
  
It's unclear why coverity started warning now.  
  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Coverity  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-  

M src/include/lib/simplehash.h

Fix check for 'outlen' return from SSL_select_next_proto()

commit   : 3e60e956b0017ae9d329bf242e76c4487fb39b4d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 05:03:17 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 05:03:17 +0300    

Click here for diff

Fixes compiler warning reported by Andres Freund.  
  
Discusssion: https://www.postgresql.org/message-id/[email protected]  

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

Silence perlcritic warnings in new libpq tests

commit   : d60ab76f630921dc4deb958fb7892ef6b0e4a7ee    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:32:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:32:26 +0300    

Click here for diff

Per buildfarm member 'koel'.  

M src/test/libpq_encryption/t/001_negotiate_encryption.pl

Send ALPN in TLS handshake, require it in direct SSL connections

commit   : 91044ae4baeac2e501e34164a69bd5d9c4976d21    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:51 +0300    

Click here for diff

libpq now always tries to send ALPN. With the traditional negotiated  
SSL connections, the server accepts the ALPN, and refuses the  
connection if it's not what we expect, but connecting without ALPN is  
still OK. With the new direct SSL connections, ALPN is mandatory.  
  
NOTE: This uses "TBD-pgsql" as the protocol ID. We must register a  
proper one with IANA before the release!  
  
Author: Greg Stark, Heikki Linnakangas  
Reviewed-by: Matthias van de Meent, Jacob Champion  

M doc/src/sgml/libpq.sgml
M src/backend/libpq/be-secure-openssl.c
M src/backend/tcop/backend_startup.c
M src/bin/psql/command.c
M src/include/libpq/libpq-be.h
M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-secure-openssl.c

Support TLS handshake directly without SSLRequest negotiation

commit   : d39a49c1e459804831302807c724fa6512e90cf0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:49 +0300    

Click here for diff

By skipping SSLRequest, you can eliminate one round-trip when  
establishing a TLS connection. It is also more friendly to generic TLS  
proxies that don't understand the PostgreSQL protocol.  
  
This is disabled by default in libpq, because the direct TLS handshake  
will fail with old server versions. It can be enabled with the  
sslnegotation=direct option. It will still fall back to the negotiated  
TLS handshake if the server rejects the direct attempt, either because  
it is an older version or the server doesn't support TLS at all, but  
the fallback can be disabled with the sslnegotiation=requiredirect  
option.  
  
Author: Greg Stark, Heikki Linnakangas  
Reviewed-by: Matthias van de Meent, Jacob Champion  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqcomm.c
M src/backend/tcop/backend_startup.c
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/libpq_encryption/t/001_negotiate_encryption.pl

Refactor libpq state machine for negotiating encryption

commit   : 05fd30c0e730bd5238f62d2fdfdcfaf28b16b225    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 04:24:46 +0300    

Click here for diff

This fixes the few corner cases noted in commit 705843d294, as shown  
by the changes in the test.  
  
Author: Heikki Linnakangas, Matthias van de Meent  
Reviewed-by: Jacob Champion  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/test/libpq_encryption/t/001_negotiate_encryption.pl

Use streaming I/O in ANALYZE.

commit   : 041b96802efa33d2bc9456f2ad946976b92b5ae1    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 8 Apr 2024 13:16:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 8 Apr 2024 13:16:20 +1200    

Click here for diff

The ANALYZE command prefetches and reads sample blocks chosen by a  
BlockSampler algorithm. Instead of calling [Prefetch|Read]Buffer() for  
each block, ANALYZE now uses the streaming API introduced in b5a9b18cd0.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Jakub Wartak <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/flat/CAN55FZ0UhXqk9v3y-zW_fp4-WCp43V8y0A72xPmLkOM%2B6M%2BmJg%40mail.gmail.com  

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

injection_points: Introduce runtime conditions

commit   : f587338dec87d3c35b025e131c5977930ac69077    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2024 09:47:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2024 09:47:50 +0900    

Click here for diff

This adds a new SQL function injection_points_set_local() that can be  
used to force injection points to be run only in the process where they  
are attached.  This is handy for SQL tests to:  
- Detach automatically injection points when the process exits.  
- Allow tests with injection points to run concurrently with other test  
suites, so as such modules do not have to be marked with  
NO_INSTALLCHECK.  
  
Currently, the only condition that can be registered is for a PID.  
This could be extended to more kinds later, if required, like database  
names/OIDs, roles, or more concepts I did not consider.  
  
Using a single function for SQL scripts is an idea from Heikki  
Linnakangas.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/sql/injection_points.sql
M src/tools/pgindent/typedefs.list

Enhance libpq encryption negotiation tests with new GUC

commit   : 705843d294d5d3bc5cce4001596df4df5f1c8b59    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:37 +0300    

Click here for diff

The new "log_connection_negotiation" server option causes the server  
to print messages to the log when it receives a SSLRequest or  
GSSENCRequest packet from the client. Together with "log_connections",  
it gives a trace of how a connection and encryption is  
negotiatated. Use the option in the libpq_encryption test, to verify  
in more detail how libpq negotiates encryption with different  
gssencmode and sslmode options.  
  
This revealed a couple of cases where libpq retries encryption or  
authentication, when it should already know that it cannot succeed.  I  
marked them with XXX comments in the test tables. They only happen  
when the connection was going to fail anyway, and only with rare  
combinations of options, so they're not serious.  
  
Discussion: https://www.postgresql.org/message-id/CAEze2Wja8VUoZygCepwUeiCrWa4jP316k0mvJrOW4PFmWP0Tcw@mail.gmail.com  

M src/backend/tcop/backend_startup.c
M src/backend/utils/misc/guc_tables.c
M src/test/libpq_encryption/t/001_negotiate_encryption.pl

With gssencmode='require', check credential cache before connecting

commit   : 20f9b61cc1926775b1ceb25196df942efaf8bdd2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:35 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:35 +0300    

Click here for diff

Previously, libpq would establish the TCP connection, and then  
immediately disconnect if the credentials were not available.  The  
same thing happened if you tried to use a Unix domain socket with  
gssencmode=require. Check those conditions before establishing the TCP  
connection.  
  
This is a very minor issue, but my motivation to do this now is that  
I'm about to add more detail to the tests for encryption negotiation.  
This makes the case of gssencmode=require but no credentials  
configured fail at the same stage as with gssencmode=require and  
GSSAPI support not compiled at all. That avoids having to deal with  
variations in expected output depending on build options.  
  
Discussion: https://www.postgresql.org/message-id/CAEze2Wja8VUoZygCepwUeiCrWa4jP316k0mvJrOW4PFmWP0Tcw@mail.gmail.com  

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

Add tests for libpq gssencmode and sslmode options

commit   : 1169920ff77025550718b90a5cafc6849875f43f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:32 +0300    

Click here for diff

Test all combinations of gssencmode, sslmode, whether the server  
supports SSL and/or GSSAPI encryption, and whether they are accepted  
by pg_hba.conf. This is in preparation for refactoring that code in  
libpq, and for adding a new option for "direct SSL" connections, which  
adds another dimension to the logic.  
  
If we add even more options in the future, testing all combinations  
will become unwieldy and we'll need to rethink this, but for now an  
exhaustive test is nice.  
  
Author: Heikki Linnakangas, Matthias van de Meent  
Reviewed-by: Jacob Champion  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M .cirrus.tasks.yml
A src/test/libpq_encryption/Makefile
A src/test/libpq_encryption/README
A src/test/libpq_encryption/meson.build
A src/test/libpq_encryption/t/001_negotiate_encryption.pl
M src/test/meson.build

Move Kerberos module

commit   : 9f899562d420fe36305badc169550673914389b7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Apr 2024 02:49:30 +0300    

Click here for diff

So that we can reuse it in new tests.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Reviewed-by: Jacob Champion, Matthias van de Meent  

M src/test/kerberos/t/001_auth.pl
A src/test/perl/PostgreSQL/Test/Kerberos.pm

Make GIN test using injection points repeatable

commit   : 997db123c054c597164be77b7bf7da6479471621    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2024 08:45:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2024 08:45:04 +0900    

Click here for diff

As written, the test would fail when run repeatedly because one of the  
injection points attached was not detached.  This would not matter if  
the test is rewritten to be concurrently safe, but let's be clean and  
it is a good practice.  
  
Oversight in 6a1ea02c491d.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/gin/expected/gin_incomplete_splits.out
M src/test/modules/gin/sql/gin_incomplete_splits.sql

Fix incorrect KeeperBlock macro in bump.c

commit   : 705ec0565371033082e7b1c278afcb42aa5a7421    
  
author   : David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 11:06:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 11:06:31 +1200    

Click here for diff

The macro was missing a MAXALIGN around the sizeof(BumpContext) which  
would cause problems detecting the keeper block on 32-bit systems that  
have a MAXALIGN value of 8.  
  
Thank you to Andres Freund, Tomas Vondra and Tom Lane for investigating  
and testing.  
  
Reported-by: Melanie Plageman, Tomas Vondra  
Discussion: https://postgr.es/m/CAAKRu_Y6dZjiJEZghgNZp0Gjar1JVq-CH7XGDqExDVHnPgDjuw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

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

Fix usage of same ListCell transform_or_to_any()'s in nested loops

commit   : beabea6c2063e583628c59d03102dba996975b4a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 01:38:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 01:38:37 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAAKRu_b4SXNW4GAM0bv3e6wcL5ODSXg1ZdRCn6uyLLjSPbveBg%40mail.gmail.com  
Author: Melanie Plageman  

M src/backend/optimizer/prep/prepqual.c

Transform OR clauses to ANY expression

commit   : 72bd38cc99a15da6f97373fae98027c908c398ea    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 01:27:28 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Apr 2024 01:27:28 +0300    

Click here for diff

Replace (expr op C1) OR (expr op C2) ... with expr op ANY(ARRAY[C1, C2, ...])  
on the preliminary stage of optimization when we are still working with the  
expression tree.  
  
Here Cn is a n-th constant expression, 'expr' is non-constant expression, 'op'  
is an operator which returns boolean result and has a commuter (for the case  
of reverse order of constant and non-constant parts of the expression,  
like 'Cn op expr').  
  
Sometimes it can lead to not optimal plan.  This is why there is a  
or_to_any_transform_limit GUC.  It specifies a threshold value of length of  
arguments in an OR expression that triggers the OR-to-ANY transformation.  
Generally, more groupable OR arguments mean that transformation will be more  
likely to win than to lose.  
  
Discussion: https://postgr.es/m/567ED6CA.2040504%40sigaev.ru  
Author: Alena Rybakina <[email protected]>  
Author: Andrey Lepikhov <[email protected]>  
Reviewed-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Ranier Vilela <[email protected]>  
Reviewed-by: Alexander Korotkov <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Jian He <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/nodes/queryjumblefuncs.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/queryjumble.h
M src/include/optimizer/optimizer.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/partition_prune.sql
M src/tools/pgindent/typedefs.list

Change debug printing to log filename

commit   : 75a47b6a0dc4a235307e1acd1a6b3845cb881e55    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 8 Apr 2024 00:24:20 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 8 Apr 2024 00:24:20 +0200    

Click here for diff

When restarting the cluster fails the code introduced in 33774978c78  
printed the full log contents to aid debugging.  For cases when the  
logfile is large this adds unnecessary overhead.  Reduce to printing  
the logfile path instead.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: clarify behavior of boolean options in replication protocol commands.

commit   : 626603d46337ee331d7616b34ae539b1195556a7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 17:16:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 17:16:32 -0400    

Click here for diff

Same idea as ec7e053a9, but applying to the walsender commands  
described in protocol.sgml.  
  
Peter Smith  
  
Discussion: https://postgr.es/m/CAHut+PvwjZfdGt2R8HTXgSZft=jZKymrS8KUg31pS7zqaaWKKw@mail.gmail.com  

M doc/src/sgml/protocol.sgml

Remove useless duplicate call of defGetBoolean().

commit   : 0c66a164e75163f5a850fb89d13ec0b213753d8d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 17:08:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 17:08:06 -0400    

Click here for diff

Seems to be a copy-and-paste error dating to dc2123400.  
Noted while reviewing a related documentation patch.  

M src/backend/backup/basebackup.c

Doc: show how to get the equivalent of LIMIT for UPDATE/DELETE.

commit   : 2daeba6a4e49f2ac4cc202fc9352c2a59e928a6c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 16:26:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 16:26:47 -0400    

Click here for diff

Add examples showing use of a CTE and a self-join to perform  
partial UPDATEs and DELETEs.  
  
Corey Huinker, reviewed by Laurenz Albe  
  
Discussion: https://postgr.es/m/CADkLM=caNEQsUwPWnfi2jR4ix99E0EJM_3jtcE-YjnEQC7Rssw@mail.gmail.com  

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

Doc: update documentation about EXCLUDE constraint elements.

commit   : 1973d9fb318316df16b0da89e6fe5f2c53473b38    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 15:36:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2024 15:36:08 -0400    

Click here for diff

What the documentation calls an exclude_element is an index_elem  
according to gram.y, and it allows all the same options that  
a CREATE INDEX column specification does.  The COLLATE patch  
neglected to update the CREATE/ALTER TABLE docs about that,  
and later the opclass-parameters patch made the same oversight.  
Add those options to the syntax synopses, and polish the  
associated text a bit.  
  
Back-patch to v13 where opclass parameters came in.  We could  
update v12 with just the COLLATE omission, but it doesn't quite  
seem worth the trouble at this point.  
  
Shihao Zhong, reviewed by Daniel Vérité, Shubham Khanna and myself  
  
Discussion: https://postgr.es/m/CAGRkXqShbVyB8E3gapfdtuwiWTiK=Q67Qb9qwxu=+-w0w46EBA@mail.gmail.com  

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

Use conditional variable to wait for next MultiXact offset

commit   : a0e0fb1ba56ff4323542c75ce997a41d31ad28a0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2024 20:33:45 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2024 20:33:45 +0200    

Click here for diff

In one multixact.c edge case, we need a mechanism to wait for one  
multixact offset to be written before being allowed to read the next  
one.  We used to handle this case by sleeping for one millisecond and  
retrying, but such sleeps have been reported as problematic in  
production cases.  We can avoid the problem by using a condition  
variable: readers sleep on it and then every creator of multixacts  
broadcasts into the CV when creation is sufficiently far along.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Andrey Borodin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/20200515.090333.24867479329066911.horikyota.ntt  

M src/backend/access/transam/multixact.c
M src/backend/utils/activity/wait_event_names.txt

Avoid extra lookups with nbtree array inequalities.

commit   : 473411fc51157e8e825ee865c2822f976e0da5e3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 7 Apr 2024 14:15:54 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 7 Apr 2024 14:15:54 -0400    

Click here for diff

nbtree index scans with SAOP inequalities (but no SAOP equalities)  
performed extra ORDER proc lookups for any remaining equality strategy  
scan keys.  This could waste cycles, and caused assertion failures.  
Keeping around a separate ORDER proc is only necessary for a scan's  
non-array/non-SAOP equality scan keys when the scan has at least one  
other SAOP equality strategy key (a SAOP inequality shouldn't count).  
  
To fix, replace _bt_preprocess_array_keys_final's assertion with a test  
that makes the function return early when the scan has no SAOP equality  
scan keys.  
  
Oversight in commit 1b134ca5, which enhanced nbtree ScalarArrayOp  
execution.  
  
Reported-By: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Don't clobber test exit code at cleanup in LDAP/Kerberors tests

commit   : a475a2fa3bc9c68eaa2aeda28d6d86529eda4673    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 7 Apr 2024 20:21:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 7 Apr 2024 20:21:27 +0300    

Click here for diff

If the test script die()d before running the first test, the whole test  
was interpreted as SKIPped rather than failed. The PostgreSQL::Cluster  
module got this right.  
  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm

Improve check in LDAP test to find the OpenLDAP installation

commit   : e13b586d7c989147afd910c6997659a8412a8b84    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 7 Apr 2024 20:21:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 7 Apr 2024 20:21:21 +0300    

Click here for diff

If the OpenLDAP installation directory is not found, set $setup to 0  
so that the LDAP tests are skipped. The macOS checks were already  
doing that, but the checks on other OS's were not. While we're at it,  
improve the error message when the tests are skipped, to specify  
whether the OS is supported at all, or if we just didn't find the  
installation directory.  
  
This was accidentally "working" without this, i.e. we were skipping  
the tests if the OpenLDAP installation was not found, because of a bug  
in the LdapServer test module: the END block clobbered the exit code  
so if the script die()s before running the first subtest, the whole  
test script was marked as SKIPped. The next commit will fix that bug,  
but we need to fix the setup code first.  
  
These checks should probably go into configure/meson, but this is  
better than nothing and allows fixing the bug in the END block.  
  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/ldap/LdapServer.pm
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl

Use streaming I/O in sequential scans.

commit   : b7b0f3f27241e424b7103397489464d907cef2c4    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 8 Apr 2024 01:48:27 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 8 Apr 2024 01:48:27 +1200    

Click here for diff

Instead of calling ReadBuffer() for each block, heap sequential scans  
and TID range scans now use the streaming API introduced in b5a9b18cd0.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/flat/CAAKRu_YtXJiYKQvb5JsA2SkwrsizYLugs4sSOZh3EAjKUg%3DgEQ%40mail.gmail.com  

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

Use bump memory context for tuplesorts

commit   : 6ed83d5fa55cf6e6c9d1be34ec10730c48eba763    
  
author   : David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 00:32:26 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 00:32:26 +1200    

Click here for diff

29f6a959c added a bump allocator type for efficient compact allocations.  
Here we make use of this for non-bounded tuplesorts to store tuples.  
This is very space efficient when storing narrow tuples due to bump.c  
not having chunk headers.  This means we can fit more tuples in work_mem  
before spilling to disk, or perform an in-memory sort touching fewer  
cacheline.  
  
Author: David Rowley  
Reviewed-by: Nathan Bossart  
Reviewed-by: Matthias van de Meent  
Reviewed-by: Tomas Vondra  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAApHDvqGSpCU95TmM=Bp=6xjL_nLys4zdZOpfNyWBk97Xrdj2w@mail.gmail.com  

M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/utils/tuplesort.h

Add XLogCtl->logInsertResult

commit   : f3ff7bf83bce11709add9a6d31d4bebe95e086e3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2024 14:06:30 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2024 14:06:30 +0200    

Click here for diff

This tracks the position of WAL that's been fully copied into WAL  
buffers by all processes emitting WAL.  (For some reason we call that  
"WAL insertion").  This is updated using atomic monotonic advance during  
WaitXLogInsertionsToFinish, which is not when the insertions actually  
occur, but it's the only place where we know where have all the  
insertions have completed.  
  
This value is useful in WALReadFromBuffers, which can verify that  
callers don't try to read past what has been inserted.  (However, more  
infrastructure is needed in order to actually use WAL after the flush  
point, since it could be lost.)  
  
The value is also useful in WaitXLogInsertionsToFinish() itself, since  
we can now exit quickly when all WAL has been already inserted, without  
even having to take any locks.  

M src/backend/access/transam/xlog.c
M src/include/port/atomics.h

Introduce a bump memory allocator

commit   : 29f6a959cfd8ffa7d6db2c0629439c5329e2853e    
  
author   : David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 00:02:43 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 8 Apr 2024 00:02:43 +1200    

Click here for diff

This introduces a bump MemoryContext type.  The bump context is best  
suited for short-lived memory contexts which require only allocations  
of memory and never a pfree or repalloc, which are unsupported.  
  
Memory palloc'd into a bump context has no chunk header.  This makes  
bump a useful context type when lots of small allocations need to be  
done without any need to pfree those allocations.  Allocation sizes are  
rounded up to the next MAXALIGN boundary, so with this and no chunk  
header, allocations are very compact indeed.  
  
Allocations are also very fast as bump does not check any freelists to  
try and make use of previously free'd chunks.  It just checks if there  
is enough room on the current block, and if so it bumps the freeptr  
beyond this chunk and returns the value that the freeptr was previously  
pointing to.  Simple and fast.  A new block is malloc'd when there's not  
enough space in the current block.  
  
Code using the bump allocator must take care never to call any functions  
which could try to call realloc() (or variants), pfree(),  
GetMemoryChunkContext() or GetMemoryChunkSpace() on a bump allocated  
chunk.  Due to lack of chunk headers, these operations are unsupported.  
To increase the chances of catching such issues, when compiled with  
MEMORY_CONTEXT_CHECKING, bump allocated chunks are given a header and  
any attempt to perform an unsupported operation will result in an ERROR.  
Without MEMORY_CONTEXT_CHECKING, code attempting an unsupported  
operation could result in a segfault.  
  
A follow-on commit will implement the first user of bump.  
  
Author: David Rowley  
Reviewed-by: Nathan Bossart  
Reviewed-by: Matthias van de Meent  
Reviewed-by: Tomas Vondra  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAApHDvqGSpCU95TmM=Bp=6xjL_nLys4zdZOpfNyWBk97Xrdj2w@mail.gmail.com  

M src/backend/nodes/gen_node_support.pl
M src/backend/utils/mmgr/Makefile
A src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/meson.build
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
M src/include/utils/memutils_internal.h
M src/tools/pgindent/typedefs.list

Enlarge bit-space for MemoryContextMethodID

commit   : 0ba8b75e7ea6b7b3090c81239ebcb866772a624b    
  
author   : David Rowley <[email protected]>    
date     : Sun, 7 Apr 2024 23:32:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 7 Apr 2024 23:32:00 +1200    

Click here for diff

Reserve 4 bits for MemoryContextMethodID rather than 3.  3 bits did  
technically allow a maximum of 8 memory context types, however, we've  
opted to reserve some bit patterns which left us with only 4 slots, all  
of which were used.  
  
Here we add another bit which frees up 8 slots for future memory context  
types.  
  
In passing, adjust the enum names in MemoryContextMethodID to make it  
more clear which ones can be used and which ones are reserved.  
  
Author: Matthias van de Meent, David Rowley  
Discussion: https://postgr.es/m/CAApHDvqGSpCU95TmM=Bp=6xjL_nLys4zdZOpfNyWBk97Xrdj2w@mail.gmail.com  

M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h

Avoid needless large memcpys in libpq socket writing

commit   : c4ab7da60617f020e8d75b1584d0754005d71830    
  
author   : David Rowley <[email protected]>    
date     : Sun, 7 Apr 2024 21:20:18 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 7 Apr 2024 21:20:18 +1200    

Click here for diff

Until now, when calling pq_putmessage to write new data to a libpq  
socket, all writes are copied into a buffer and that buffer gets flushed  
when full to avoid having to perform small writes to the socket.  
  
There are cases where we must write large amounts of data to the socket,  
sometimes larger than the size of the buffer.  In this case, it's  
wasteful to memcpy this data into the buffer and flush it out, instead,  
we can send it directly from the memory location that the data is already  
stored in.  
  
Here we adjust internal_putbytes() so that after having just flushed the  
buffer to the socket, if the remaining bytes to send is as big or bigger  
than the buffer size, we just send directly rather than needlessly  
copying into the PqSendBuffer buffer first.  
  
Examples of operations that write large amounts of data in one message  
are; outputting large tuples with SELECT or COPY TO STDOUT and  
pg_basebackup.  
  
Author: Melih Mutlu  
Reviewed-by: Heikki Linnakangas  
Reviewed-by: Jelte Fennema-Nio  
Reviewed-by: David Rowley  
Reviewed-by: Ranier Vilela  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAGPVpCR15nosj0f6xe-c2h477zFR88q12e6WjEoEZc8ZYkTh3Q@mail.gmail.com  

M src/backend/libpq/pqcomm.c

Reduce branches in heapgetpage()'s per-tuple loop

commit   : a97bbe1f1df9eba0b18207c321c67de80b33db16    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 6 Apr 2024 20:51:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 6 Apr 2024 20:51:07 -0700    

Click here for diff

Until now, heapgetpage()'s loop over all tuples performed some conditional  
checks for each tuple, even though condition did not change across the loop.  
  
This commit fixes that by moving the loop into an inline function. By calling  
it with different constant arguments, the compiler can generate an optimized  
loop for the different conditions, at the price of two per-page checks.  
  
For cases of all-visible tables and an isolation level other than  
serializable, speedups of up to 25% have been measured.  
  
Reviewed-by: John Naylor <[email protected]>  
Reviewed-by: Zhang Mingli <[email protected]>  
Tested-by: Quan Zongliang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Optimize visibilitymap_count() with AVX-512 instructions.

commit   : 41c51f0c68b21b4603bd2a9c3d3ad017fdd22627    
  
author   : Nathan Bossart <[email protected]>    
date     : Sat, 6 Apr 2024 22:58:23 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Sat, 6 Apr 2024 22:58:23 -0500    

Click here for diff

Commit 792752af4e added infrastructure for using AVX-512 intrinsic  
functions, and this commit uses that infrastructure to optimize  
visibilitymap_count().  Specificially, a new pg_popcount_masked()  
function is introduced that applies a bitmask to every byte in the  
buffer prior to calculating the population count, which is used to  
filter out the all-visible or all-frozen bits as needed.  Platforms  
without AVX-512 support should also see a nice speedup due to the  
reduced number of calls to a function pointer.  
  
Co-authored-by: Ants Aasma  
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com  

M src/backend/access/heap/visibilitymap.c
M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_avx512.c

Optimize pg_popcount() with AVX-512 instructions.

commit   : 792752af4eb5cf7b5b8b0470dbf22901c5178fe5    
  
author   : Nathan Bossart <[email protected]>    
date     : Sat, 6 Apr 2024 21:56:23 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Sat, 6 Apr 2024 21:56:23 -0500    

Click here for diff

Presently, pg_popcount() processes data in 32-bit or 64-bit chunks  
when possible.  Newer hardware that supports AVX-512 instructions  
can use 512-bit chunks, which provides a nice speedup, especially  
for larger buffers.  This commit introduces the infrastructure  
required to detect compiler and CPU support for the required  
AVX-512 intrinsic functions, and it adds a new pg_popcount()  
implementation that uses these functions.  If CPU support for this  
optimized implementation is detected at runtime, a function pointer  
is updated so that it is used by subsequent calls to pg_popcount().  
  
Most of the existing in-tree calls to pg_popcount() should benefit  
from these instructions, and calls with smaller buffers should at  
least not regress compared to v16.  The new infrastructure  
introduced by this commit can also be used to optimize  
visibilitymap_count(), but that is left for a follow-up commit.  
  
Co-authored-by: Paul Amonson, Ants Aasma  
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley  
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/Makefile.global.in
M src/include/pg_config.h.in
M src/include/port/pg_bitutils.h
M src/makefiles/meson.build
M src/port/Makefile
M src/port/meson.build
M src/port/pg_bitutils.c
A src/port/pg_popcount_avx512.c
A src/port/pg_popcount_avx512_choose.c
M src/test/regress/expected/bit.out
M src/test/regress/sql/bit.sql

Fix if/while thinko in read_stream.c edge case.

commit   : 158f5819236806b7c9cab323658c231e9371c458    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 7 Apr 2024 14:38:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 7 Apr 2024 14:38:20 +1200    

Click here for diff

When we determine that a wanted block can't be combined with the current  
pending read, it's time to start that read to get it out of the way.  An  
"if" in that code path should have been a "while", because it might take  
more than one go in case of partial reads.  This was only broken for  
smaller ranges, as the more common case of io_combine_limit-sized ranges  
is handled earlier in the code and knows how to loop, hiding the bug for  
a while.  
  
Discovered while testing large parallel sequential scans of partially  
cached tables.  The ramp-up-and-down block allocator for parallel scans  
could hit the problem case and skip some blocks near the end that should  
have been streamed.  
  
Defect in commit b5a9b18c.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2Bh8Whpv0YsJqjMVkjYX%2B80fTVc6oi-V%2BzxJvykLpLHYQ%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c

Disable parallel query in psql error-with-FETCH_COUNT test.

commit   : beb012b42f5c32f578661fc1b033ca25905b27d6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 21:49:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 21:49:24 -0400    

Click here for diff

The buildfarm members using debug_parallel_query = regress are mostly  
unhappy with this test.  I guess what is happening is that rows  
generated by a parallel worker are buffered, and might or might not  
get to the leader before the expected error occurs.  We did not see  
any variability in the old version of this test because each FETCH  
would succeed or fail atomically, leading to a predictable number of  
rows emitted before failure.  I don't find this to be a bug, just  
unspecified behavior, so let's disable parallel query for this one  
test case to make the results stable.  

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

Re-implement psql's FETCH_COUNT feature atop libpq's chunked mode.

commit   : 90f5178211cd63ac16fb8c8b2fe43d53d2854da1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 20:45:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 20:45:05 -0400    

Click here for diff

Formerly this was done with a cursor, which is problematic since  
not all result-set-returning query types can be put into a cursor.  
The new implementation is better integrated into other psql  
features, too.  
  
Daniel Vérité, reviewed by Laurenz Albe and myself (and whacked  
around a bit by me, so any remaining bugs are my fault)  
  
Discussion: https://postgr.es/m/CAKZiRmxsVTkO928CM+-ADvsMyePmU3L9DQCa9NwqjvLPcEe5QA@mail.gmail.com  

M src/bin/psql/common.c
M src/bin/psql/t/001_basic.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Support retrieval of results in chunks with libpq.

commit   : 4643a2b265e967cc5f13ffa0c7c6912dbb3466d0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 20:41:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 20:41:32 -0400    

Click here for diff

This patch generalizes libpq's existing single-row mode to allow  
individual partial-result PGresults to contain up to N rows, rather  
than always one row.  This reduces malloc overhead compared to plain  
single-row mode, and it is very useful for psql's FETCH_COUNT feature,  
since otherwise we'd have to add code (and cycles) to either merge  
single-row PGresults into a bigger one or teach psql's  
results-printing logic to accept arrays of PGresults.  
  
To avoid API breakage, PQsetSingleRowMode() remains the same, and we  
add a new function PQsetChunkedRowsMode() to invoke the more general  
case.  Also, PGresults obtained the old way continue to carry the  
PGRES_SINGLE_TUPLE status code, while if PQsetChunkedRowsMode() is  
used then their status code is PGRES_TUPLES_CHUNK.  The underlying  
logic is the same either way, though.  
  
Daniel Vérité, reviewed by Laurenz Albe and myself (and whacked  
around a bit by me, so any remaining bugs are my fault)  
  
Discussion: https://postgr.es/m/CAKZiRmxsVTkO928CM+-ADvsMyePmU3L9DQCa9NwqjvLPcEe5QA@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/singlerow.trace

Change BitmapAdjustPrefetchIterator to accept BlockNumber

commit   : 92641d8d651e685b49a6e2842d306aa5fe7ba500    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 01:25:03 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 01:25:03 +0200    

Click here for diff

BitmapAdjustPrefetchIterator() only used the blockno member of the  
passed in TBMIterateResult to ensure that the prefetch iterator and  
regular iterator stay in sync. Pass it the BlockNumber only, so that we  
can move away from using the TBMIterateResult outside of table AM  
specific code.  
  
Author: Melanie Plageman  
Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas  
Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c

BitmapHeapScan: Use correct recheck flag for skip_fetch

commit   : 1fdb0ce9b10970a4b02f1ef0c269e2c1fbbecd25    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 00:51:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 00:51:00 +0200    

Click here for diff

As of 7c70996ebf0949b142a9, BitmapPrefetch() used the recheck flag for  
the current block to determine whether or not it should skip prefetching  
the proposed prefetch block. As explained in the comment, this assumed  
the index AM will report the same recheck value for the future page as  
it did for the current page - but there's no guarantee.  
  
This only affects prefetching - if the recheck flag changes, we may  
prefetch blocks unecessarily and not prefetch blocks that will be  
needed. But we don't need to rely on that assumption - we know the  
recheck flag for the block we're considering prefetching, so we can  
use that.  
  
The impact is very limited in practice - the opclass would need to  
assign different recheck flags to different blocks, but none of the  
built-in opclasses seems to do that.  
  
Author: Melanie Plageman  
Reviewed-by: Tomas Vondra, Andres Freund, Tom Lane  
Discussion: https://postgr.es/m/1939305.1712415547%40sss.pgh.pa.us  

M src/backend/executor/nodeBitmapHeapscan.c

BitmapHeapScan: Push skip_fetch optimization into table AM

commit   : 04e72ed617be354a53a076b76c6644e364ed80a3    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 00:24:12 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 7 Apr 2024 00:24:12 +0200    

Click here for diff

Commit 7c70996ebf0949b142 introduced an optimization to allow bitmap  
scans to operate like index-only scans by not fetching a block from the  
heap if none of the underlying data is needed and the block is marked  
all visible in the visibility map.  
  
With the introduction of table AMs, a FIXME was added to this code  
indicating that the skip_fetch logic should be pushed into the table  
AM-specific code, as not all table AMs may use a visibility map in the  
same way.  
  
This commit resolves this FIXME for the current block. The layering  
violation is still present in BitmapHeapScans's prefetching code, which  
uses the visibility map to decide whether or not to prefetch a block.  
However, this can be addressed independently.  
  
Author: Melanie Plageman  
Reviewed-by: Andres Freund, Heikki Linnakangas, Tomas Vondra, Mark Dilger  
Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/nodes/execnodes.h

Implement ALTER TABLE ... SPLIT PARTITION ... command

commit   : 87c21bb9412c8ba2727dec5ebcd74d44c2232d11    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:58:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:58:09 +0300    

Click here for diff

This new DDL command splits a single partition into several parititions.  
Just like ALTER TABLE ... MERGE PARTITIONS ... command, new patitions are  
created using createPartitionTable() function with parent partition as the  
template.  
  
This commit comprises quite naive implementation which works in single process  
and holds the ACCESS EXCLUSIVE LOCK on the parent table during all the  
operations including the tuple routing.  This is why this new DDL command  
can't be recommended for large partitioned tables under a high load.  However,  
this implementation come in handy in certain cases even as is.  
Also, it could be used as a foundation for future implementations with lesser  
locking and possibly parallel.  
  
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru  
Author: Dmitry Koval  
Reviewed-by: Matthias van de Meent, Laurenz Albe, Zhihong Yu, Justin Pryzby  
Reviewed-by: Alvaro Herrera, Robert Haas, Stephane Tachoires  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
M src/include/utils/ruleutils.h
A src/test/isolation/expected/partition-split.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-split.spec
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_split.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_split.sql
M src/tools/pgindent/typedefs.list

Implement ALTER TABLE ... MERGE PARTITIONS ... command

commit   : 1adf16b8fba45f77056d91573cd7138ed9da4ebf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:57:22 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:57:22 +0300    

Click here for diff

This new DDL command merges several partitions into the one partition of the  
target table.  The target partition is created using new  
createPartitionTable() function with parent partition as the template.  
  
This commit comprises quite naive implementation which works in single process  
and holds the ACCESS EXCLUSIVE LOCK on the parent table during all the  
operations including the tuple routing.  This is why this new DDL command  
can't be recommended for large partitioned tables under a high load.  However,  
this implementation come in handy in certain cases even as is.  
Also, it could be used as a foundation for future implementations with lesser  
locking and possibly parallel.  
  
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru  
Author: Dmitry Koval  
Reviewed-by: Matthias van de Meent, Laurenz Albe, Zhihong Yu, Justin Pryzby  
Reviewed-by: Alvaro Herrera, Robert Haas, Stephane Tachoires  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
A src/test/isolation/expected/partition-merge.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-merge.spec
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_merge.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_merge.sql
M src/tools/pgindent/typedefs.list

BitmapHeapScan: postpone setting can_skip_fetch

commit   : fe1431e39cdde5f65cb52f068bc86a7490f8a4e3    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 6 Apr 2024 23:56:46 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 6 Apr 2024 23:56:46 +0200    

Click here for diff

Set BitmapHeapScanState->can_skip_fetch in BitmapHeapNext() instead of  
in ExecInitBitmapHeapScan(). This is a preliminary step to pushing the  
skip fetch optimization into heap AM code.  
  
Author: Melanie Plageman  
Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas  
Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c

Call WaitLSNCleanup() in AbortTransaction()

commit   : 74eaf66f988c868deb0816bae4dd184eedae1448    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:32:46 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:32:46 +0300    

Click here for diff

Even though waiting for replay LSN happens without explicit transaction,  
AbortTransaction() is responsible for the cleanup of the shared memory if  
the error is thrown in a stored procedure.  So, we need to do WaitLSNCleanup()  
there to clean up after some unexpected error happened while waiting for  
replay LSN.  
  
Discussion: https://postgr.es/m/202404051815.eri4u5q6oj26%40alvherre.pgsql  
Author: Alvaro Herrera  

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

Clarify what is protected by WaitLSNLock

commit   : ee79928441e7e291532b833455ebfee27d7cab5c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:32:35 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:32:35 +0300    

Click here for diff

Not just WaitLSNState.waitersHeap, but also WaitLSNState.procInfos and  
updating of WaitLSNState.minWaitedLSN is protected by WaitLSNLock.  There  
is one now documented exclusion on fast-path checking of  
WaitLSNProcInfo.inHeap flag.  
  
Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql  

M src/backend/commands/waitlsn.c
M src/include/commands/waitlsn.h

Use an LWLock instead of a spinlock in waitlsn.c

commit   : 25f42429e2ff2acca35c9154fc2e36b75c79227a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:31:43 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Apr 2024 00:31:43 +0300    

Click here for diff

This should prevent busy-waiting when number of waiting processes is high.  
  
Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql  
Author: Alvaro Herrera  

M src/backend/commands/waitlsn.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/commands/waitlsn.h
M src/include/storage/lwlocklist.h

BitmapHeapScan: begin scan after bitmap creation

commit   : 1577081e9614345534a018e788a2c0bab4da4dc5    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 6 Apr 2024 22:57:58 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 6 Apr 2024 22:57:58 +0200    

Click here for diff

Change the order so that the table scan is initialized only after  
initializing the index scan and building the bitmap.  
  
This is mostly a cosmetic change for now, but later commits will need  
to pass parameters to table_beginscan_bm() that are unavailable in  
ExecInitBitmapHeapScan().  
  
Author: Melanie Plageman  
Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas  
Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c

Backport IPC::Run optimization to src/test/perl.

commit   : 06558f49529553aecb6ad52a0470d63cb59d7df9    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 6 Apr 2024 09:27:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 6 Apr 2024 09:27:55 -0700    

Click here for diff

This one-liner makes the TAP portion of "make check-world" 7% faster on  
a non-Windows machine.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Enhance nbtree ScalarArrayOp execution.

commit   : 5bf748b86bc6786a3fc57fc7ce296c37da6564b0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 6 Apr 2024 11:47:10 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 6 Apr 2024 11:47:10 -0400    

Click here for diff

Commit 9e8da0f7 taught nbtree to handle ScalarArrayOpExpr quals  
natively.  This works by pushing down the full context (the array keys)  
to the nbtree index AM, enabling it to execute multiple primitive index  
scans that the planner treats as one continuous index scan/index path.  
This earlier enhancement enabled nbtree ScalarArrayOp index-only scans.  
It also allowed scans with ScalarArrayOp quals to return ordered results  
(with some notable restrictions, described further down).  
  
Take this general approach a lot further: teach nbtree SAOP index scans  
to decide how to execute ScalarArrayOp scans (when and where to start  
the next primitive index scan) based on physical index characteristics.  
This can be far more efficient.  All SAOP scans will now reliably avoid  
duplicative leaf page accesses (just like any other nbtree index scan).  
SAOP scans whose array keys are naturally clustered together now require  
far fewer index descents, since we'll reliably avoid starting a new  
primitive scan just to get to a later offset from the same leaf page.  
  
The scan's arrays now advance using binary searches for the array  
element that best matches the next tuple's attribute value.  Required  
scan key arrays (i.e. arrays from scan keys that can terminate the scan)  
ratchet forward in lockstep with the index scan.  Non-required arrays  
(i.e. arrays from scan keys that can only exclude non-matching tuples)  
"advance" without the process ever rolling over to a higher-order array.  
  
Naturally, only required SAOP scan keys trigger skipping over leaf pages  
(non-required arrays cannot safely end or start primitive index scans).  
Consequently, even index scans of a composite index with a high-order  
inequality scan key (which we'll mark required) and a low-order SAOP  
scan key (which we won't mark required) now avoid repeating leaf page  
accesses -- that benefit isn't limited to simpler equality-only cases.  
In general, all nbtree index scans now output tuples as if they were one  
continuous index scan -- even scans that mix a high-order inequality  
with lower-order SAOP equalities reliably output tuples in index order.  
This allows us to remove a couple of special cases that were applied  
when building index paths with SAOP clauses during planning.  
  
Bugfix commit 807a40c5 taught the planner to avoid generating unsafe  
path keys: path keys on a multicolumn index path, with a SAOP clause on  
any attribute beyond the first/most significant attribute.  These cases  
are now all safe, so we go back to generating path keys without regard  
for the presence of SAOP clauses (just like with any other clause type).  
Affected queries can now exploit scan output order in all the usual ways  
(e.g., certain "ORDER BY ... LIMIT n" queries can now terminate early).  
  
Also undo changes from follow-up bugfix commit a4523c5a, which taught  
the planner to produce alternative index paths, with path keys, but  
without low-order SAOP index quals (filter quals were used instead).  
We'll no longer generate these alternative paths, since they can no  
longer offer any meaningful advantages over standard index qual paths.  
Affected queries thereby avoid all of the disadvantages that come from  
using filter quals within index scan nodes.  They can avoid extra heap  
page accesses from using filter quals to exclude non-matching tuples  
(index quals will never have that problem).  They can also skip over  
irrelevant sections of the index in more cases (though only when nbtree  
determines that starting another primitive scan actually makes sense).  
  
There is a theoretical risk that removing restrictions on SAOP index  
paths from the planner will break compatibility with amcanorder-based  
index AMs maintained as extensions.  Such an index AM could have the  
same limitations around ordered SAOP scans as nbtree had up until now.  
Adding a pro forma incompatibility item about the issue to the Postgres  
17 release notes seems like a good idea.  
  
Author: Peter Geoghegan <[email protected]>  
Author: Matthias van de Meent <[email protected]>  
Reviewed-By: Heikki Linnakangas <[email protected]>  
Reviewed-By: Matthias van de Meent <[email protected]>  
Reviewed-By: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=ksvN_sjcnD1+Bt-WtifRA5ok48aDYnq3pkKhxgMQpcw@mail.gmail.com  

M doc/src/sgml/indexam.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/path/indxpath.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/amapi.h
M src/include/access/genam.h
M src/include/access/nbtree.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/btree_index.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/join.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/select_parallel.sql
M src/tools/pgindent/typedefs.list

Remove obsolete comment in CopyReadLineText().

commit   : ddd9e43a92417dd0c2b60822d6e75862c73b139a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 11:16:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2024 11:16:27 -0400    

Click here for diff

When this bit of commentary was written, it was alluding to the  
fact that we looked for newlines and EOD markers in the raw  
(not yet encoding-converted) input data.  We don't do that anymore,  
preferring to batch the conversion of larger chunks of input and  
split it into lines later.  Hence there's no longer any need for  
assumptions about the relevant characters being encoding-invariant,  
and we should remove this comment saying we assume that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfromparse.c

Speed up tail processing when hashing aligned C strings, take two

commit   : a365d9e2e8c1ead27203a4431211098292777d3b    
  
author   : John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 17:02:43 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 17:02:43 +0700    

Click here for diff

After encountering the NUL terminator, the word-at-a-time loop exits  
and we must hash the remaining bytes. Previously we calculated  
the terminator's position and re-loaded the remaining bytes from  
the input string. This was slower than the unaligned case for very  
short strings. We already have all the data we need in a register,  
so let's just mask off the bytes we need and hash them immediately.  
  
In addition to endianness issues, the previous attempt upset valgrind  
in the way it computed the mask. Whether by accident or by wisdom,  
the author's proposed method passes locally with valgrind 3.22.  
  
Ants Aasma, with cosmetic adjustments by me  
  
Discussion: https://postgr.es/m/CANwKhkP7pCiW_5fAswLhs71-JKGEz1c1%2BPC0a_w1fwY4iGMqUA%40mail.gmail.com  

M src/include/common/hashfn_unstable.h

Teach fasthash_accum to use platform endianness for bytewise loads

commit   : 0c25fee35903ef08af6d6b0c0fdb90fc01e37fa1    
  
author   : John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 16:59:28 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 16:59:28 +0700    

Click here for diff

This function previously used a mix of word-wise loads and bytewise  
loads. The bytewise loads happened to be little-endian regardless of  
platform. This in itself is not a problem. However, a future commit  
will require the same result whether A) the input is loaded as a  
word with the relevent bytes masked-off, or B) the input is loaded  
one byte at a time.  
  
While at it, improve debuggability of the internal hash state.  
  
Discussion: https://postgr.es/m/CANWCAZZpuV1mES1mtSpAq8tWJewbrv4gEz6R_k4gzNG8GZ5gag%40mail.gmail.com  

M src/include/common/hashfn_unstable.h

Increase default vacuum_buffer_usage_limit to 2MB.

commit   : 98f320eb2ef05072b6fe67fcdcdc26c226e6cea4    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 23:00:40 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 23:00:40 +1300    

Click here for diff

The BAS_VACUUM ring size has been 256kB since commit d526575f introduced  
the mechanism 17 years ago.  Commit 1cbbee03 recently made it  
configurable but retained the traditional default.  The correct default  
size has been debated for years, but 256kB is certainly very small.  
VACUUM soon needs to write back data it dirtied only 32 blocks ago,  
which usually requires flushing the WAL.  New experiments in prefetching  
pages for VACUUM exacerbated the problem by crashing into dirty data  
even sooner.  Let's make the default 2MB.  That's 1.6% of the default  
toy buffer pool size, and 0.2% of 1GB, which would be a considered a  
small shared_buffers setting for a real system these days.  Users are  
still free to set the GUC to a different value.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20240403221257.md4gfki3z75cdyf6%40awork3.anarazel.de  
Discussion: https://postgr.es/m/CA%2BhUKGLY4Q4ZY4f1rvnFtv6%2BPkjNf8MejdPkcju3Qii9DYqqcQ%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/storage/buffer/freelist.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample

Allow BufferAccessStrategy to limit pin count.

commit   : 3bd8439ed628c7e9ac250b1a042d9044303c37e7    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 22:58:48 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 22:58:48 +1300    

Click here for diff

While pinning extra buffers to look ahead, users of strategies are in  
danger of using too many buffers.  For some strategies, that means  
"escaping" from the ring, and in others it means forcing dirty data to  
disk very frequently with associated WAL flushing.  Since external code  
has no insight into any of that, allow individual strategy types to  
expose a clamp that should be applied when deciding how many buffers to  
pin at once.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_aJXnqsyZt6HwFLnxYEBgE17oypkxbKbT1t1geE_wvH2Q%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/bufmgr.h

Convert uses of hash_string_pointer to fasthash equivalent

commit   : f956ecd0353b2960f8322b2211142113fe2b6f67    
  
author   : John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:17:07 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:17:07 +0700    

Click here for diff

Remove duplicate hash_string_pointer() function definitions by creating  
a new inline function hash_string() for this purpose.  
  
This has the added advantage of avoiding strlen() calls when doing hash  
lookup. It's not clear how many of these are perfomance-sensitive  
enough to benefit from that, but the simplification is worth it on  
its own.  
  
Reviewed by Jeff Davis  
  
Discussion: https://postgr.es/m/CANWCAZbg_XeSeY0a_PqWmWqeRATvzTzUNYRLeT%2Bbzs%2BYQdC92g%40mail.gmail.com  

M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/include/common/hashfn_unstable.h

Add macro to disable address safety instrumentation

commit   : db17594ad73a871a176a9bf96e0589c2cf57052c    
  
author   : John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:14:38 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:14:38 +0700    

Click here for diff

fasthash_accum_cstring_aligned() uses a technique, found in various  
strlen() implementations, to detect a string's NUL terminator by  
reading a word at at time. That triggers failures when testing with  
"-fsanitize=address", at least with frontend code. To enable using  
this function anywhere, add a function attribute macro to disable  
such testing.  
  
Reviewed by Jeff Davis  
  
Discussion: https://postgr.es/m/CANWCAZbwvp7oUEkbw-xP4L0_S_WNKq-J-ucP4RCNDPJnrakUPw%40mail.gmail.com  

M src/include/c.h
M src/include/common/hashfn_unstable.h

Fix incorrect return type

commit   : 4b968e2027ba46b31be0a648486f86a2cadc707d    
  
author   : John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:02:45 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 6 Apr 2024 12:02:45 +0700    

Click here for diff

fasthash32() calculates a 32-bit hashcode, but the return  
type was uint64. Change to uint32.  
  
Noted by Jeff Davis  
  
Discussion: https://postgr.es/m/b16c93e6c736a422d4de668343515375664eb05d.camel%40j-davis.com  

M src/include/common/hashfn_unstable.h

Improve read_stream.c's fast path.

commit   : aa1e8c206454d666ab600050022aef2c3c390f69    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 17:14:12 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2024 17:14:12 +1300    

Click here for diff

The "fast path" for well cached scans that don't do any I/O was  
accidentally coded in a way that could only be triggered by pg_prewarm's  
usage pattern, which starts out with a higher distance because of the  
flags it passes in.  We want it to work for streaming sequential scans  
too, once that patch is committed.  Adjust.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKXZALJ%3D6aArUsXRJzBm%3Dqvc4AWp7%3DiJNXJQqpbRLnD_w%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c

Fix headerscheck violation introduced in f8ce4ed78ca

commit   : 9e7386924e837aef8d48895cf72a6a0b7f78cbe9    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 5 Apr 2024 14:27:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 5 Apr 2024 14:27:45 -0700    

Click here for diff

Per ci.  

M src/bin/pg_combinebackup/reconstruct.h

Silence some compiler warnings in commit 3311ea86ed

commit   : c3e60f3d7e4268c6448ec592053b3b893899867d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 5 Apr 2024 16:07:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 5 Apr 2024 16:07:52 -0400    

Click here for diff

Per report from Nathan Bossart  

M src/common/jsonapi.c

Fix incorrect calculation in BlockRefTableEntryGetBlocks.

commit   : 55a5ee30cd65886ff0a2e7ffef4ec2816fbec273    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Apr 2024 13:39:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Apr 2024 13:39:29 -0400    

Click here for diff

The previous formula was incorrect in the case where the function's  
nblocks argument was a multiple of BLOCKS_PER_CHUNK, which happens  
whenever a relation segment file is exactly 512MB or exactly 1GB in  
length. In such cases, the formula would calculate a stop_offset of  
0 rather than 65536, resulting in modified blocks in the second half  
of a 1GB file, or all the modified blocks in a 512MB file, being  
omitted from the incremental backup.  
  
Reported off-list by Tomas Vondra and Jakub Wartak.  
  
Discussion: http://postgr.es/m/CA+TgmoYwy_KHp1-5GYNmVa=zdeJWhNH1T0SBmEuvqQNJEHj1Lw@mail.gmail.com  

M src/common/blkreftable.c

Check HAVE_COPY_FILE_RANGE before calling copy_file_range

commit   : 079d94ab3412fdeda637a24b17bde53c576b0007    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 19:38:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 19:38:16 +0200    

Click here for diff

Fix a mistake in ac8110155132 - write_reconstructed_file() called  
copy_file_range() without properly checking HAVE_COPY_FILE_RANGE.  
  
Reported by several macOS machines. Also reported by cfbot, but I missed  
that issue before commit.  

M src/bin/pg_combinebackup/reconstruct.c

Allow using copy_file_range in write_reconstructed_file

commit   : ac81101551326ddf4c5cb804c75bd3e8c56506ba    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 19:01:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 19:01:16 +0200    

Click here for diff

This commit allows using copy_file_range() for efficient combining of  
data from multiple files, instead of simply reading/writing the blocks.  
Depending on the filesystem and other factors (size of the increment,  
distribution of modified blocks etc.) this may be faster than the  
block-by-block copy, but more importantly it enables various features  
provided by CoW filesystems.  
  
If a checksum needs to be calculated for the file, the same strategy as  
when copying whole files is used - copy_file_range is used to copy the  
blocks, but the file is also read for the checksum calculation.  
  
While the checksum calculation is rarely needed when cloning whole  
files, when reconstructing the files from multiple backups it needs to  
happen almost always (the only exception is when the user specified  
--no-manifest).  
  
Author: Tomas Vondra  
Reviewed-by: Thomas Munro, Jakub Wartak, Robert Haas  
Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com  

M src/bin/pg_combinebackup/reconstruct.c

Make libpqsrv_cancel's return const char *, not char *

commit   : b8b37e41ba4aae1e79dcfaeb9eb0fd7549773ff5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2024 18:23:10 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2024 18:23:10 +0200    

Click here for diff

Per headerscheck's C++ check.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove unused variable in checksum_file()

commit   : 8e392595e5619734db707553e8f72dfacf9ab86c    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 18:13:15 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 18:13:15 +0200    

Click here for diff

The 'offset' variable was set but otherwise unused.  
  
Per buildfarm animals with clang, e.g. sifaka and longlin.  

M src/bin/pg_combinebackup/copy_file.c

Allow copying files using clone/copy_file_range

commit   : f8ce4ed78ca6e35bf135545e34bd49cd65d88ea2    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 18:01:26 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 18:01:26 +0200    

Click here for diff

Adds --clone/--copy-file-range options to pg_combinebackup, to allow  
copying files using file cloning or copy_file_range(). These methods may  
be faster than the standard block-by-block copy, but the main advantage  
is that they enable various features provided by CoW filesystems.  
  
This commit only uses these copy methods for files that did not change  
and can be copied as a whole from a single backup.  
  
These new copy methods may not be available on all platforms, in which  
case the command throws an error (immediately, even if no files would be  
copied as a whole). This early failure seems better than failing later  
when trying to copy the first file, after performing a lot of work on  
earlier files.  
  
If the requested copy method is available, but a checksum needs to be  
recalculated (e.g. because of a different checksum type), the file is  
still copied using the requested method, but it is also read for the  
checksum calculation. Depending on the filesystem this may be more  
expensive than just performing the simple copy, but it does enable the  
CoW benefits.  
  
Initial patch by Jakub Wartak, various reworks and improvements by me.  
  
Author: Tomas Vondra, Jakub Wartak  
Reviewed-by: Thomas Munro, Jakub Wartak, Robert Haas  
Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com  

M doc/src/sgml/ref/pg_combinebackup.sgml
M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/copy_file.h
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/reconstruct.h
M src/tools/pgindent/typedefs.list

Suppress "variable may be used uninitialized" warning.

commit   : 3c5ff36aba8a3df19967d0ddc1249c63417bb9b0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2024 10:58:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2024 10:58:30 -0400    

Click here for diff

Buildfarm member caiman is showing this, which surprises me because  
it's very late-model gcc (14.0.1) and ought to be smart enough to  
know that elog(ERROR) doesn't return.  But we're likely to see the  
same from stupider compilers too, so add a dummy initialization in  
our usual style.  

M src/backend/parser/parse_expr.c

docs: Merge separate chapters on built-in index AMs into one.

commit   : fe8eaa54420cbb384bd5ad179495bb9774b6b48f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Mar 2024 11:51:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Mar 2024 11:51:53 -0400    

Click here for diff

The documentation index is getting very long, which makes it hard  
to find things. Since these chapters are all very similar in structure  
and content, merging them is a natural way of reducing the size of  
the toplevel index.  
  
Rather than actually combining all of the SGML into a single file,  
keep one file per <sect1>, and add a glue file that includes all  
of them.  
  
Discussion: http://postgr.es/m/CA+Tgmob7_uoYuS2=rVwpVXaRwP-UXz+++saYTC-BCZ42QzSNKQ@mail.gmail.com  

M doc/src/sgml/brin.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/hash.sgml
A doc/src/sgml/indextypes.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/spgist.sgml

Align blocks in incremental backups to BLCKSZ

commit   : 10e3226ba13d184fc3165138c619eb7f2d52cdd2    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 16:28:21 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Apr 2024 16:28:21 +0200    

Click here for diff

Align blocks stored in incremental files to BLCKSZ, so that the  
incremental backups work well with CoW filesystems.  
  
The header of the incremental file is padded with \0 to a multiple of  
BLCKSZ, so that the block data (also BLCKSZ) is aligned to BLCKSZ. The  
padding is added only to files containing block data, so files with just  
the header remain small. This adds a bit of extra space, but as the  
number of blocks increases the overhead gets negligible very quickly.  
And as the padding is \0 bytes, it does compress extremely well.  
  
The alignment is important for CoW filesystems that usually require the  
blocks to be aligned to filesystem page size for features like block  
sharing, deduplication etc. to work well. With the variable sized header  
the blocks in the increments were not aligned at all, negating the  
benefits of the CoW filesystems.  
  
This matters even for non-CoW filesystems, for example when placed on a  
RAID array. If the block is not aligned, it may easily span multiple  
devices, causing read and write amplification.  
  
It might be better to align the blocks to the filesystem page, not  
BLCKSZ, but we have no good way to determine that. Even if we determine  
the page size at the time of taking the backup, the backup may move. For  
now the BLCKSZ seems sufficient - the filesystem page is usually 4K, so  
the default BLCKSZ (8K by default) is aligned to that.  
  
Author: Tomas Vondra  
Reviewed-by: Robert Haas, Jakub Wartak  
Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com  

M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/reconstruct.c
M src/include/backup/basebackup_incremental.h

Operate XLogCtl->log{Write,Flush}Result with atomics

commit   : ee1cbe806dad47674ded35427c6ba217531847d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2024 16:14:39 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2024 16:14:39 +0200    

Click here for diff

This removes the need to hold both the info_lck spinlock and  
WALWriteLock to update them.  We use stock atomic write instead, with  
WALWriteLock held.  Readers can use atomic read, without any locking.  
  
This allows for some code to be reordered: some places were a bit  
contorted to avoid repeated spinlock acquisition, but that's no longer a  
concern, so we can turn them to more natural coding.  Some further  
changes are possible (maybe to performance wins), but in this commit I  
did rather minimal ones only, to avoid increasing the blast radius.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Jeff Davis <[email protected]>  
Reviewed-by: Andres Freund <[email protected]> (earlier versions)  
Discussion: https://postgr.es/m/[email protected]  

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

Allow synced slots to have their inactive_since.

commit   : 6f132ed693b6a0be0997f092c42abf14878362ac    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 5 Apr 2024 09:48:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 5 Apr 2024 09:48:49 +0530    

Click here for diff

This commit does two things:  
1) Maintains inactive_since for sync slots whenever the slot is released  
just like any other regular slot.  
  
2) Ensures the value is set to the current timestamp during the promotion  
of standby to help correctly interpret the time after promotion. We don't  
want the slots to appear inactive for a long time after promotion if they  
haven't been synchronized recently. This would also avoid the invalidation  
of such slots immediately after promotion if tomorrow we have a feature  
that invalidates slots based on their inactivity time. Whoever acquires  
the slot i.e. makes the slot active will reset it to NULL.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik, Masahiko Sawada  
Discussion: https://postgr.es/m/CAA4eK1KrPGwfZV9LYGidjxHeW+rxJ=E2ThjXvwRGLO=iLNuo=Q@mail.gmail.com  
Discussion: https://postgr.es/m/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl

Add "ABI_compatibility" regions to wait_event_names.txt

commit   : f98dbdeb51d1175c07258cd2bd4b56f560dfc3cf    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Apr 2024 08:56:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Apr 2024 08:56:52 +0900    

Click here for diff

The current design behind the automatic generation of the C code and  
documentation related to wait events introduced in fa88928470b5 does not  
offer a way to attach new wait events without breaking ABI  
compatibility, as all the events are forcibly reordered for each section  
in the input file wait_event_names.txt.  Adding new wait events to  
stable branches is something that has happened in the past, 0b6517a3b79a  
being a recent example of that with VERSION_FILE_SYNC, so we need a way  
to generate any C code for wait events while maintaining compatibility  
on stable branches already released.  
  
This commit solves this issue by adding a new region called  
"ABI_compatibility" (keyword could be updated to something else if  
someone had a better idea) to each section of wait_event_names.txt, so  
as one can add new wait events to stable branches in  
wait_event_names.txt while keeping the code ABI-compatible.  
"ABI_compatibility" has no impact on the documentation generated: all  
the wait events of one section are still alphabetically ordered.  LWLock  
and Lock sections generate their C code elsewhere, so they do not need  
an "ABI_compatibility" region.  
  
For example, let's imagine a wait_event_names.txt like that:  
Section: ClassName - Foo  
FOO_1	"Waiting in Foo 1"  
FOO_2	"Waiting in Foo 2"  
ABI_compatibility:  
NEW_FOO_1	"Waiting in New Foo 1"  
NEW_BAR_1	"Waiting in New Bar 1"  
  
This results in the following enum, where the events in the ABI region  
are listed last with the same ordering as in wait_event_names.txt:  
typedef enum  
{  
    WAIT_EVENT_FOO_1,  
    WAIT_EVENT_FOO_2,  
    WAIT_EVENT_NEW_FOO_1,  
    WAIT_EVENT_NEW_BAR_1  
} WaitEventFoo;  
  
New wait events added in stable branches should be added at the end of  
each ABI_compatibility region, and ABI_compatibility should remain empty  
on HEAD and unreleased stable branches.  
  
This design has been suggested by Noah Misch and me.  
  
Reported-by: Noah Misch  
Author: Bertrand Drouvot  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/wait_event_names.txt

Fix test failures when language environment is not UTF-8.

commit   : e2a235767180941eef8887240ddace1a021f04e3    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 4 Apr 2024 16:10:12 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 4 Apr 2024 16:10:12 -0700    

Click here for diff

For tests that depend on UTF-8 encoding, force LC_COLLATE=C and  
LC_CTYPE=C to avoid an encoding mismatch.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGK-ZqV1njkG_=xcCqXh2fcMkz85FTMnhS2opm4ZerH=xw@mail.gmail.com  

M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/020_createdb.pl

Fix old, misleading comment for PGRES_POLLING_ACTIVE.

commit   : e57fe3824ee7a9cb551ca1cae5aa0394216ef7b8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2024 15:55:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2024 15:55:53 -0400    

Click here for diff

The comment implies that we can eventually remove this, but per  
discussion, we actually don't want to do that ever, in order to  
maintain compatibility.  
  
Jelte Fennema-Nio, reviewed by Tristan Partin  
  
Discussion: http://postgr.es/m/CAGECzQTO72jKed5461W8cytV2Msh_e+WUZjOyX_RUQCbjk4LRA@mail.gmail.com  

M src/interfaces/libpq/libpq-fe.h

Remove reachable call to pg_unreachable().

commit   : 12b964d7815b2f45fa3fc37264d3d1cb8e4562e3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2024 15:52:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2024 15:52:52 -0400    

Click here for diff

The loop just before this uses break, not return, so this line  
is reachable.  Commit cafe1056558fe07cdc52b95205588fcd80870362  
introduced this issue.  
  
Jelte Fennema-Nio, reviewed by Tristan Partin  
  
Discussion: http://postgr.es/m/CAGECzQTO72jKed5461W8cytV2Msh_e+WUZjOyX_RUQCbjk4LRA@mail.gmail.com  

M src/bin/psql/command.c

Fix ecpg's mechanism for detecting unsupported cases in the grammar.

commit   : 096a761d687f1f60dc581f388f8e5b11d648b290    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 15:31:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 15:31:53 -0400    

Click here for diff

ecpg wants to emit a warning if it parses a SQL construct that the  
backend can parse but will immediately throw a FEATURE_NOT_SUPPORTED  
error for.  The way it was testing for this was to see if the string  
ERRCODE_FEATURE_NOT_SUPPORTED appeared anywhere in the gram.y code.  
This is, of course, not nearly good enough, as there are plenty of  
rules in gram.y that throw that error only conditionally.  There was  
a hack dating to 2008 to suppress the warning in one rule that  
doesn't even exist anymore, but nothing for other cases we've created  
since then.  End result was that you could get "unsupported feature  
will be passed to server" warnings while compiling perfectly good SQL  
code in ecpg.  Somehow we'd not heard complaints about this, but  
it was exposed by the recent addition of an ecpg test for a SQL/JSON  
construct.  
  
To fix, suppress the warning if the rule contains any "if" statement.  
Manual comparison of gram.y with the generated preproc.y file shows  
that the warning is now emitted only in rules where it's sensible.  
  
This problem has existed for a long time, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/parse.pl

commit   : 332d406140632d352145443b725a206b73ce2167    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 13:39:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 13:39:12 -0400    

Click here for diff

The link commands in test_json_parser/Makefile were a long way  
shy of a load, as evidenced by buildfarm failures.  Model them  
on pgxs.mk's PROGRAM rule.  (Probably we should have put these  
two test programs in different subdirectories so we could  
actually use the PROGRAM rule.  But I won't question that  
decision today.)  

M src/test/modules/test_json_parser/Makefile

commit   : 2497a669effbbdda3e7be573d850b445d1ab6512    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 13:21:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2024 13:21:25 -0400    

Click here for diff

Add overlooked .gitignore entries.  
  
Fix test_json_parser/Makefile to use the pgxs.mk clean rule  
instead of fighting it.  Suppresses a warning from make,  
at least for me.  

M src/interfaces/ecpg/test/sql/.gitignore
M src/test/modules/test_json_parser/Makefile

Tidy up after incremental JSON parser patch

commit   : 88620824c2a62376e224c4b595b9fe69fb858978    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 4 Apr 2024 12:41:55 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 4 Apr 2024 12:41:55 -0400    

Click here for diff

Remove junk left over from non-vpath builds.  
  
Try to remedy gettext error on some platforms.  

M src/common/jsonapi.c
A src/test/modules/test_json_parser/.gitignore
M src/test/modules/test_json_parser/Makefile

Fix warnings re typedef redefinition in ea7b4e9a2a and 3311ea86ed

commit   : 1b00fe30a67774e55c5fc776096a3c96f1a147d2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 4 Apr 2024 11:27:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 4 Apr 2024 11:27:51 -0400    

Click here for diff

Per gripe from Tom Lane and the buildfarm  

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

Add missing initialization in transformJsonFuncExpr()

commit   : 6f4d63e989ffbdb44f5856a17fae5ae68c40327d    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 22:01:13 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 22:01:13 +0900    

Click here for diff

de3600452b added some code for the new JSON_TABLE_OP to that function  
but missed to initialize the default_format variable.  
  
Reported-by: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_expr.c

Fix typo introduced in 6185c9737

commit   : 2f6e78b0619a0ee2ca170e0073659581847ee73d    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 20:53:23 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 20:53:23 +0900    

Click here for diff

Reported-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxGHiU0p0usjh5hnR0_ByZn4tq1FC3eKAtrQgJeKU6W9kw@mail.gmail.com  

M src/backend/parser/parse_expr.c

Add basic JSON_TABLE() functionality

commit   : de3600452b61d1bc3967e9e37e86db8956c8f577    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 19:57:08 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 4 Apr 2024 19:57:08 +0900    

Click here for diff

JSON_TABLE() allows JSON data to be converted into a relational view  
and thus used, for example, in a FROM clause, like other tabular  
data.  Data to show in the view is selected from a source JSON object  
using a JSON path expression to get a sequence of JSON objects that's  
called a "row pattern", which becomes the source to compute the  
SQL/JSON values that populate the view's output columns.  Column  
values themselves are computed using JSON path expressions applied to  
each of the JSON objects comprising the "row pattern", for which the  
SQL/JSON query functions added in 6185c9737cf4 are used.  
  
To implement JSON_TABLE() as a table function, this augments the  
TableFunc and TableFuncScanState nodes that are currently used to  
support XMLTABLE() with some JSON_TABLE()-specific fields.  
  
Note that the JSON_TABLE() spec includes NESTED COLUMNS and PLAN  
clauses, which are required to provide more flexibility to extract  
data out of nested JSON objects, but they are not implemented here  
to keep this commit of manageable size.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Jian He <[email protected]>  
  
Reviewers have included (in no particular order):  
  
Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup,  
Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson,  
Justin Pryzby, Álvaro Herrera, Jian He  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/commands/explain.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/meson.build
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
A src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.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/jsonpath.h
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.c
A src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.stderr
A src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.stdout
M src/interfaces/ecpg/test/sql/Makefile
M src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/sql/sqljson_jsontable.pgc
A src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/sqljson_jsontable.sql
M src/tools/pgindent/typedefs.list

pg_upgrade: Fix typo in message

commit   : a9d6c3868451a494641b498a15f9ee1c151949a7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2024 12:57:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2024 12:57:59 +0200    

Click here for diff

M src/bin/pg_upgrade/check.c

Use incremental parsing of backup manifests.

commit   : 222e11a10ae9840929cff617c01cc6f8f695536f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2024 02:31:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2024 02:31:51 -0400    

Click here for diff

This changes the three callers to json_parse_manifest() to use  
json_parse_manifest_incremental_chunk() if appropriate. In the case of  
the backend caller, since we don't know the size of the manifest in  
advance we always call the incremental parser.  
  
Author: Andrew Dunstan  
Reviewed-By: Jacob Champion  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_verifybackup/pg_verifybackup.c

Add support for incrementally parsing backup manifests

commit   : ea7b4e9a2a7c23c62278d9a3e0c77310778f62b2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Mar 2024 23:12:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Mar 2024 23:12:19 -0400    

Click here for diff

This adds the infrastructure for using the new non-recursive JSON parser  
in processing manifests. It's important that callers make sure that the  
last piece of json handed to the incremental manifest parser contains  
the entire last few lines of the manifest, including the checksum.  
  
Author: Andrew Dunstan  
Reviewed-By: Jacob Champion  
  
Discussion: https://postgr.es/m/[email protected]  

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

Introduce a non-recursive JSON parser

commit   : 3311ea86edc7a689614bad754e17371865cdc11f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Mar 2024 23:10:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Mar 2024 23:10:14 -0400    

Click here for diff

This parser uses an explicit prediction stack, unlike the present  
recursive descent parser where the parser state is represented on the  
call stack. This difference makes the new parser suitable for use in  
incremental parsing of huge JSON documents that cannot be conveniently  
handled piece-wise by the recursive descent parser. One potential use  
for this will be in parsing large backup manifests associated with  
incremental backups.  
  
Because this parser is somewhat slower than the recursive descent  
parser, it  is not replacing that parser, but is an additional parser  
available to callers.  
  
For testing purposes, if the build is done with -DFORCE_JSON_PSTACK, all  
JSON parsing is done with the non-recursive parser, in which case only  
trivial regression differences in error messages should be observed.  
  
Author: Andrew Dunstan  
Reviewed-By: Jacob Champion  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/jsonapi.c
M src/include/common/jsonapi.h
M src/include/pg_config_manual.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_json_parser/Makefile
A src/test/modules/test_json_parser/README
A src/test/modules/test_json_parser/meson.build
A src/test/modules/test_json_parser/t/001_test_json_parser_incremental.pl
A src/test/modules/test_json_parser/t/002_inline.pl
A src/test/modules/test_json_parser/t/003_test_semantic.pl
A src/test/modules/test_json_parser/test_json_parser_incremental.c
A src/test/modules/test_json_parser/test_json_parser_perf.c
A src/test/modules/test_json_parser/tiny.json
A src/test/modules/test_json_parser/tiny.out
M src/tools/pgindent/typedefs.list

Silence meson warning

commit   : 585df02b445f63167f145685e045e5b6074a5a30    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2024 11:22:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2024 11:22:07 +0200    

Click here for diff

Commit 619bc23a1a introduced  
  
    WARNING: Project targets '>=0.54' but uses feature introduced in '0.55.0': Passing executable/found program object to script parameter of add_dist_script  
  
Work around that by wrapping the offending line in a meson version check.  
  
Author: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/D096Q3NFFVH1.1T5RE4MOO9ZFH%40neon.tech  

M meson.build

postgres_fdw: Remove useless ternary expression.

commit   : dd24098cd6fdd599dcee0cd379bb8bdb0c3710a4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 4 Apr 2024 17:55:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 4 Apr 2024 17:55:00 +0900    

Click here for diff

There is no case where we would call pgfdw_exec_cleanup_query or  
pgfdw_exec_cleanup_query_{begin,end} with a NULL query string, so this  
expression is pointless; remove it and instead add to the latter  
functions an assertion ensuring the given query string is not NULL.  
  
Thinko in commit 815d61fcd.  
  
Discussion: https://postgr.es/m/CAPmGK14mm%2B%3DUjyjoWj_Hu7c%2BQqX-058RFfF%2BqOkcMZ_Nj52v-A%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Secondary refactor of heap scanning functions

commit   : 3a4a3537a999932642ba7a459900fe3c4f5cad02    
  
author   : David Rowley <[email protected]>    
date     : Thu, 4 Apr 2024 19:22:45 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 4 Apr 2024 19:22:45 +1300    

Click here for diff

Similar to 44086b097, refactor heap scanning functions to be more  
suitable for the read stream API.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_YtXJiYKQvb5JsA2SkwrsizYLugs4sSOZh3EAjKUg=gEQ@mail.gmail.com  

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

Coordinate emit_log_hook and all log destinations to share the same timeval

commit   : 2a217c371799ae3ecd8d32a137cea874fad7f5dc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2024 14:15:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2024 14:15:22 +0900    

Click here for diff

This would cause the timestamp values used by emit_log_hook and all the  
other log destinations to differ, because the timestamps are reset  
before sending the logs to the server and after calling the hook.  
  
This change matters for emit_log_hook when generating log information  
with 'n' or 'm' in log_line_prefix through log_status_format(), or when  
doing direct calls to get_formatted_log_time() like in the JSON or CSV  
log formats.  
  
While on it, this commit fixes a couple of comments related to the  
formatted timestamps where the JSON was not mentioned.  Oversight in  
dc686681e079, that I have noticed while reviewing this patch.  
  
Author: Kambam Vinay, Michael Paquier  
Discussion: https://postgr.es/m/CANiRfmsK36A0i8mnQtzaxhSm3CUCimPwJPp4WQNq53OdSNkgWg@mail.gmail.com  

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

Preliminary refactor of heap scanning functions

commit   : 44086b097537a8157ee1dd98d6635b3503f2f534    
  
author   : David Rowley <[email protected]>    
date     : Thu, 4 Apr 2024 16:41:13 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 4 Apr 2024 16:41:13 +1300    

Click here for diff

To allow the use of the read stream API added in b5a9b18cd for  
sequential scans on heap tables, here we make some adjustments to make  
that change less invasive and perhaps make the code easier to follow in  
the process.  
  
Here heapgetpage() gets broken into two functions:  
  
1) The part which reads the block has now been moved into a function  
   named heapfetchbuf().  
2) The part which performed pruning and populated the scan's  
   rs_vistuples[] array is now moved into a new function named  
   heap_prepare_pagescan().  
  
The functionality provided by heap_prepare_pagescan() was only ever  
required by SO_ALLOW_PAGEMODE scans, so the branching that was  
previously done in heapgetpage() is no longer needed as we simply just  
don't call heap_prepare_pagescan() from heapgettup() in the refactored  
code.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_YtXJiYKQvb5JsA2SkwrsizYLugs4sSOZh3EAjKUg=gEQ@mail.gmail.com  

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

pg_regress: Save errno in emit_tap_output_v() and switch to %m

commit   : 85230a247c74b92d9676abdf6693ac9d56c373cf    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2024 11:33:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2024 11:33:07 +0900    

Click here for diff

emit_tap_output_v() includes some fprintf() calls for some output  
related to the TAP protocol, that may clobber errno and break %m.  This  
commit makes the logging of pg_regress smarter by saving errno before  
restoring it in vfprintf() where the input strings are used, removing  
the need for strerror().  All logs are switched to %m rather than  
strerror(), shaving some code.  
  
This was not a problem until now as pg_regress.c did not use %m, but the  
change is simple enough that we have no reason to not support this  
placeholder, and that will avoid future mistakes if new logs that  
include %m are added.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Peter Eisentraunt, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

CREATE INDEX: do not update stats during binary upgrade.

commit   : 71b66171d045878cb9267a268a3bf8ce4f11f333    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 3 Apr 2024 16:12:45 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 3 Apr 2024 16:12:45 -0700    

Click here for diff

During binary upgrade, indexes are created before the data is moved  
into place, so it will always be zero.  
  
This is not currently a major problem, but will be when we try to  
preserve statistics during upgrade.  
  
Author: Corey Huinker  
Discussion: https://postgr.es/m/CADkLM=daPdFB8V0tgFxK-dLowFsAEzWRWJHyxij7BG3kBjcouA@mail.gmail.com  

M src/backend/catalog/index.c

Invent SERIALIZE option for EXPLAIN.

commit   : 06286709ee0637ec7376329a5aa026b7682dcfe2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2024 17:41:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2024 17:41:54 -0400    

Click here for diff

EXPLAIN (ANALYZE, SERIALIZE) allows collection of statistics about  
the volume of data emitted by a query, as well as the time taken  
to convert the data to the on-the-wire format.  Previously there  
was no way to investigate this without actually sending the data  
to the client, in which case network transmission costs might  
swamp what you wanted to see.  In particular this feature allows  
investigating the costs of de-TOASTing compressed or out-of-line  
data during formatting.  
  
Stepan Rutz and Matthias van de Meent,  
reviewed by Tomas Vondra and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/explain.sgml
M src/backend/access/common/printtup.c
M src/backend/commands/explain.c
M src/backend/tcop/dest.c
M src/include/commands/explain.h
M src/include/tcop/dest.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql
M src/tools/pgindent/typedefs.list

Fix the parameters order for TableAmRoutine.relation_copy_for_cluster()

commit   : 97ce821e3e171ce99fa7c398889ac08432cd0264    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 21:29:18 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 21:29:18 +0300    

Click here for diff

Specify OldTable first, NewTable second as used by  
table_relation_copy_for_cluster() and as implemented in  
heapam_relation_copy_for_cluster().  
  
Backpatch to PostgreSQL 12, where TableAmRoutine was introduced.  
  
Discussion: https://postgr.es/m/ME3P282MB3166860D4911AE82F92DF7C5B63F2%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM  
Author: Japin Li  
Reviewed-by: Pavel Borisov  
Backpatch-through: 12  

M src/include/access/tableam.h

docs: Demote "Monitoring Disk Usage" from chapter to section.

commit   : f470b5c67924f791228e464b9c02cc1e53ef2906    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Apr 2024 16:09:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Apr 2024 16:09:41 -0400    

Click here for diff

This chapter is very short, and the immediately preceding chapter is  
called "Monitoring Database Activity". So, instead of having a  
separate chapter for this, make it the last section of the preceding  
chapter instead.  
  
Discussion: http://postgr.es/m/CA+Tgmob7_uoYuS2=rVwpVXaRwP-UXz+++saYTC-BCZ42QzSNKQ@mail.gmail.com  

D doc/src/sgml/diskusage.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres.sgml

Split XLogCtl->LogwrtResult into separate struct members

commit   : c9920a9068eac2e6c8fb34988d18c0b42b9bf811    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2024 19:55:11 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2024 19:55:11 +0200    

Click here for diff

After this change we have XLogCtl->logWriteResult and ->logFlushResult.  
There's no functional change, other than the fact that the assignment  
from shared memory to local is no longer done via struct assignment, but  
instead using a macro that copies each member separately.  
  
The current representation is inconvenient going forward; notably, we  
would like to add a new member "Copy" (to keep track of the last  
position copied into WAL buffers), so the symmetry between the values in  
shared memory vs. those in local would be lost.  
  
This also gives us freedom to later change the concurrency model for the  
values in shared memory: we can make them use atomics instead of relying  
on the info_lck spinlock.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Inline pg_popcount() for small buffers.

commit   : deb1486c7d36e5430b50b63e8c0f2d8405e24a2a    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 3 Apr 2024 12:22:02 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 3 Apr 2024 12:22:02 -0500    

Click here for diff

If there aren't many bytes to process, the function call overhead  
of the optimized implementation isn't worth taking, so instead we  
inline a loop that consults pg_number_of_ones in that case.  If  
there are many bytes to process, we accept the function call  
overhead because the optimized versions are likely to be faster.  
The threshold at which we use the optimized implementation is set  
to the smallest amount of data required to use special popcount  
instructions.  
  
Reviewed-by: Alvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/20240402155301.GA2750455%40nathanxps13  

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

Combine freezing and pruning steps in VACUUM

commit   : 6dbb490261a6170a3fc3e326c6983ad63e795047    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2024 19:32:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2024 19:32:28 +0300    

Click here for diff

Execute both freezing and pruning of tuples in the same  
heap_page_prune() function, now called heap_page_prune_and_freeze(),  
and emit a single WAL record containing all changes. That reduces the  
overall amount of WAL generated.  
  
This moves the freezing logic from vacuumlazy.c to the  
heap_page_prune_and_freeze() function. The main difference in the  
coding is that in vacuumlazy.c, we looked at the tuples after the  
pruning had already happened, but in heap_page_prune_and_freeze() we  
operate on the tuples before pruning. The heap_prepare_freeze_tuple()  
function is now invoked after we have determined that a tuple is not  
going to be pruned away.  
  
VACUUM no longer needs to loop through the items on the page after  
pruning. heap_page_prune_and_freeze() does all the work. It now  
returns the list of dead offsets, including existing LP_DEAD items, to  
the caller. Similarly it's now responsible for tracking 'all_visible',  
'all_frozen', and 'hastup' on the caller's behalf.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/storage/ipc/procarray.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list

Refactor how heap_prune_chain() updates prunable_xid

commit   : 26d138f64474394cf1e573384e8f38efa637b674    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2024 19:32:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2024 19:32:21 +0300    

Click here for diff

In preparation of freezing and counting tuples which are not  
candidates for pruning, split heap_prune_record_unchanged() into  
multiple functions, depending the kind of line pointer. That's not too  
interesting right now, but makes the next commit smaller.  
  
Recording the lowest soon-to-be prunable xid is one of the actions we  
take for unchanged LP_NORMAL item pointers but not for others, so move  
that to the new heap_prune_record_unchanged_lp_normal() function. The  
next commit will add more actions to these functions.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov  

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

Fix zeroing of pg_serial page without SLRU bank lock

commit   : be2f0731006300876b008fd78a265471984cbcd9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2024 17:49:44 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2024 17:49:44 +0200    

Click here for diff

Bug in commit 53c2a97a9266: we failed to acquire the correct SLRU bank  
lock when iterating to zero-out intermediate pages in predicate.c.  
Rewrite the code block so that we follow the locking protocol correctly.  
  
Also update an outdated comment in the same file -- SerialSLRULock  
exists no more.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Dilip Kumar <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Use the pairing heap instead of a flat array for LSN replay waiters

commit   : bf1e65080629e2b0ac47ffe245576da96eff8420    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 18:15:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 18:15:17 +0300    

Click here for diff

06c418e163 introduced pg_wal_replay_wait() procedure allowing to wait for  
the particular LSN to be replayed on standby.  The waiters were stored in  
the flat array.  Even though scanning small arrays is fast, that might be a  
problem at scale (a lot of waiting processes).  
  
This commit replaces the flat shared memory array with the pairing heap,  
which holds the waiter with the least LSN at the top.  This gives us O(log N)  
complexity for both inserting and removing waiters.  
  
Reported-by: Alvaro Herrera  
Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql  

M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/waitlsn.c
M src/backend/lib/pairingheap.c
M src/include/commands/waitlsn.h
M src/include/lib/pairingheap.h

Drop global objects after completed test

commit   : 936e3fa3787a51397280c1081587586e83c20399    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 13:33:25 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 13:33:25 +0200    

Click here for diff

Project policy is to not leave global objects behind after a regress  
test run.  This was found as a result of the development of a patch  
to make pg_regress detect such leftovers automatically, which in the  
end was withdrawn due to issues with parallel runs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_pg_dump/expected/test_pg_dump.out
M src/test/modules/test_pg_dump/sql/test_pg_dump.sql

Ensure that the sync slots reach a consistent state after promotion without losing data.

commit   : 2ec005b4e29740f0d36e6646d149af192328b2ff    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 3 Apr 2024 14:04:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 3 Apr 2024 14:04:59 +0530    

Click here for diff

We were directly copying the LSN locations while syncing the slots on the  
standby. Now, it is possible that at some particular restart_lsn there are  
some running xacts, which means if we start reading the WAL from that  
location after promotion, we won't reach a consistent snapshot state at  
that point. However, on the primary, we would have already been in a  
consistent snapshot state at that restart_lsn so we would have just  
serialized the existing snapshot.  
  
To avoid this problem we will use the advance_slot functionality unless  
the snapshot already exists at the synced restart_lsn location. This will  
help us to ensure that snapbuilder/slot statuses are updated properly  
without generating any changes. Note that the synced slot will remain as  
RS_TEMPORARY till the decoding from corresponding restart_lsn can reach a  
consistent snapshot state after which they will be marked as  
RS_PERSISTENT.  
  
Per buildfarm  
  
Author: Hou Zhijie  
Reviewed-by: Bertrand Drouvot, Shveta Malik, Bharath Rupireddy, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716B3942AE49F3F725ACA92943B2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slotfuncs.c
M src/include/replication/logical.h
M src/include/replication/snapbuild.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl

Minor improvements for waitlsn.c

commit   : e37662f22158c29bc55eda4eda1757f444cf701a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 11:23:21 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 11:23:21 +0300    

Click here for diff

 * Remove extra includes  
 * Fill 'cur' in addLSNWaiter() before taking the spinlock  
 * Initialize 'endtime' with zero in WaitForLSN() to avoid compiler warning  
  
Reported-by: Alvaro Herrera, Masahiko Sawada, Daniel Gustafsson  
Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql  
Discussion: https://postgr.es/m/CAD21AoAx7irptnPH1OkkkNh9E0M6X-phfX7sYZfwoMsc1qV1sQ%40mail.gmail.com  

M src/backend/commands/waitlsn.c

Fix indentation from cafe1056558f

commit   : 9301308bd196f614696e0e9492cf0c52f7857f83    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 09:44:47 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 09:44:47 +0200    

Click here for diff

Per buildfarm animal koel  

M src/bin/psql/command.c

Add error codes to some PANIC/FATAL errors reports

commit   : 226261f387fd8b44420ad03298ef09d83571f9b1    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 09:19:25 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 3 Apr 2024 09:19:25 +0200    

Click here for diff

This adds errcodes to a set of PANIC and FATAL errors in xlog.c  
and relcache.c,  which previously had no errcode at all set, in  
order to make fleetwide analysis of errorlogs easier. There are  
many more ereport/elogs left which could benefit from having an  
errcode but this at least makes a dent in the issue.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/CAN55FZ1k8LgLEqncPGmz_fWnrobV6bjABOTH4tOWta6xNcPQig@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/utils/cache/relcache.c

Add built-in ERROR handling for archive callbacks.

commit   : c627d944e6c2620fb3b28f2e4b27e19212f84045    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 22:28:11 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 22:28:11 -0500    

Click here for diff

Presently, the archiver process restarts when an archive callback  
ERRORs.  To avoid this, archive module authors can use sigsetjmp(),  
manage a memory context, etc., but that requires a lot of extra  
code that will likely look roughly the same between modules.  This  
commit adds basic archive callback ERROR handling to pgarch.c so  
that module authors won't ordinarily need to worry about this.  
While this built-in handler attempts to clean up anything that an  
archive module could conceivably have left behind, it is possible  
that some modules are doing unexpected things that require  
additional cleanup.  Module authors should be sure to do any extra  
required cleanup in a PG_CATCH block within the archiving callback.  
  
The archiving callback is now called in a short-lived memory  
context that the archiver process resets between invocations.  If a  
module requires longer-lived storage, it must maintain its own  
memory context.  
  
Thanks to these changes, the basic_archive module can be greatly  
simplified.  
  
Suggested-by: Andres Freund  
Reviewed-by: Andres Freund, Yong Li  
Discussion: https://postgr.es/m/20230217215624.GA3131134%40nathanxps13  

M contrib/basic_archive/basic_archive.c
M doc/src/sgml/archive-modules.sgml
M src/backend/archive/shell_archive.c
M src/backend/postmaster/pgarch.c

Improve eviction algorithm in ReorderBuffer using max-heap for many subtransactions.

commit   : 5bec1d6bc5e3ee44a229228a2749567eb2ab7beb    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 11:40:42 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 11:40:42 +0900    

Click here for diff

Previously, when selecting the transaction to evict during logical  
decoding, we check all transactions to find the largest  
transaction. This could lead to a significant replication lag  
especially in the case where there are many subtransactions.  
  
This commit improves the eviction algorithm in ReorderBuffer using the  
max-heap with transaction size as the key to efficiently find the  
largest transaction.  
  
The max-heap starts with empty. While the max-heap is empty, we don't  
do anything for the max-heap when updating the memory  
counter. Therefore, we get the largest transaction in O(N) time, where  
N is the number of transactions including top-level transactions and  
subtransactions.  
  
We build the max-heap just before selecting the largest transactions  
if the number of transactions being decoded is higher than the  
threshold, MAX_HEAP_TXN_COUNT_THRESHOLD. After building the max-heap,  
we also update the max-heap when updating the memory counter. The  
intention is to efficiently find the largest transaction in O(1) time  
instead of incurring the cost of memory counter updates (O(log  
N)). Once the number of transactions got lower than the threshold, we  
reset the max-heap.  
  
The performance benchmark results showed significant speed up (more  
than x30 speed up on my machine) in decoding a transaction with 100k  
subtransactions, whereas there is no visible overhead in other cases.  
  
Reviewed-by: Amit Kapila, Hayato Kuroda, Vignesh C, Ajin Cherian,  
Tomas Vondra, Shubham Khanna, Peter Smith, Álvaro Herrera,  
Euler Taveira  
Discussion: https://postgr.es/m/CAD21AoAfKTgrBrLq96GcTv9d6k97zaQcDM-rxfKEt4GSe0qnaQ%40mail.gmail.com  

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

Don't adjust ressortgroupref in generate_setop_child_grouplist()

commit   : 7487044d6ccf183e53d2633024595779922dbee2    
  
author   : David Rowley <[email protected]>    
date     : Wed, 3 Apr 2024 15:39:29 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 3 Apr 2024 15:39:29 +1300    

Click here for diff

This is already done inside assignSortGroupRef(), therefore is  
redundant.  
  
Oversight from 66c0185a3.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Add functions to binaryheap for efficient key removal and update.

commit   : b840508644151232b6ca1287dde617ed00ba2bdf    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 10:44:21 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 10:44:21 +0900    

Click here for diff

Previously, binaryheap didn't support updating a key and removing a  
node in an efficient way. For example, in order to remove a node from  
the binaryheap, the caller had to pass the node's position within the  
array that the binaryheap internally has. Removing a node from the  
binaryheap is done in O(log n) but searching for the key's position is  
done in O(n).  
  
This commit adds a hash table to binaryheap in order to track the  
position of each nodes in the binaryheap. That way, by using newly  
added functions such as binaryheap_update_up() etc., both updating a  
key and removing a node can be done in O(1) on an average and O(log n)  
in worst case. This is known as the indexed binary heap. The caller  
can specify to use the indexed binaryheap by passing indexed = true.  
  
The current code does not use the new indexing logic, but it will be  
used by an upcoming patch.  
  
Reviewed-by: Vignesh C, Peter Smith, Hayato Kuroda, Ajin Cherian,  
Tomas Vondra, Shubham Khanna  
Discussion: https://postgr.es/m/CAD21AoDffo37RC-eUuyHJKVEr017V2YYDLyn1xF_00ofptWbkg%40mail.gmail.com  

M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump_sort.c
M src/common/binaryheap.c
M src/include/lib/binaryheap.h
M src/tools/pgindent/typedefs.list

Make binaryheap enlargeable.

commit   : bcb14f4abca0c309f908b3f0cd64378785c99795    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 10:27:43 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 3 Apr 2024 10:27:43 +0900    

Click here for diff

The node array space of the binaryheap is doubled when there is no  
available space.  
  
Reviewed-by: Vignesh C, Peter Smith, Hayato Kuroda, Ajin Cherian,  
Tomas Vondra, Shubham Khanna  
Discussion: https://postgr.es/m/CAD21AoDffo37RC-eUuyHJKVEr017V2YYDLyn1xF_00ofptWbkg%40mail.gmail.com  

M src/common/binaryheap.c
M src/include/lib/binaryheap.h

Move WaitLSNShmemInit() to CreateOrAttachShmemStructs()

commit   : 2c91e13013414cf77bb8026a19a926e08f4e9e7a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 02:55:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 3 Apr 2024 02:55:03 +0300    

Click here for diff

Thanks to Andres Freund, Thomas Munrom and David Rowley for investigating  
this issue.  
  
Discussion: https://postgr.es/m/CAPpHfdvap5mMLikt8CUjA0osAvCJHT0qnYeR3f84EJ_Kvse0mg%40mail.gmail.com  

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

Don't zero tuple_fraction when planning UNIONs with ORDER BYs

commit   : 3b1a7eb28930e9835cda5e42256b7ccc2d044d41    
  
author   : David Rowley <[email protected]>    
date     : Wed, 3 Apr 2024 11:40:33 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 3 Apr 2024 11:40:33 +1300    

Click here for diff

Since 66c0185a3, the planner is able to use Merge Append -> Unique to  
implement UNION queries and each subquery is prompted to produce Paths  
correctly sorted by the UNION's targetlist.  
  
Here we remove some now redundant code which was zeroing the  
tuple_fraction at the parent level.  This will allow the planner to  
consider cheap startup paths when planning the UNION's subqueries.  
  
EXCEPT and INTERSECT set operations still have the tuple_fraction zeroed  
in generate_nonunion_paths().  These operations currently always read  
all of their subqueries' tuples.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Implement pg_wal_replay_wait() stored procedure

commit   : 06c418e163e913966e17cb2d3fb1c5f8a8d58308    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 2 Apr 2024 22:48:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 2 Apr 2024 22:48:03 +0300    

Click here for diff

pg_wal_replay_wait() is to be used on standby and specifies waiting for  
the specific WAL location to be replayed before starting the transaction.  
This option is useful when the user makes some data changes on primary and  
needs a guarantee to see these changes on standby.  
  
The queue of waiters is stored in the shared memory array sorted by LSN.  
During replay of WAL waiters whose LSNs are already replayed are deleted from  
the shared memory array and woken up by setting of their latches.  
  
pg_wal_replay_wait() needs to wait without any snapshot held.  Otherwise,  
the snapshot could prevent the replay of WAL records implying a kind of  
self-deadlock.  This is why it is only possible to implement  
pg_wal_replay_wait() as a procedure working in a non-atomic context,  
not a function.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/eb12f9b03851bb2583adab5df9579b4b%40postgrespro.ru  
Author: Kartyshov Ivan, Alexander Korotkov  
Reviewed-by: Michael Paquier, Peter Eisentraut, Dilip Kumar, Amit Kapila  
Reviewed-by: Alexander Lakhin, Bharath Rupireddy, Euler Taveira  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/system_functions.sql
M src/backend/commands/Makefile
M src/backend/commands/meson.build
A src/backend/commands/waitlsn.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
A src/include/commands/waitlsn.h
M src/test/recovery/meson.build
A src/test/recovery/t/043_wal_replay_wait.pl
M src/tools/pgindent/typedefs.list

Avoid deadlock during orphan temp table removal.

commit   : 6faca9ae2878c8f642a2e5748d2dbb2b91341bec    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Apr 2024 14:59:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Apr 2024 14:59:04 -0400    

Click here for diff

If temp tables have dependencies (such as sequences) then it's  
possible for autovacuum's cleanup of orphan temp tables to deadlock  
against an incoming backend that's trying to clean out the temp  
namespace for its own use.  That can happen because RemoveTempRelations'  
performDeletion call can visit objects within the namespace in  
an order different from the order in which a per-table deletion  
will visit them.  
  
To fix, observe that performDeletion will begin by taking an exclusive  
lock on the temp namespace (even though it won't actually delete it).  
So, if we can get a shared lock on the namespace, we can be sure we're  
not running concurrently with RemoveTempRelations, while also not  
conflicting with ordinary use of the namespace.  This requires  
introducing a conditional version of LockDatabaseObject, but that's no  
big deal.  (It's surprising we've got along without that this long.)  
  
Report and patch by Mikhail Zhilin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c
M src/backend/storage/lmgr/lmgr.c
M src/include/storage/lmgr.h

Avoid function call overhead of pg_popcount() in syslogger.c.

commit   : 4133c1f45c54f0e52b4bb758f67af78951930e43    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 10:32:49 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 10:32:49 -0500    

Click here for diff

Instead of calling the pg_popcount() function for a single byte, we  
can look up the value in the pg_number_of_ones array.  
  
Discussion: https://postgr.es/m/20240401221117.GB2362108%40nathanxps13  

M src/backend/postmaster/syslogger.c

Refactor code for setting pg_popcount* function pointers.

commit   : 6687430c98f3bed1d4c5f85f05a230b0d4581a66    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 10:16:00 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 2 Apr 2024 10:16:00 -0500    

Click here for diff

Presently, there are three copies of this code, and a proposed  
follow-up patch would add more code to each copy.  This commit  
introduces a new inline function for this code and makes use of it  
in the pg_popcount*_choose functions, thereby reducing code  
duplication.  
  
Author: Paul Amonson  
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com  

M src/port/pg_bitutils.c

Unwind #if spaghetti in hmac_openssl.c a bit.

commit   : 38698dd38e56b6de31545ac284e36feb00d413cb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Apr 2024 10:41:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Apr 2024 10:41:37 -0400    

Click here for diff

Make this code a little less confusing by defining a separate macro  
that controls whether we'll use ResourceOwner facilities to track  
the existence of a pg_hmac_ctx context.  
  
The proximate reason to touch this is that since b8bff07da, we got  
"unused function" warnings if building with older OpenSSL, because  
the #if guards around the ResourceOwner wrapper function definitions  
were different from those around the calls of those functions.  
Pulling the ResourceOwner machinations outside of the #ifdef HAVE_xxx  
guards fixes that and makes the code clearer too.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/hmac_openssl.c

Allow SIGINT to cancel psql database reconnections.

commit   : cafe1056558fe07cdc52b95205588fcd80870362    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Apr 2024 10:26:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Apr 2024 10:26:10 -0400    

Click here for diff

After installing the SIGINT handler in psql, SIGINT can no longer cancel  
database reconnections. For instance, if the user starts a reconnection  
and then needs to do some form of interaction (ie psql is polling),  
there is no way to cancel the reconnection process currently.  
  
Use PQconnectStartParams() in order to insert a cancel_pressed check  
into the polling loop.  
  
Tristan Partin, reviewed by Gurjeet Singh, Heikki Linnakangas, Jelte  
Fennema-Nio, and me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Expose PQsocketPoll via libpq

commit   : f5e4dedfa81f00de93b1b90d06c44cc50e052eaf    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Apr 2024 10:15:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Apr 2024 10:15:56 -0400    

Click here for diff

This is useful when connecting to a database asynchronously via  
PQconnectStart(), since it handles deciding between poll() and  
select(), and some of the required boilerplate.  
  
Tristan Partin, reviewed by Gurjeet Singh, Heikki Linnakangas, Jelte  
Fennema-Nio, and me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/libpq-fe.h

Use streaming I/O in pg_prewarm.

commit   : 3a352df05e65de740b4a375a0ecbcae97a1f6196    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:57:17 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:57:17 +1300    

Click here for diff

Instead of calling ReadBuffer() repeatedly, use the new streaming  
interface.  This commit provides a very simple example of such a  
transformation.  
  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M contrib/pg_prewarm/pg_prewarm.c

Provide API for streaming relation data.

commit   : b5a9b18cd0bc6f0124664999b31a00a264d16913    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:17:06 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:17:06 +1300    

Click here for diff

Introduce an abstraction allowing relation data to be accessed as a  
stream of buffers, with an implementation that is more efficient than  
the equivalent sequence of ReadBuffer() calls.  
  
Client code supplies a callback that can say which block number it wants  
next, and then consumes individual buffers one at a time from the  
stream.  This division puts read_stream.c in control of how far ahead it  
can see and allows it to read clusters of neighboring blocks with  
StartReadBuffers().  It also issues POSIX_FADV_WILLNEED advice ahead of  
time when random access is detected.  
  
Other variants of I/O stream will be proposed in future work (for  
example to support recovery, whose LsnReadQueue device in  
xlogprefetcher.c is a distant cousin of this code and should eventually  
be replaced by this), but this basic API is sufficient for many common  
executor usage patterns involving predictable access to a single fork of  
a single relation.  
  
Several patches using this API are proposed separately.  
  
This stream concept is loosely based on ideas from Andres Freund on how  
we should pave the way for later work on asynchronous I/O.  
  
Author: Thomas Munro <[email protected]>  
Author: Heikki Linnakangas <[email protected]> (contributions)  
Author: Melanie Plageman <[email protected]> (contributions)  
Suggested-by: Andres Freund <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Tested-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M src/backend/storage/Makefile
A src/backend/storage/aio/Makefile
A src/backend/storage/aio/meson.build
A src/backend/storage/aio/read_stream.c
M src/backend/storage/meson.build
A src/include/storage/read_stream.h
M src/tools/pgindent/typedefs.list

Provide vectored variant of ReadBuffer().

commit   : 210622c60e1a9db2e2730140b8106ab57d259d15    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:03:08 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 3 Apr 2024 00:03:08 +1300    

Click here for diff

Break ReadBuffer() up into two steps.  StartReadBuffers() and  
WaitReadBuffers() give us two main advantages:  
  
1.  Multiple consecutive blocks can be read with one system call.  
2.  Advice (hints of future reads) can optionally be issued to the  
kernel ahead of time.  
  
The traditional ReadBuffer() function is now implemented in terms of  
those functions, to avoid duplication.  
  
A new GUC io_combine_limit is defined, and the functions for limiting  
per-backend pin counts are made into public APIs.  Those are provided  
for use by callers of StartReadBuffers(), when deciding how many buffers  
to read at once.  The following commit will add a higher level mechanism  
for doing that automatically with a practical interface.  
  
With some more infrastructure in later work, StartReadBuffers() could  
be extended to start real asynchronous I/O instead of just issuing  
advice and leaving WaitReadBuffers() to do the work synchronously.  
  
Author: Thomas Munro <[email protected]>  
Author: Andres Freund <[email protected]> (some optimization tweaks)  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Dilip Kumar <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Tested-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Don't use the pg_am system catalog in new test

commit   : 13b3b62746ec8bd9c8e3f0bc23862f1172996333    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2024 13:10:16 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2024 13:10:16 +0200    

Click here for diff

This causes deadlocks because it's a highly trafficked catalog.  Use a  
regular table created by the same test instead.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Custom reloptions for table AM"

commit   : 867cc7b6ddb9d998103688a56048fe9a1ddd972a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 2 Apr 2024 11:26:59 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 2 Apr 2024 11:26:59 +0300    

Click here for diff

This reverts commit c95c25f9af4bc77f2f66a587735c50da08c12b37 due to multiple  
design issues spotted after commit.  
  
Reported-by: Jeff Davis  
Discussion: https://postgr.es/m/11550b536211d5748bb2865ed6cb3502ff073bf7.camel%40j-davis.com  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/cache/relcache.c
M src/include/access/reloptions.h
M src/include/access/tableam.h

Use TidStore for dead tuple TIDs storage during lazy vacuum.

commit   : 667e65aac354975c6f8090c6146fceb8d7b762d6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 2 Apr 2024 10:15:37 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 2 Apr 2024 10:15:37 +0900    

Click here for diff

Previously, we used a simple array for storing dead tuple IDs during  
lazy vacuum, which had a number of problems:  
  
* The array used a single allocation and so was limited to 1GB.  
* The allocation was pessimistically sized according to table size.  
* Lookup with binary search was slow because of poor CPU cache and  
  branch prediction behavior.  
  
This commit replaces that array with the TID store from commit  
30e144287a.  
  
Since the backing radix tree makes small allocations as needed, the  
1GB limit is now gone. Further, the total memory used is now often  
smaller by an order of magnitude or more, depending on the  
distribution of blocks and offsets. These two features should make  
multiple rounds of heap scanning and index cleanup an extremely rare  
event. TID lookup during index cleanup is also several times faster,  
even more so when index order is correlated with heap tuple order.  
  
Since there is no longer a predictable relationship between the number  
of dead tuples vacuumed and the space taken up by their TIDs, the  
number of tuples no longer provides any meaningful insights for users,  
nor is the maximum number predictable. For that reason this commit  
also changes to byte-based progress reporting, with the relevant  
columns of pg_stat_progress_vacuum renamed accordingly to  
max_dead_tuple_bytes and dead_tuple_bytes.  
  
For parallel vacuum, both the TID store and supplemental information  
specific to vacuum are shared among the parallel vacuum workers. As  
with the previous array, we don't take any locks on TidStore during  
parallel vacuum since writes are still only done by the leader  
process.  
  
Bump catalog version.  
  
Reviewed-by: John Naylor, (in an earlier version) Dilip Kumar  
Discussion: https://postgr.es/m/CAD21AoAfOZvmfR0j8VmZorZjL7RhTiQdVttNuC4W-Shdc2a-AA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/system_views.sql
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/include/commands/vacuum.h
M src/include/storage/lwlock.h
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Fix assert failure when planning setop subqueries with CTEs

commit   : d5d2205c8ddc6670fa87474e172fdfab162b7a73    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Apr 2024 12:15:45 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Apr 2024 12:15:45 +1300    

Click here for diff

66c0185a3 adjusted the UNION planner to request that union child queries  
produce Paths correctly ordered to implement the UNION by way of  
MergeAppend followed by Unique.  The code there made a bad assumption  
that if the root->parent_root->parse had setOperations set that the  
query must be the child subquery of a set operation.  That's not true  
when it comes to planning a non-inlined CTE which is parented by a set  
operation.  This causes issues as the CTE's targetlist has no  
requirement to match up to the SetOperationStmt's groupClauses  
  
Fix this by adding a new parameter to both subquery_planner() and  
grouping_planner() to explicitly pass the SetOperationStmt only when  
planning set operation child subqueries.  
  
Thank you to Tom Lane for helping to rationalize the decision on the  
best function signature for subquery_planner().  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/include/optimizer/planner.h
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Avoid "unused variable" warning on non-USE_SSL_ENGINE platforms.

commit   : 3622c8084643cc05bc8f28d0b238615c845eae14    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 19:01:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 19:01:18 -0400    

Click here for diff

If we are building with openssl but USE_SSL_ENGINE didn't get set,  
initialize_SSL's variable "pkey" is declared but used nowhere.  
Apparently this combination hasn't been exercised in the buildfarm  
before now, because I've not seen this warning before, even though  
the code has been like this a long time.  Move the declaration  
to silence the warning (and remove its useless initialization).  
  
Per buildfarm member sawshark.  Back-patch to all supported branches.  

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

Introduce 'options' argument to heap_page_prune()

commit   : 3d0f730bf19fbc70cca58818c1ad7415e5aa7d62    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Apr 2024 00:56:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Apr 2024 00:56:05 +0300    

Click here for diff

Currently there is only one option, HEAP_PAGE_PRUNE_MARK_UNUSED_NOW  
which replaces the old boolean argument, but upcoming patches will  
introduce at least one more. Having a lot of boolean arguments makes  
it hard to see at the call sites what the arguments mean, so prefer a  
bitmask of options with human-readable names.  
  
Author: Melanie Plageman <[email protected]>  
Author: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240401172219.fngjosaqdgqqvg4e@liskov  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Invent --transaction-size option for pg_restore.

commit   : 959b38d770ba1f8f35edab27ef3ccf8b1d99f5dd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 16:46:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 16:46:24 -0400    

Click here for diff

This patch allows pg_restore to wrap its commands into transaction  
blocks, somewhat like --single-transaction, except that we commit  
and start a new block after every N objects.  Using this mode  
with a size limit of 1000 or so objects greatly reduces the number  
of transactions consumed by the restore, while preventing any  
one transaction from taking enough locks to overrun the receiving  
server's shared lock table.  
  
(A value of 1000 works well with the default lock table size of  
around 6400 locks.  Higher --transaction-size values can be used  
if one has increased the receiving server's lock table size.)  
  
Excessive consumption of XIDs has been reported as a problem for  
pg_upgrade in particular, but it could be bad for any restore; and the  
change also reduces the number of fsyncs and amount of WAL generated,  
so it should provide speed benefits too.  
  
This patch does not try to make parallel workers batch the SQL  
commands they issue.  The trouble with doing that is that other  
workers may need to see the objects a worker creates right away.  
Possibly this can be improved later.  
  
In this patch I have hard-wired pg_upgrade to use a transaction size  
of 1000 divided by the number of parallel restore jobs allowed  
(without that, we'd still be at risk of overrunning the shared lock  
table).  Perhaps there would be value in adding another pg_upgrade  
option to allow user control of that, but I'm unsure that it's worth  
the trouble; I think few users would use it, and any who did would see  
not that much benefit compared to the default.  
  
Patch by me, but the original idea to batch SQL commands during  
restore is due to Robins Tharakan.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_upgrade/pg_upgrade.c

Rearrange pg_dump's handling of large objects for better efficiency.

commit   : a45c78e3284b269085e9a0cbd0ea3b236b7180fa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 16:25:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 16:25:56 -0400    

Click here for diff

Commit c0d5be5d6 caused pg_dump to create a separate BLOB metadata TOC  
entry for each large object (blob), but it did not touch the ancient  
decision to put all the blobs' data into a single "BLOBS" TOC entry.  
This is bad for a few reasons: for databases with millions of blobs,  
the TOC becomes unreasonably large, causing performance issues;  
selective restore of just some blobs is quite impossible; and we  
cannot parallelize either dump or restore of the blob data, since our  
architecture for that relies on farming out whole TOC entries to  
worker processes.  
  
To improve matters, let's group multiple blobs into each blob metadata  
TOC entry, and then make corresponding per-group blob data TOC entries.  
Selective restore using pg_restore's -l/-L switches is then possible,  
though only at the group level.  (Perhaps we should provide a switch  
to allow forcing one-blob-per-group for users who need precise  
selective restore and don't have huge numbers of blobs.  This patch  
doesn't do that, instead just hard-wiring the maximum number of blobs  
per entry at 1000.)  
  
The blobs in a group must all have the same owner, since the TOC entry  
format only allows one owner to be named.  In this implementation  
we also require them to all share the same ACL (grants); the archive  
format wouldn't require that, but pg_dump's representation of  
DumpableObjects does.  It seems unlikely that either restriction  
will be problematic for databases with huge numbers of blobs.  
  
The metadata TOC entries now have a "desc" string of "BLOB METADATA",  
and their "defn" string is just a newline-separated list of blob OIDs.  
The restore code has to generate creation commands, ALTER OWNER  
commands, and drop commands (for --clean mode) from that.  We would  
need special-case code for ALTER OWNER and drop in any case, so the  
alternative of keeping the "defn" as directly executable SQL code  
for creation wouldn't buy much, and it seems like it'd bloat the  
archive to little purpose.  
  
Since we require the blobs of a metadata group to share the same ACL,  
we can furthermore store only one copy of that ACL, and then make  
pg_restore regenerate the appropriate commands for each blob.  This  
saves space in the dump file not only by removing duplicative SQL  
command strings, but by not needing a separate TOC entry for each  
blob's ACL.  In turn, that reduces client-side memory requirements for  
handling many blobs.  
  
ACL TOC entries that need this special processing are labeled as  
"ACL"/"LARGE OBJECTS nnn..nnn".  If we have a blob with a unique ACL,  
continue to label it as "ACL"/"LARGE OBJECT nnn".  We don't actually  
have to make such a distinction, but it saves a few cycles during  
restore for the easy case, and it seems like a good idea to not change  
the TOC contents unnecessarily.  
  
The data TOC entries ("BLOBS") are exactly the same as before,  
except that now there can be more than one, so we'd better give them  
identifying tag strings.  
  
Also, commit c0d5be5d6 put the new BLOB metadata TOC entries into  
SECTION_PRE_DATA, which perhaps is defensible in some ways, but  
it's a rather odd choice considering that we go out of our way to  
treat blobs as data.  Moreover, because parallel restore handles  
the PRE_DATA section serially, this means we'd only get part of the  
parallelism speedup we could hope for.  Move these entries into  
SECTION_DATA, letting us parallelize the lo_create calls not just the  
data loading when there are many blobs.  Add dependencies to ensure  
that we won't try to load data for a blob we've not yet created.  
  
As this stands, we still generate a separate TOC entry for any comment  
or security label attached to a blob.  I feel comfortable in believing  
that comments and security labels on blobs are rare, so this patch  
should be enough to get most of the useful TOC compression for blobs.  
  
We have to bump the archive file format version number, since existing  
versions of pg_restore wouldn't know they need to do something special  
for BLOB METADATA, plus they aren't going to work correctly with  
multiple BLOBS entries or multiple-large-object ACL entries.  
  
The directory and tar-file format handlers need some work  
for multiple BLOBS entries: they used to hard-wire the file name  
as "blobs.toc", which is replaced here with "blobs_<dumpid>.toc".  
The 002_pg_dump.pl test script also knows about that and requires  
minor updates.  (I had to drop the test for manually-compressed  
blobs.toc files with LZ4, because lz4's obtuse command line  
design requires explicit specification of the output file name  
which seems impractical here.  I don't think we're losing any  
useful test coverage thereby; that test stanza seems completely  
duplicative with the gzip and zstd cases anyway.)  
  
In passing, centralize management of the lo_buf used to hold data  
while restoring blobs.  The code previously had each format handler  
create lo_buf, which seems rather pointless given that the format  
handlers all make it the same way.  Moreover, the format handlers  
never use lo_buf directly, making this setup a failure from a  
separation-of-concerns standpoint.  Let's move the responsibility into  
pg_backup_archiver.c, which is the only module concerned with lo_buf.  
The reason to do this in this patch is that it allows a centralized  
fix for the now-false assumption that we never restore blobs in  
parallel.  Also, get rid of dead code in DropLOIfExists: it's been a  
long time since we had any need to be able to restore to a pre-9.0  
server.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl

Avoid possible longjmp-induced logic error in PLy_trigger_build_args.

commit   : 5eac8cef24543767015a9b248af08bbfa10b1b70    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 15:15:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 15:15:03 -0400    

Click here for diff

The "pltargs" variable wasn't marked volatile, which makes it unsafe  
to change its value within the PG_TRY block.  It looks like the worst  
outcome would be to fail to release a refcount on Py_None during an  
(improbable) error exit, which would likely go unnoticed in the field.  
Still, it's a bug.  A one-liner fix could be to mark pltargs volatile,  
but on the whole it seems cleaner to arrange things so that we don't  
change its value within PG_TRY.  
  
Per report from Xing Guo.  This has been there for quite awhile,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CACpMh+DLrk=fDv07MNpBT4J413fDAm+gmMXgi8cjPONE+jvzuw@mail.gmail.com  

M src/pl/plpython/plpy_exec.c

Fix assorted resource leaks in new pg_createsubscriber code.

commit   : 91cbb4b492cbea889e8392a85e246c1778ca2a45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 13:47:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2024 13:47:27 -0400    

Click here for diff

Various error paths did not release resources before returning.  
While it's likely that the program would just exit shortly later,  
none of the functions in question have summary exit(1) calls,  
so they should not be assuming that.  
  
Ranier Vilela and Tom Lane, per reports from Coverity  
  
Discussion: https://postgr.es/m/CAEudQAr2_SZFxB4kXJiL4+2UaNZxUk5UBJtj0oXyJYMGZu-03g@mail.gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

Handle non-chain tuples outside of heap_prune_chain()

commit   : 6f47f6883151366c031cd6fd4011e66d2c702a90    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 20:33:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 20:33:50 +0300    

Click here for diff

Handle dead branches of aborted HOT chains outside heap_prune_chain()  
as a separate phase. This simplifies the logic in heap_prune_chain(),  
as well as allowing us to clean up more RECENTLY_DEAD -> DEAD chains.  
  
To accomplish this efficiently, partition tuples into HOT and non-HOT  
while first collecting visibility information for each tuple in  
heap_page_prune(). Then call heap_prune_chain() only on potential  
chain members. Then mop up the leftover HOT tuples afterwards.  
  
As part of this, keep track of which items on page have already been  
processed, in 'processed' array. This replaces the 'marked' array  
which was only set for tuples marked for removal or redirection. The  
'processed' array is updated also for items that are left unchanged,  
when we conclude that an item can be left unchanged. At the end of  
pruning, every item on the page should be marked as processed in the  
array; an assertion is added for that.  
  
Author: Melanie Plageman <[email protected]>  
Author: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov  

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

Refactor heap_prune_chain()

commit   : 7aa00f1360e0c6938fdf32d3fbb8b847b6098b88    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 13:28:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 13:28:44 +0300    

Click here for diff

Keep track of the number of deleted tuples in PruneState and record this  
information when recording a tuple dead, unused or redirected. This  
removes a special case from the traversal and chain processing logic as  
well as setting a precedent of recording the impact of prune actions in  
the record functions themselves. This paradigm will be used in future  
commits which move tracking of additional statistics on pruning actions  
from lazy_scan_prune() to heap_prune_chain().  
  
Simplify heap_prune_chain()'s chain traversal logic by handling each  
case explicitly. That is, do not attempt to share code when processing  
different types of chains. For each category of chain, process it  
specifically and procedurally: first handling the root, then any  
intervening tuples, and, finally, the end of the chain.  
  
While we are at it, add a few new comments to heap_prune_chain()  
clarifying some special cases involving RECENTLY_DEAD tuples.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov  

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

Minor refactoring in heap_page_prune

commit   : 9917e79d995c845adfe9b6cb3ea5cb7af7cec654    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 12:07:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Apr 2024 12:07:30 +0300    

Click here for diff

Pass 'page', 'blockno' and 'maxoff' to heap_prune_chain() as  
arguments, so that it doesn't need to fetch them from the buffer. This  
saves a few cycles per chain.  
  
Remove the "if (off_loc != NULL)" checks, and require the caller to  
pass a non-NULL 'off_loc'. Pass a pointer to a dummy local variable  
when it's not needed. Those checks are cheap, but it's still better to  
avoid them in the per-chain loops when we can do so easily.  
  
The CPU time saving from these changes are hardly measurable, but  
fewer instructions is good anyway, so why not. I spotted the potential  
for these while reviewing Melanie Plageman's patch set to combine  
prune and freeze records.  
  
Discussion: https://www.postgresql.org/message-id/CAAKRu_abm2tHhrc0QSQa%3D%3DsHe%3DVA1%3Doz1dJMQYUOKuHmu%2B9Xrg%40mail.gmail.com  

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

Add new COPY option LOG_VERBOSITY.

commit   : f5a227895e178bf528b18f82bbe554435fb3e64f    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 1 Apr 2024 15:25:25 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 1 Apr 2024 15:25:25 +0900    

Click here for diff

This commit adds a new COPY option LOG_VERBOSITY, which controls the  
amount of messages emitted during processing. Valid values are  
'default' and 'verbose'.  
  
This is currently used in COPY FROM when ON_ERROR option is set to  
ignore. If 'verbose' is specified, a NOTICE message is emitted for  
each discarded row, providing additional information such as line  
number, column name, and the malformed value. This helps users to  
identify problematic rows that failed to load.  
  
Author: Bharath Rupireddy  
Reviewed-by: Michael Paquier, Atsushi Torikoshi, Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/CALj2ACUk700cYhx1ATRQyRw-fBM%2BaRo6auRAitKGff7XNmYfqQ%40mail.gmail.com  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list

Revert "Speed up tail processing when hashing aligned C strings"

commit   : f4ad0021aface01ee74604355bd2e998e5f73320    
  
author   : John Naylor <[email protected]>    
date     : Sun, 31 Mar 2024 14:18:36 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 31 Mar 2024 14:18:36 +0700    

Click here for diff

This reverts commit 07f0f6abfc7f6c55cede528d9689dedecefc734a.  
  
This has shown failures on both Valgrind and big-endian machines,  
per members skink and pike.  

M src/include/common/hashfn_unstable.h

Speed up tail processing when hashing aligned C strings

commit   : 07f0f6abfc7f6c55cede528d9689dedecefc734a    
  
author   : John Naylor <[email protected]>    
date     : Sun, 31 Mar 2024 12:19:16 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 31 Mar 2024 12:19:16 +0700    

Click here for diff

After encountering the NUL terminator, the word-at-a-time loop exits  
and we must hash the remaining bytes. Previously we calculated the  
terminator's position and re-loaded the remaining bytes from the input  
string. We already have all the data we need in a register, so let's  
just mask off the bytes we need and hash them immediately. The mask can  
be cheaply computed without knowing the terminator's position. We still  
need that position for the length calculation, but the CPU can now  
do that in parallel with other work, shortening the dependency chain.  
  
Ants Aasma and John Naylor  
  
Discussion: https://postgr.es/m/CANwKhkP7pCiW_5fAswLhs71-JKGEz1c1%2BPC0a_w1fwY4iGMqUA%40mail.gmail.com  

M src/include/common/hashfn_unstable.h

Let table AM insertion methods control index insertion

commit   : b1484a3f1910bfd0e254afe40085dfc3351bda8c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:39:03 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:39:03 +0200    

Click here for diff

Previously, the executor did index insert unconditionally after calling  
table AM interface methods tuple_insert() and multi_insert().  This commit  
introduces the new parameter insert_indexes for these two methods.  Setting  
'*insert_indexes' to true saves the current logic.  Setting it to false  
indicates that table AM cares about index inserts itself and doesn't want the  
caller to do that.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Reviewed-by: Pavel Borisov, Matthias van de Meent, Mark Dilger  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/catalog/indexing.c
M src/backend/commands/copyfrom.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/tableam.h

Custom reloptions for table AM

commit   : c95c25f9af4bc77f2f66a587735c50da08c12b37    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:36:25 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:36:25 +0200    

Click here for diff

Let table AM define custom reloptions for its tables.  This allows to  
specify AM-specific parameters by WITH clause when creating a table.  
  
The code may use some parts from prior work by Hao Wu.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Discussion: https://postgr.es/m/AMUA1wBBBxfc3tKRLLdU64rb.1.1683276279979.Hmail.wuhao%40hashdata.cn  
Reviewed-by: Reviewed-by: Pavel Borisov, Matthias van de Meent  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/cache/relcache.c
M src/include/access/reloptions.h
M src/include/access/tableam.h

Generalize relation analyze in table AM interface

commit   : 27bc1772fc814946918a5ac8ccb9b5c5ad0380aa    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:34:04 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 30 Mar 2024 22:34:04 +0200    

Click here for diff

Currently, there is just one algorithm for sampling tuples from a table written  
in acquire_sample_rows().  Custom table AM can just redefine the way to get the  
next block/tuple by implementing scan_analyze_next_block() and  
scan_analyze_next_tuple() API functions.  
  
This approach doesn't seem general enough.  For instance, it's unclear how to  
sample this way index-organized tables.  This commit allows table AM to  
encapsulate the whole sampling algorithm (currently implemented in  
acquire_sample_rows()) into the relation_analyze() API function.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Reviewed-by: Pavel Borisov, Matthias van de Meent  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/analyze.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/vacuum.h
M src/include/foreign/fdwapi.h

Add pg_basetype() function to extract a domain's base type.

commit   : b154d8a6d0e52e5f6b09739639fdf55fa88bc6b8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2024 13:57:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2024 13:57:19 -0400    

Click here for diff

This SQL-callable function behaves much like our internal utility  
function getBaseType(), except it returns NULL rather than failing for  
an invalid type OID.  (That behavior is modeled on our experience with  
other catalog-inquiry functions such as the ACL checking functions.)  
The key advantage over doing a join to pg_type is that it will loop  
as needed to find the bottom base type of a nest of domains.  
  
Steve Chavez, reviewed by jian he and others  
  
Discussion: https://postgr.es/m/CAGRrpzZSX8j=MQcbCSEisFA=ic=K3bknVfnFjAv1diVJxFHJvg@mail.gmail.com  

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

Stabilize postgres_fdw test

commit   : ecf741cfae0603d1df269d8b799455bbcaef86e7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 30 Mar 2024 14:16:54 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 30 Mar 2024 14:16:54 +0100    

Click here for diff

The test fails when RESET statement_timeout takes longer than 10ms.  
Avoid the problem by using SET LOCAL instead.  
  
Overall, this test is not ideal: 10ms could be shorter than the time to  
have sent the query to the "remote" server, so it's possible that on  
some machines this test doesn't actually witness a remote query being  
cancelled.  We may want to improve on this someday by using some other  
testing technique, but for now it's better than nothing.  I verified  
manually that one round of remote cancellation occurs when this runs on  
my machine.  
  
Discussion: https://postgr.es/m/CAGECzQRsdWnj=YaaPCnA8d7E1AdbxRPBYmyBQRMPUijR2MpM_w@mail.gmail.com  

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

doc: Improve "Partition Maintenance" section

commit   : 056c565742742e2eafe681c0a3ee7710503a556b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 30 Mar 2024 14:08:13 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 30 Mar 2024 14:08:13 +0100    

Click here for diff

This adds some reference links and clarifies the wording a bit.  
  
Author: Robert Treat <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://postgr.es/m/CABV9wwNGn-pweak6_pvL5PJ1mivDNPKfg0Tck_1oTUETv5Y=dg@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.

commit   : 0294df2f1f842dfb0eed79007b21016f486a3c6c    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 30 Mar 2024 10:00:26 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 30 Mar 2024 10:00:26 +0000    

Click here for diff

This allows MERGE commands to include WHEN NOT MATCHED BY SOURCE  
actions, which operate on rows that exist in the target relation, but  
not in the data source. These actions can execute UPDATE, DELETE, or  
DO NOTHING sub-commands.  
  
This is in contrast to already-supported WHEN NOT MATCHED actions,  
which operate on rows that exist in the data source, but not in the  
target relation. To make this distinction clearer, such actions may  
now be written as WHEN NOT MATCHED BY TARGET.  
  
Writing WHEN NOT MATCHED without specifying BY SOURCE or BY TARGET is  
equivalent to writing WHEN NOT MATCHED BY TARGET.  
  
Dean Rasheed, reviewed by Alvaro Herrera, Ted Yu and Vik Fearing.  
  
Discussion: https://postgr.es/m/CAEZATCWqnKGc57Y_JanUBHQXNKcXd7r=0R4NEZUVwP+syRkWbA@mail.gmail.com  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/merge.sgml
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/gram.y
M src/backend/parser/parse_merge.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/pathnode.h
M src/include/parser/kwlist.h
M src/test/isolation/expected/merge-update.out
M src/test/isolation/specs/merge-update.spec
M src/test/regress/expected/merge.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/merge.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/updatable_views.sql
M src/tools/pgindent/typedefs.list

Add unicode_strtitle() for Unicode Default Case Conversion.

commit   : 46e5441fa536b89c1123f270fdfeeb72c320b901    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 29 Mar 2024 17:35:07 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 29 Mar 2024 17:35:07 -0700    

Click here for diff

This brings the titlecasing implementation for the builtin provider  
out of formatting.c and into unicode_case.c, along with  
unicode_strlower() and unicode_strupper(). Accepts an arbitrary word  
boundary callback.  
  
Simple for now, but can be extended to support the Unicode Default  
Case Conversion algorithm with full case mapping.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M src/backend/utils/adt/formatting.c
M src/common/unicode_case.c
M src/include/common/unicode_case.h

Remove superfluous trailing semicolons

commit   : a96a8b15fa4e00b78ac7dd7f37ff7f871aa248f6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 29 Mar 2024 23:51:43 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 29 Mar 2024 23:51:43 +0100    

Click here for diff

Two semicolons were accidentally added to rows which were already  
terminated semicolons.  While harmless, fix by removing these.  
  
Author: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs4_fnJ0+yOgFioswzLE7t6R8P6cqbuacFVeZqbESFAjs1A@mail.gmail.com  

M src/include/lib/radixtree.h
M src/test/modules/test_tidstore/test_tidstore.c

Use version for builtin collations.

commit   : 46a44dc372033da9bd8b9840711e560c9d73e768    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 29 Mar 2024 10:52:24 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 29 Mar 2024 10:52:24 -0700    

Click here for diff

Given that the version field already exists, there's little reason not  
to use it. Suggestion from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M src/backend/utils/adt/pg_locale.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat

Try to stabilize flappy test result.

commit   : c2df2ed90a82fc0acd07ed88ac433350edfd6b54    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Mar 2024 10:40:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Mar 2024 10:40:31 -0400    

Click here for diff

This recently-added test case checks the plan of an inner join  
between two identical tables.  It's just chance which join order  
the planner will pick, and in the presence of any variation in  
the underlying statistics, the displayed plan might change.  
Add a WHERE condition to break the cost symmetry and hopefully  
stabilize matters.  
  
(We're still trying to understand exactly why the underlying  
statistics aren't as stable as intended, but this seems like  
a good change anyway, since this test would surely bite us  
again in future.)  
  
While here, clean up assorted comment spelling, grammar, and  
whitespace problems.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add allow_alter_system GUC.

commit   : d3ae2a24f265a028f4b9e8df79ea7b075c6cf016    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2024 08:44:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2024 08:44:45 -0400    

Click here for diff

This is marked PGC_SIGHUP, so it can only be set in a configuration  
file, not anywhere else; and it is also marked GUC_DISALLOW_IN_AUTO_FILE,  
so it can't be set using ALTER SYSTEM. When set to false, the  
ALTER SYSTEM command is disallowed.  
  
There was considerable concern that this would be misinterpreted as  
a security feature, which it is not, because a determined superuser  
has various ways of bypassing it. Hence, a lot of work has gone into  
wordsmithing the documentation, in the hopes of avoiding any such  
confusion.  
  
Jelte Fennemia-Nio and Gabriele Bartolini, with wording suggestions  
for the documentation from many others.  
  
Discussion: http://postgr.es/m/CA%2BVUV5rEKt2%2BCdC_KUaPoihMu%2Bi5ChT4WVNTr4CD5-xXZUfuQw%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/alter_system.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Allow "internal" subtransactions in parallel mode.

commit   : 0075d78947e3800c5a807f48fd901f16db91101b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Mar 2024 12:43:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Mar 2024 12:43:10 -0400    

Click here for diff

Allow use of BeginInternalSubTransaction() in parallel mode, so long  
as the subtransaction doesn't attempt to acquire an XID or increment  
the command counter.  Given those restrictions, the other parallel  
processes don't need to know about the subtransaction at all, so  
this should be safe.  The benefit is that it allows subtransactions  
intended for error recovery, such as pl/pgsql exception blocks,  
to be used in PARALLEL SAFE functions.  
  
Another reason for doing this is that the API of  
BeginInternalSubTransaction() doesn't allow reporting failure.  
pl/python for one, and perhaps other PLs, copes very poorly with an  
error longjmp out of BeginInternalSubTransaction().  The headline  
feature of this patch removes the only easily-triggerable failure  
case within that function.  There remain some resource-exhaustion  
and similar cases, which we now deal with by promoting them to FATAL  
errors, so that callers need not try to clean up.  (It is likely  
that such errors would leave us with corrupted transaction state  
inside xact.c, making recovery difficult if not impossible anyway.)  
  
Although this work started because of a report of a pl/python crash,  
we're not going to do anything about that in the back branches.  
Back-patching this particular fix is obviously not very wise.  
While we could contemplate some narrower band-aid, pl/python is  
already an untrusted language, so it seems okay to classify this  
as a "so don't do that" case.  
  
Patch by me, per report from Hao Zhang.  Thanks to Robert Haas for  
review.  
  
Discussion: https://postgr.es/m/CALY6Dr-2yLVeVPhNMhuBnRgOZo1UjoTETgtKBx1B2gUi8yy+3g@mail.gmail.com  

M doc/src/sgml/parallel.sgml
M doc/src/sgml/ref/create_function.sgml
M src/backend/access/transam/README.parallel
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

ALTER TABLE: rework determination of access method ID

commit   : e2395cdbe83adc50ac03dd17474ee88c5a97359a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 16:51:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 16:51:20 +0100    

Click here for diff

Avoid setting an access method OID for relation kinds that don't take  
one.  Code review for new feature added in 374c7a229042.  
  
Author: Justin Pryzby <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Update comment in set_dummy_rel_pathlist().

commit   : be98a550cc81994959f19a117cb2732762df924c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Mar 2024 11:44:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Mar 2024 11:44:00 -0400    

Click here for diff

This comment claimed that set_dummy_rel_pathlist() has callers  
other than (possibly indirectly) set_rel_size().  It doesn't,  
so revise the argument to not rely on that.  
  
Noted by Richard Guo.  
  
Discussion: https://postgr.es/m/CAMbWs4-KFEU_fDuJPNCOkUu3rwvZvKBEytkd9VrM4kH4-2h1CQ@mail.gmail.com  

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

Remove translation markers from libpq-be-fe-helpers.h

commit   : 213c959a294d56445bfe79d7f28a9b1f8a928746    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 13:12:12 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 13:12:12 +0100    

Click here for diff

Apparently these markers cause the modules to not link correctly in some  
platforms, at least per buildfarm member indri; moreover, this code is  
only used in modules that don't have a translation.  If we someday add  
i18n support to contrib/ it might be worth revisiting this.  

M src/include/libpq/libpq-be-fe-helpers.h

libpq-be-fe-helpers.h: wrap new cancel APIs

commit   : 2466d6654f85d7ec136d09d52ae22771452a19df    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 11:31:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Mar 2024 11:31:03 +0100    

Click here for diff

Commit 61461a300c1c introduced new functions to libpq for cancelling  
queries.  This commit introduces a helper function that backend-side  
libraries and extensions can use to invoke those.  This function takes a  
timeout and can itself be interrupted while it is waiting for a cancel  
request to be sent and processed, instead of being blocked.  
  
This replaces the usage of the old functions in postgres_fdw and dblink.  
  
Finally, it also adds some test coverage for the cancel support in  
postgres_fdw.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQT_VgOWWENUqvUV9xQmbaCyXjtRRAYO8W07oqashk_N+g@mail.gmail.com  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/include/libpq/libpq-be-fe-helpers.h

Remove obsolete comment about VACUUM retrying pruning

commit   : 427005742bd2efdcee0f361e17d1a76664ff001b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 28 Mar 2024 10:18:48 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 28 Mar 2024 10:18:48 +0200    

Click here for diff

Commit 1ccc1e05ae removed the retry logic that the comment talked  
about.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240328015326.x5gnzsohl6j23b42@liskov  

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

Improve tab completion for ALTER TABLE ALTER COLUMN SET in psql.

commit   : f1bb9284f73437b3f2011dad5e815c8738758aef    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 28 Mar 2024 16:30:10 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 28 Mar 2024 16:30:10 +0900    

Click here for diff

The commit changes the tab completion to add DATA TYPE after  
ALTER TABLE ... ALTER COLUMN ... SET.  
  
Author: Vignesh C  
Reviewed-by: Shubham Khanna, Masahiko Sawada  
Discussion: https://postgr.es/m/CALDaNm1aEdJb-QJi%3DGWStkfj_%2BEDUK_VtDkn%2BTjQ2z7HyU0MBw%40mail.gmail.com  

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

Improve style of pg_lfind32().

commit   : 7188a7806d208430aa5c717a1aefdf4980ed3d4d    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 27 Mar 2024 20:26:05 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 27 Mar 2024 20:26:05 -0500    

Click here for diff

This commit simplifies pg_lfind32() a bit by moving the standard  
one-by-one linear search code to an inline helper function.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20240327013616.GA3940109%40nathanxps13  

M src/include/port/pg_lfind.h

Rethink create and attach APIs of shared TidStore.

commit   : 2d8f56dabbfd2f85da9a4e0fe4a4b4d6654864f1    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 28 Mar 2024 10:03:28 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 28 Mar 2024 10:03:28 +0900    

Click here for diff

Previously, the behavior of TidStoreCreate() was inconsistent between  
local and shared TidStore instances in terms of memory limitation. For  
local TidStore, a memory context was created with initial and maximum  
memory block sizes, as well as a minimum memory context size, based on  
the specified max_bytes values. However, for shared TidStore, the  
provided DSA area was used for TID storage. Although commit bb952c8c8b  
allowed specifying the initial and maximum DSA segment sizes, callers  
would have needed to clamp their own limits, which was not consistent  
and user-friendly.  
  
With this commit, when creating a shared TidStore, a dedicated DSA  
area is created for TID storage instead of using a provided DSA  
area. The initial and maximum DSA segment sizes are chosen based on  
the specified max_bytes. Other processes can attach to the shared  
TidStore using the handle of the created DSA returned by the new  
TidStoreGetDSA() function and the DSA pointer returned by  
TidStoreGetHandle(). The created DSA has the same lifetime as the  
shared TidStore and is deleted when all processes detach from it.  
  
To improve clarity, the TidStoreCreate() function has been divided  
into two separate functions: TidStoreCreateLocal() and  
TidStoreCreateShared().  
  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAD21AoAyc1j%3DBCdUqZfk6qbdjZ68UgRx1Gkpk0oah4K7S0Ri9g%40mail.gmail.com  

M src/backend/access/common/tidstore.c
M src/include/access/tidstore.h
M src/test/modules/test_tidstore/test_tidstore.c

doc: fix CREATE ROLE typo

commit   : d1cf5319e9ae16435e5ca416c06c2290bfca000e    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 27 Mar 2024 17:58:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 27 Mar 2024 17:58:11 -0400    

Click here for diff

This wording typo was added in PG 16.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16  

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

Run perltidy on generate-unicode_version.pl.

commit   : b0be28761ec5958bb7bbf9a03d94ee6e1bc59849    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 27 Mar 2024 13:21:29 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 27 Mar 2024 13:21:29 -0700    

Click here for diff

M src/common/unicode/generate-unicode_version.pl

Fix unnecessary use of moving-aggregate mode with non-moving frame.

commit   : a767cdc84c9a4cba1f92854de55fb8b5f2de4598    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2024 13:39:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2024 13:39:03 -0400    

Click here for diff

When a plain aggregate is used as a window function, and the window  
frame start is specified as UNBOUNDED PRECEDING, the frame's head  
cannot move so we do not need to use moving-aggregate mode.  The check  
for that was put into initialize_peragg(), failing to notice that  
ExecInitWindowAgg() calls that function before it's filled in  
winstate->frameOptions.  Since makeNode() would have zeroed the field,  
this didn't provoke uninitialized-value complaints, nor would the  
erroneous decision have resulted in more than a little inefficiency.  
Still, it's wrong, so move the initialization of  
winstate->frameOptions earlier to make it work properly.  
  
While here, also fix a thinko in a comment.  Both errors crept in in  
commit a9d9acbf2 which introduced the moving-aggregate mode.  
  
Spotted by Vallimaharajan G.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeWindowAgg.c

Adjust documentation for syncfs().

commit   : 44a4cca9913bae8557c31207adb97b94e6e60603    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 27 Mar 2024 10:23:13 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 27 Mar 2024 10:23:13 -0500    

Click here for diff

Commit 8c16ad3b43 created a new appendix for syncfs(), which is  
excessive for such a small amount of content.  This commit moves  
the description of the caveats to be aware of when using syncfs()  
back to the documentation for recovery_init_sync_method.  The  
documentation for the other utilities with syncfs() support now  
directs readers to recovery_init_sync_method for information about  
these caveats.  
  
Reported-by: Peter Eisentraut, Robert Haas  
Suggested-by: Robert Haas  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/42804669-7063-1320-ed37-3226d5f1067d%40eisentraut.org  
Discussion: https://postgr.es/m/CA%2BTgmobUiqKr%2BZMCLc5Qap-sXBnjfGUU%2BZBmzYEjUuWyjsGr1g%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_combinebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml
D doc/src/sgml/syncfs.sgml

Rename COMPAT_OPTIONS_CLIENT to COMPAT_OPTIONS_OTHER.

commit   : de7e96bd0fc620715fa1c7bd9985463c358664cf    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Mar 2024 10:45:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Mar 2024 10:45:28 -0400    

Click here for diff

The user-facing name is "Other Platforms and Clients", but the  
internal name seems too focused on clients specifically, especially  
given the plan to add a new setting to this session that is about  
platform or deployment model compatibility rather than client  
compatibility.  
  
Jelte Fennema-Nio  
  
Discussion: http://postgr.es/m/CAGECzQTfMbDiM6W3av+3weSnHxJvPmuTEcjxVvSt91sQBdOxuQ@mail.gmail.com  

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

Fix unstable aggregate regression test

commit   : d6a6957d53e3de9982b076b6ddd703be3d0ae30a    
  
author   : David Rowley <[email protected]>    
date     : Thu, 28 Mar 2024 00:13:48 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 28 Mar 2024 00:13:48 +1300    

Click here for diff

Buildfarm member avocet has shown a plan change by switching the  
finalize aggregate stage to use a GroupAggregate rather than a  
HashAggregate.  This is consistent with autovacuum having triggered on  
the table, per analysis by Alexander Lakhin.  
  
Fix this by disabling autovacuum on the table.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16, where this test was added.  

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

Add functions to generate random numbers in a specified range.

commit   : e6341323a8da64b18e9af3e75a4578230702d61c    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 27 Mar 2024 10:12:39 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 27 Mar 2024 10:12:39 +0000    

Click here for diff

This adds 3 new variants of the random() function:  
  
    random(min integer, max integer) returns integer  
    random(min bigint, max bigint) returns bigint  
    random(min numeric, max numeric) returns numeric  
  
Each returns a random number x in the range min <= x <= max.  
  
For the numeric function, the number of digits after the decimal point  
is equal to the number of digits that "min" or "max" has after the  
decimal point, whichever has more.  
  
The main entry points for these functions are in a new C source file.  
The existing random(), random_normal(), and setseed() functions are  
moved there too, so that they can all share the same PRNG state, which  
is kept private to that file.  
  
Dean Rasheed, reviewed by Jian He, David Zhang, Aleksander Alekseev,  
and Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAEZATCV89Vxuq93xQdmc0t-0Y2zeeNQTdsjbmV7dyFBPykbV4Q@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/float.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/numeric.c
A src/backend/utils/adt/pseudorandomfuncs.c
M src/common/pg_prng.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/common/pg_prng.h
M src/include/utils/numeric.h
M src/test/regress/expected/random.out
M src/test/regress/sql/random.sql

Fix some typos and grammar issues from commit 87985cc92522

commit   : 818861eb578663a0d4d8d7dc4e18c96a148b3c75    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Mar 2024 11:46:12 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Mar 2024 11:46:12 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

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

Fix random failure in 004_subscription.

commit   : 677a45c4ae165f86b4a7b8562795f19f1ed480cf    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Mar 2024 14:15:03 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Mar 2024 14:15:03 +0530    

Click here for diff

After the upgrade, the failed test was ensuring that the changes made on  
the publisher should be replicated to the subscriber. We missed waiting  
for one of the subscriptions to catch up.  
  
Per buildfarm  
  
Author: Vignesh C  
Reviewed-by: Kuroda Hayato  
Discussion: https://postgr.es/m/CALDaNm0z=fLtio1h50K8WossUGXU+gy0H9y9=RYh1DDZiq2EDw@mail.gmail.com  

M src/bin/pg_upgrade/t/004_subscription.pl

Change last_inactive_time to inactive_since in pg_replication_slots.

commit   : 6d49c8d4b4f4a20eb5b4c501d78cf894fa13c0ea    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Mar 2024 09:27:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Mar 2024 09:27:44 +0530    

Click here for diff

Commit a11f330b55 added last_inactive_time to show the last time the slot  
was inactive. But, it tells the last time that a currently-inactive slot  
previously *WAS* active. This could be unclear, so we changed the name to  
inactive_since.  
  
Reported-by: Robert Haas  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Shveta Malik, Amit Kapila  
Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com  
Discussion: https://postgr.es/m/CALj2ACUXS0SfbHzsX8bqo+7CZhocsV52Kiu7OWGb5HVPAmJqnA@mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/recovery/t/019_replslot_limit.pl
M src/test/regress/expected/rules.out

Allow specifying initial and maximum segment sizes for DSA.

commit   : bb952c8c8b13279eca039499249cb5dc60991603    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 27 Mar 2024 11:43:29 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 27 Mar 2024 11:43:29 +0900    

Click here for diff

Previously, the DSA segment size always started with 1MB and grew up  
to DSA_MAX_SEGMENT_SIZE. It was inconvenient in certain scenarios,  
such as when the caller desired a soft constraint on the total DSA  
segment size, limiting it to less than 1MB.  
  
This commit introduces the capability to specify the initial and  
maximum DSA segment sizes when creating a DSA area, providing more  
flexibility and control over memory usage.  
  
Reviewed-by: John Naylor, Tomas Vondra  
Discussion: https://postgr.es/m/CAD21AoAYGGC1ePjVX0H%2Bpp9rH%3D9vuPK19nNOiu12NprdV5TVJA%40mail.gmail.com  

M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h

Fix compiler warning for pg_lfind32().

commit   : 1f42337be535243e665f85916ce21b2d85d9f2b3    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 20:27:46 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 20:27:46 -0500    

Click here for diff

The newly-introduced "one_by_one" label produces -Wunused-label  
warnings when building without SIMD support.  To fix, move the  
label into the SIMD section of this function.  
  
Oversight in commit 7644a7340c.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/3189995.1711495704%40sss.pgh.pa.us  

M src/include/port/pg_lfind.h

Add commit 64e401b62b to .git-blame-ignore-revs.

commit   : ffa9bb53ecb1cec14039d0c78e6f941565e8f986    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 15:08:47 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 15:08:47 -0500    

Click here for diff

M .git-blame-ignore-revs

Remove some redundant set_cheapest() calls.

commit   : 9d00cf47722a5d2876fc5c7727a395c0348dd304    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 16:02:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 16:02:37 -0400    

Click here for diff

Commit e2fa76d80 centralized the responsibility for doing  
set_cheapest() for a baserel, but these functions added later  
seemingly didn't get the memo.  There's no apparent reason why  
we need the cheapest path for these relation types to be available  
any sooner than it is for other base relation types, so delete the  
duplicate calls.  Doesn't save much since there's only one path  
in these cases, but it might improve clarity.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-KFEU_fDuJPNCOkUu3rwvZvKBEytkd9VrM4kH4-2h1CQ@mail.gmail.com  

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

Optimize roles_is_member_of() with a Bloom filter.

commit   : d365ae705409f5d9c81da4b668f59c3598feb512    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 14:43:37 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 14:43:37 -0500    

Click here for diff

When the list of roles gathered by roles_is_member_of() grows very  
large, a Bloom filter is created to help avoid some linear searches  
through the list.  The threshold for creating the Bloom filter is  
set arbitrarily high and may require future adjustment.  
  
Suggested-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAGvXd3OSMbJQwOSc-Tq-Ro1CAz%3DvggErdSG7pv2s6vmmTOLJSg%40mail.gmail.com  

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

Fix failure of ALTER FOREIGN TABLE SET SCHEMA to move sequences.

commit   : fad3b5b5acb154725b0265010642ee95fa37c5d7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 15:28:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 15:28:16 -0400    

Click here for diff

Ordinary ALTER TABLE SET SCHEMA will also move any owned sequences  
into the new schema.  We failed to do likewise for foreign tables,  
because AlterTableNamespaceInternal believed that only certain  
relkinds could have indexes, owned sequences, or constraints.  
We could simply add foreign tables to that relkind list, but it  
seems likely that the same oversight could be made again in  
future.  Instead let's remove the relkind filter altogether.  
These functions shouldn't cost much when there are no objects  
that they need to process, and surely this isn't an especially  
performance-critical case anyway.  
  
Per bug #18407 from Vidushi Gupta.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Micro-optimize pg_lfind32().

commit   : 7644a7340c8a7764f1b20b34e1273b41347cbfcb    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 14:03:32 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 26 Mar 2024 14:03:32 -0500    

Click here for diff

This commit improves the performance of pg_lfind32() in many cases  
by modifying it to process the remaining "tail" of elements with  
SIMD instructions instead of processing them one-by-one.  Since the  
SIMD code processes a large block of elements, this means that we  
will process a subset of elements more than once, but that won't  
affect the correctness of the result, and testing has shown that  
this helps more cases than it regresses.  With this change, the  
standard one-by-one linear search code is only used for small  
arrays and for platforms without SIMD support.  
  
Suggested-by: John Naylor  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/20231129171526.GA857928%40nathanxps13  

M src/include/port/pg_lfind.h

Propagate pathkeys from CTEs up to the outer query.

commit   : a65724dfa73db8b451d0c874a9161935a34a914e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 13:05:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 13:05:49 -0400    

Click here for diff

If we know the sort order of a CTE's output, and it is relevant  
to the outer query, label the CTE's outer-query access path using  
those pathkeys.  This may enable optimizations such as avoiding  
a sort in the outer query.  
  
The code for hoisting pathkeys into the outer query already exists  
for regular RTE_SUBQUERY subqueries, but it wasn't getting used for  
CTEs, possibly out of concern for maintaining an optimization fence  
between the CTE and the outer query.  However, on the same arguments  
used for commit f7816aec2, there seems no harm in letting the outer  
query know what the inner query decided to do.  
  
In support of this, we now remember the best Path as well as Plan  
for each subquery for the rest of the planner run.  There may be  
future applications for having that at hand, and it surely costs  
little to build one more List.  
  
Richard Guo (minor mods by me)  
  
Discussion: https://postgr.es/m/CAMbWs49xYd3f8CrE8-WW3--dV1zH_sDSDn-vs2DzHj81Wcnsew@mail.gmail.com  

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

C comment: mention no doc for negative start of substring(text)

commit   : e648e77e25708874196326b6e4da30e7717156ab    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Mar 2024 12:27:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Mar 2024 12:27:41 -0400    

Click here for diff

Also add URL to hackers discussion.  
  
Backpatch-through: master  

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

Allow "make check"-style testing to work with musl C library.

commit   : 8a92b70c11ba2b5f0d2b2611d9453dd90f618629    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 11:44:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2024 11:44:49 -0400    

Click here for diff

The musl dynamic linker saves a pointer to the process' environment  
value of LD_LIBRARY_PATH very early in startup.  When we move/clobber  
the environment to make more room for ps status strings, we clobber  
that value and thereby prevent libraries from being found via  
LD_LIBRARY_PATH, which breaks the use of a temporary installation  
for testing purposes.  To fix, stop collecting usable space for  
ps status if we notice that the variable we are about to clobber  
is LD_LIBRARY_PATH.  This will result in some reduction in how long  
the ps status can be, but it's only likely to occur in temporary  
test contexts, so it doesn't seem like a big problem.  In any case,  
we don't have to do it if we see we are on glibc, which surely is  
where the majority of our Linux testing is done.  
  
Thomas Munro, Bruce Momjian, and Tom Lane, per report from Wolfgang  
Walther.  Back-patch to all supported branches, with the hope that  
we'll set up a buildfarm animal to test on this platform.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove ObjectClass type

commit   : 89e5ef7e21812916c9cf9fcf56e45f0f74034656    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2024 08:51:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2024 08:51:18 +0100    

Click here for diff

ObjectClass is an enum whose values correspond to catalog OIDs.  But  
the extra layer of redirection, which is used only in small parts of  
the code, and the similarity to ObjectType, are confusing and  
cumbersome.  
  
One advantage has been that some switches processing the OCLASS enum  
don't have "default:" cases.  This is so that the compiler tells us  
when we fail to add support for some new object class.  But you can  
also handle that with some assertions and proper test coverage.  It's  
not even clear how strong this benefit is.  For example, in  
AlterObjectNamespace_oid(), you could still put a new OCLASS into the  
"ignore object types that don't have schema-qualified names" case, and  
it might or might not be wrong.  Also, there are already various  
OCLASS switches that do have a default case, so it's not even clear  
what the preferred coding style should be.  
  
Reviewed-by: jian he <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw%40mail.gmail.com  

M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/include/catalog/dependency.h
M src/include/commands/event_trigger.h
M src/tools/pgindent/typedefs.list

Message fixes for pg_createsubscriber

commit   : 8c4f2d5475b9f0411baf38590c054ba1fb566780    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2024 08:22:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2024 08:22:46 +0100    

Click here for diff

Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_basebackup/pg_createsubscriber.c

Fix inconsistent function prototypes with function definitions.

commit   : a0e22ef9114b016827118cb5316af2f02d3ff4b0    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 26 Mar 2024 13:13:26 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 26 Mar 2024 13:13:26 +0900    

Click here for diff

Introduced by 30e144287a.  
  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAD21AoCaDT%2B-ZaVjbtvumms0tyyHPNLELK2UX-MLG9XCgioaNw%40mail.gmail.com  

M src/include/access/tidstore.h

Fix a calculation in TidStoreCreate().

commit   : 4edb37e322a64b1c9edd7f0da6fa7cda4541a67c    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 26 Mar 2024 13:06:06 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 26 Mar 2024 13:06:06 +0900    

Click here for diff

Since we expect that the max_bytes is in bytes, not in kilobytes, it  
should not be multiplied by 1024.  
  
Introduced by 30e144287a.  
  
Reported-by: John Naylor, David Rowley  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CANWCAZZTE-14ofsucofTuhFsfuDGBNf%3DNZb22TMYT8bxA41oQQ%40mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvojg82NDaDEpj1WEZSbVTafj%3DDRmW%2BFrkBdW8ScL4OFxA%40mail.gmail.com  

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

Avoid edge case in pg_visibility test with small shared_buffers

commit   : 3a4837fc809a8656374959049f3ac7a09a711334    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2024 19:58:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2024 19:58:10 -0700    

Click here for diff

Since 82a4edabd27 we can bulk extend relations. The bulk relation extension  
logic has a heuristic component. Normally the heurstic does not trigger in the  
occasionally-failing test case, as the relation is only extended once. But  
with very small shared_buffers the limits for the number of buffers pinned at  
once prevent the extension from happening at once. With the second "bulk"  
extension, the heuristic kicks in, and the relation ends up one block bigger.  
That's ok from a correctness perspective, but changes the results of the test  
query due to one additional block.  
  
We discussed a few more expansive fixes, but for now have decided to avoid  
this by making the table a bit smaller.  
  
Author: Heikki Linnakangas <[email protected]>  
Reported-by:  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the new relation extension logic was added  

M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql

Improve error message for tts_(virtual|minimal)_is_current_xact_tuple

commit   : 41d3780d3d29acd7e0a7a6922f2757243e9186d0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:55:22 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:55:22 +0200    

Click here for diff

Discussion: https://postgr.es/m/CALT9ZEHNeagO5PLb4Nv9J_ZaCtp%2BArdVmbSLc0RHUzx_RPAa4w%40mail.gmail.com  
Author: Pavel Borisov  

M src/backend/executor/execTuples.c

Add comments on some MinimalTupleSlots methods usage

commit   : 10baee0c95d15f70c0c2b0e52640651777ce806d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:53:34 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:53:34 +0200    

Click here for diff

Discussion: https://postgr.es/m/CALT9ZEHNeagO5PLb4Nv9J_ZaCtp%2BArdVmbSLc0RHUzx_RPAa4w%40mail.gmail.com  
Author: Pavel Borisov  

M src/backend/executor/execTuples.c

ci: macos: Choose python version

commit   : c6f09e188bbc5df8fd96682ba19e96f19d137eb2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2024 13:06:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2024 13:06:58 -0700    

Click here for diff

The CI base image used to have a python3 with headers etc installed in PATH,  
but doesn't anymore. Instead of relying on a specific version in the base  
image, explicitly install one ourselves.  
  
On 16 and HEAD this lead to a build without python support, but on 15 CI  
failed, due to explicitly enabled python3 support.  

M .cirrus.tasks.yml

Add EvalPlanQual delete returning isolation test

commit   : 8ffc2aa720a2bdef33b16609ed4f8ed07932c141    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:28:05 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:28:05 +0200    

Click here for diff

Author: Andres Freund  
Reviewed-by: Pavel Borisov  
Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdua-YFw3XTprfutzGp28xXLigFtzNbuFY8yPhqeq6X5kg%40mail.gmail.com  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Allow locking updated tuples in tuple_update() and tuple_delete()

commit   : 87985cc9252296f11db3cacc155e8d710d2e9b9c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:27:56 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Mar 2024 01:27:56 +0200    

Click here for diff

Currently, in read committed transaction isolation mode (default), we have the  
following sequence of actions when tuple_update()/tuple_delete() finds  
the tuple updated by the concurrent transaction.  
  
1. Attempt to update/delete tuple with tuple_update()/tuple_delete(), which  
   returns TM_Updated.  
2. Lock tuple with tuple_lock().  
3. Re-evaluate plan qual (recheck if we still need to update/delete and  
   calculate the new tuple for update).  
4. Second attempt to update/delete tuple with tuple_update()/tuple_delete().  
   This attempt should be successful, since the tuple was previously locked.  
  
This commit eliminates step 2 by taking the lock during the first  
tuple_update()/tuple_delete() call.  The heap table access method saves some  
effort by checking the updated tuple once instead of twice.  Future  
undo-based table access methods, which will start from the latest row version,  
can immediately place a lock there.  
  
Also, this commit makes tuple_update()/tuple_delete() optionally save the old  
tuple into the dedicated slot.  That saves efforts on re-fetching tuples in  
certain cases.  
  
The code in nodeModifyTable.c is simplified by removing the nested switch/case.  
  
Discussion: https://postgr.es/m/CAPpHfdua-YFw3XTprfutzGp28xXLigFtzNbuFY8yPhqeq6X5kg%40mail.gmail.com  
Reviewed-by: Aleksander Alekseev, Pavel Borisov, Vignesh C, Mason Sharp  
Reviewed-by: Andres Freund, Chris Travers  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/trigger.h

Refactor predicate_{implied,refuted}_by_simple_clause.

commit   : c7076ba6ad1c2dc2ed50496b7ec71daebfe5327c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2024 17:45:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2024 17:45:15 -0400    

Click here for diff

Put the node-type-dependent operations into switches on nodeTag.  
This should ease addition of new proof rules for other expression  
node types.  There is no functional change, although some tests  
are made in a different order than before.  
  
Also, add a couple of new cross-checks in test_predtest.c.  
  
James Coleman (part of a larger patch series)  
  
Discussion: https://postgr.es/m/CAAaqYe8Bo4bf_i6qKj8KBsmHMYXhe3Xt6vOe3OBQnOaf3_XBWg@mail.gmail.com  

M src/backend/optimizer/util/predtest.c
M src/test/modules/test_predtest/test_predtest.c

Clarify comment for LogicalTapeSetBlocks().

commit   : bc5fcaa289a92941a1c7b191c7c9311bd742e172    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 25 Mar 2024 11:51:44 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 25 Mar 2024 11:51:44 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

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

Adjust pgbench option for debug mode.

commit   : 3ff01b2b6e7e8627b191a2c8c2690c8ea2f0820d    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 25 Mar 2024 11:08:53 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 25 Mar 2024 11:08:53 -0500    

Click here for diff

Many other utilities use -d to specify the database to use, but  
pgbench uses it to enable debug mode.  This is causing some users  
to accidentally enable it.  This commit changes -d to accept the  
database name and introduces --dbname.  Debug mode can still be  
enabled with --debug.  This is a backward-incompatible change, but  
it has been judged to be worth the trade-off, i.e., some scripts  
that use pgbench will need to be updated.  
  
Author: Greg Sabino Mullane  
Reviewed-by: Tomas Vondra, Euler Taveira, Alvaro Herrera, David Christensen  
Discussion: https://postgr.es/m/CAKAnmmLjAzwVtb%3DVEaeuCtnmOLpzkJ1uJ_XiQ362YdD9B72HSg%40mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Allow specifying an access method for partitioned tables

commit   : 374c7a2290429eac3217b0c7b0b485db9c2bcc72    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Mar 2024 16:30:36 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Mar 2024 16:30:36 +0100    

Click here for diff

It's now possible to specify a table access method via  
CREATE TABLE ... USING for a partitioned table, as well change it with  
ALTER TABLE ... SET ACCESS METHOD.  Specifying an AM for a partitioned  
table lets the value be used for all future partitions created under it,  
closely mirroring the behavior of the TABLESPACE option for partitioned  
tables.  Existing partitions are not modified.  
  
For a partitioned table with no AM specified, any new partitions are  
created with the default_table_access_method.  
  
Also add ALTER TABLE ... SET ACCESS METHOD DEFAULT, which reverts to the  
original state of using the default for new partitions.  
  
The relcache of partitioned tables is not changed: rd_tableam is not  
set, even if a partitioned table has a relam set.  
  
Author: Justin Pryzby <[email protected]>  
Author: Soumyadeep Chakraborty <[email protected]>  
Author: Michaël Paquier <[email protected]>  
Reviewed-by: The authors themselves  
Discussion: https://postgr.es/m/CAE-ML+9zM4wJCGCBGv01k96qQ3gFv4WFcFy=zqPHKeaEFwwv6A@mail.gmail.com  
Discussion: https://postgr.es/m/20210308010707.GA29832%40telsasoft.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/pg_class.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

Fix typo in comment

commit   : b8528fe026b18976b5d5b4fcb066a8a55def3375    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:49:17 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:49:17 +0100    

Click here for diff

Spotted while reviewing a patch changing things around this area.  

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

doc: Document error handling in PGTYPESnumeric_to_long

commit   : 68174679fea2d514e9281fddd826abaccfac5bf7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:39 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:39 +0100    

Click here for diff

The documentation for PGTYPESnumeric_to_long only mentioned errno  
being set to indicate overflow but the code also sets errno when  
underflow happens.  
  
Reported-by: Aidar Imamov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml

ecpg: Fix return code for overflow in numeric conversion

commit   : b2d6b4c728a282f9bbe9ff4fac02a872bef074dd    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:36 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:36 +0100    

Click here for diff

The decimal conversion functions dectoint and dectolong are documented  
to return ECPG_INFORMIX_NUM_OVERFLOW in case of overflows, but always  
returned -1 on all errors due to incorrectly checking the returnvalue  
from the PGTYPES* functions.  
  
Author: Aidar Imamov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/test/expected/compat_informix-dec_test.stdout

Fix indentation from a11f330b5

commit   : 64e401b62b1559d617db5c1e1070d7a05e794c27    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:33 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Mar 2024 14:18:33 +0100    

Click here for diff

Per buildfarm animal koel  

M src/backend/replication/slot.c

Merge prune, freeze and vacuum WAL record formats

commit   : f83d709760d84253b539ee454ce9ce1ceb9ad9ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2024 14:59:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2024 14:59:58 +0200    

Click here for diff

The new combined WAL record is now used for pruning, freezing and 2nd  
pass of vacuum. This is in preparation for changing VACUUM to write a  
combined prune+freeze record per page, instead of separate two  
records. The new WAL record format now supports that, but the code  
still always writes separate records for pruning and freezing.  
  
This reserves separate XLOG_HEAP2_* info codes for when the pruning  
record is emitted for on-access pruning or VACUUM, per Peter  
Geoghegan's suggestion. The record format is identical, but having  
separate info codes makes it easier analyze pruning and vacuuming with  
pg_waldump.  
  
The function to emit the new WAL record, log_heap_prune_and_freeze(),  
is in pruneheap.c. The existing heap_log_freeze_plan() and its  
subroutines are moved to pruneheap.c without changes, to keep them  
together with log_heap_prune_and_freeze().  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAKRu_azf-zH%[email protected]  
Discussion: https://www.postgresql.org/message-id/CAAKRu_b2oE4GL%3Dq4g9mcByS9yT7wTQvEH9OLpabj28e%[email protected]  

M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/replication/logical/decode.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/xlog_internal.h
M src/tools/pgindent/typedefs.list

pg_createsubscriber: creates a new logical replica from a standby server

commit   : d44032d0146306971cd5ccf232fe37269717d6f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2024 12:30:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2024 12:30:55 +0100    

Click here for diff

It must be run on the target server and should be able to connect to  
the source server (publisher) and the target server (subscriber).  All  
tables in the specified database(s) are included in the logical  
replication setup.  A pair of publication and subscription objects are  
created for each database.  
  
The main advantage of pg_createsubscriber over the common logical  
replication setup is the initial data copy.  It also reduces the  
catchup phase.  
  
Some prerequisites must be met to successfully run it.  It is  
basically the logical replication requirements.  It starts creating a  
publication using FOR ALL TABLES and a replication slot for each  
specified database.  Write recovery parameters into the target data  
directory and start the target server.  It specifies the LSN of the  
last replication slot (replication start point) up to which the  
recovery will proceed.  Wait until the target server is promoted.  
Create one subscription per specified database (using publication and  
replication slot created in a previous step) on the target server.  
Set the replication progress to the replication start point for each  
subscription.  Enable the subscription for each specified database on  
the target server.  And finally, change the system identifier on the  
target server.  
  
Author: Euler Taveira <[email protected]>  
Reviewed-by: Hayato Kuroda <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Shlok Kyal <[email protected]>  
Reviewed-by: Vignesh C <[email protected]>  
Reviewed-by: Shubham Khanna <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/pg_createsubscriber.sgml
M doc/src/sgml/reference.sgml
M src/bin/pg_basebackup/.gitignore
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/nls.mk
A src/bin/pg_basebackup/pg_createsubscriber.c
A src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

Track last_inactive_time in pg_replication_slots.

commit   : a11f330b5584f2430371d68871e00f5c63735299    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 25 Mar 2024 16:34:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 25 Mar 2024 16:34:33 +0530    

Click here for diff

This commit adds a new property called last_inactive_time for slots. It is  
set to 0 whenever a slot is made active/acquired and set to the current  
timestamp whenever the slot is inactive/released or restored from the disk.  
Note that we don't set the last_inactive_time for the slots currently being  
synced from the primary to the standby because such slots are typically  
inactive as decoding is not allowed on those.  
  
The 'last_inactive_time' will be useful on production servers to debug and  
analyze inactive replication slots. It will also help to know the lifetime  
of a replication slot - one can know how long a streaming standby, logical  
subscriber, or replication slot consumer is down.  
  
The 'last_inactive_time' will also be useful to implement inactive  
timeout-based replication slot invalidation in a future commit.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik  
Discussion: https://www.postgresql.org/message-id/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/recovery/t/019_replslot_limit.pl
M src/test/regress/expected/rules.out

Code review for 6190d828cd2

commit   : 0f7863afef67e462574fe5af6317e26a2f2d47fb    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 19:43:29 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 19:43:29 +0900    

Click here for diff

* Fix the comment of init_dummy_sjinfo() to remove references to  
  non-existing parameters 'rel1' and 'rel2'.  
  
* Adjust consider_new_or_clause() to call init_dummy_sjinfo() to make  
  up a SpecialJoinInfo for inner joins like other code sites that  
  were adjusted in 6190d828cd2 to do so.  
  
Author: Richard Guo <[email protected]>  
Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAExHW5tHqEf3ASVqvFFcghYGPfpy7o3xnvhHwBGbJFMRH8KjNw@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/orclauses.c

reindexdb: Fix warning about uninitialized indices_tables_cell

commit   : cc0e7ebd304a24815c0531000a4c3693878cd96c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2024 11:35:30 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2024 11:35:30 +0200    

Click here for diff

Initialize indices_tables_cell with NULL to silence the warning.  Also,  
refactor the place of the first assignment of indices_tables_cell.  
  
Reported-by: Thomas Munro, David Rowley, Tom Lane, Richard Guo  
Discussion: https://postgr.es/m/2348025.1711332418%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/E1roXs4-005UdX-1V%40gemulon.postgresql.org  

M src/bin/scripts/reindexdb.c

Do not translate dummy SpecialJoinInfos for child joins

commit   : 6190d828cd25ae20c0a8548765a0e1b880f1f66d    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 17:26:27 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 17:26:27 +0900    

Click here for diff

This teaches build_child_join_sjinfo() to create the dummy  
SpecialJoinInfos (those created for inner joins) directly for a given  
child join, skipping the unnecessary overhead of translating the  
parent joinrel's SpecialJoinInfo.  
  
To that end, this commit moves the code to initialize the dummy  
SpecialJoinInfos to a new function named init_dummy_sjinfo() and  
changes the few existing sites that have this code and  
build_child_join_sjinfo() to call this new function.  
  
Author: Ashutosh Bapat <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Andrey Lepikhov <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CAExHW5tHqEf3ASVqvFFcghYGPfpy7o3xnvhHwBGbJFMRH8KjNw@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinrels.c
M src/include/optimizer/paths.h

Reduce memory used by partitionwise joins

commit   : 5278d0a2e870c61f9374a7796b90e6f9f6a73638    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 12:02:40 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 25 Mar 2024 12:02:40 +0900    

Click here for diff

Specifically, this commit reduces the memory consumed by the  
SpecialJoinInfos that are allocated for child joins in  
try_partitionwise_join() by freeing them at the end of creating paths  
for each child join.  
  
A SpecialJoinInfo allocated for a given child join is a copy of the  
parent join's SpecialJoinInfo, which contains the translated copies  
of the various Relids bitmapsets and semi_rhs_exprs, which is a List  
of Nodes.  The newly added freeing step frees the struct itself and  
the various bitmapsets, but not semi_rhs_exprs, because there's no  
handy function to free the memory of Node trees.  
  
Author: Ashutosh Bapat <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Andrey Lepikhov <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CAExHW5tHqEf3ASVqvFFcghYGPfpy7o3xnvhHwBGbJFMRH8KjNw@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h

make dist uses git archive

commit   : 619bc23a1a2f3750ac3668fe5a7564bc51e01684    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2024 06:28:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2024 06:28:19 +0100    

Click here for diff

This changes "make dist" to directly use "git archive", rather than  
the custom shell script it currently runs.  
  
This is to make the creation of the distribution tarball more directly  
traceable to the git repository.  That is why we removed the "make  
distprep" step.  
  
"make dist" continues to produce a .gz and a .bz2 tarball as before.  
  
The archives produced this way are deterministic and reproducible,  
meaning for a given commit the result file should always be  
bit-for-bit identical.  The exception is that if you use a git version  
older than 2.38.0, gzip records the platform in the archive, so you'd  
get a different output on Windows vs. macOS vs. "UNIX" (everything  
else).  In git 2.38.0, this was changed so that everything is recorded  
as "UNIX" now.  This is just something to keep in mind.  This issue is  
specific to the gzip format, it does not affect other compression  
formats.  
  
Meson has its own distribution building command (meson dist), but we  
are not using that at this point.  The main problem is that, the way  
they have implemented it, it is not deterministic in the above sense.  
Also, we want a "make" version for the time being.  But the target  
name "dist" in meson is reserved for that reason, so we call the  
custom target "pgdist" (so call something like "meson compile -C build  
pgdist").  
  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/40e80f77-a294-4f29-a16f-e21bc7bc75fc%40eisentraut.org  

M GNUmakefile.in
M meson.build

Fix potential integer handling issue in radixtree.h.

commit   : 80d5d4937c168af46c976feebe24765ad76eb540    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 25 Mar 2024 12:06:41 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 25 Mar 2024 12:06:41 +0900    

Click here for diff

Coverity complained about the integer handling issue; if we start with  
an arbitrary non-negative shift value, the loop may decrement it down  
to something less than zero before exiting. This commit adds an  
assertion to make sure the 'shift' is always 0 after the loop, and  
uses 0 as the shift to get the key chunk in the following operation.  
  
Introduced by ee1b30f12.  
  
Reported-by: Tom Lane as per coverity  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/2089517.1711299216%40sss.pgh.pa.us  

M src/include/lib/radixtree.h

Allow planner to use Merge Append to efficiently implement UNION

commit   : 66c0185a3d14bbbf51d0fc9d267093ffec735231    
  
author   : David Rowley <[email protected]>    
date     : Mon, 25 Mar 2024 14:31:14 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 25 Mar 2024 14:31:14 +1300    

Click here for diff

Until now, UNION queries have often been suboptimal as the planner has  
only ever considered using an Append node and making the results unique  
by either using a Hash Aggregate, or by Sorting the entire Append result  
and running it through the Unique operator.  Both of these methods  
always require reading all rows from the union subqueries.  
  
Here we adjust the union planner so that it can request that each subquery  
produce results in target list order so that these can be Merge Appended  
together and made unique with a Unique node.  This can improve performance  
significantly as the union child can make use of the likes of btree  
indexes and/or Merge Joins to provide the top-level UNION with presorted  
input.  This is especially good if the top-level UNION contains a LIMIT  
node that limits the output rows to a small subset of the unioned rows as  
cheap startup plans can be used.  
  
Author: David Rowley  
Reviewed-by: Richard Guo, Andy Fan  
Discussion: https://postgr.es/m/CAApHDvpb_63XQodmxKUF8vb9M7CxyUyT4sWvEgqeQU-GB7QFoQ@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
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/prep/prepunion.c
M src/backend/parser/analyze.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/prep.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/union.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/union.sql

reindexdb: Add the index-level REINDEX with multiple jobs

commit   : 47f99a407de224df6f9c43697d0a9c0a5598b250    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2024 02:07:14 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2024 02:07:14 +0200    

Click here for diff

Straight-forward index-level REINDEX is not supported with multiple jobs as  
we cannot control the concurrent processing of multiple indexes depending on  
the same relation.  Instead, we dedicate the whole table to certain reindex  
job.  Thus, if indexes in the lists belong to different tables, that gives us  
a fair level of parallelism.  
  
This commit teaches get_parallel_object_list() to fetch table names for  
indexes in the case of index-level REINDEX.  The same tables are grouped  
together in the output order, and the list of indexes is also rebuilt to  
match that order.  Later during processingof that list, we push indexes  
belonging to the same table into the same job.  
  
Discussion: https://postgr.es/m/CACG%3DezZU_VwDi-1PN8RUSE6mcYG%2BYx1NH_rJO4%2BKe-mKqLp%3DNw%40mail.gmail.com  
Author: Maxim Orlov, Svetlana Derevyanko, Alexander Korotkov  
Reviewed-by: Michael Paquier  

M doc/src/sgml/ref/reindexdb.sgml
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl

Fix convert_case(), introduced in 5c40364dd6.

commit   : 503c0ad976f5e4ada2d1b47ae05aa7133351b645    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 24 Mar 2024 16:28:34 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 24 Mar 2024 16:28:34 -0700    

Click here for diff

Check source length before checking for NUL terminator to avoid  
reading one byte past the string end. Also fix unreachable bug when  
caller does not expect NUL-terminated result.  
  
Add unit test coverage of convert_case() in case_test.c, which makes  
it easier to reproduce the valgrind failure.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Alexander Lakhin  

M src/common/unicode/case_test.c
M src/common/unicode_case.c

doc: Clarify requirements for SET ROLE.

commit   : 3330a8d1b792375ae3f7dffb7eb0a45c907cbc72    
  
author   : Nathan Bossart <[email protected]>    
date     : Sun, 24 Mar 2024 15:23:55 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Sun, 24 Mar 2024 15:23:55 -0500    

Click here for diff

Since commit 3d14e171e9, SET ROLE has required the current session  
user to have membership with the SET option in the target role, but  
the SET ROLE documentation only mentions the membership  
requirement.  This commit adds this important detail to the SET  
ROLE page.  
  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/CA%2BRLCQysHtME0znk2KUMJN343ksboSRQSU-hCnOjesX6VK300Q%40mail.gmail.com  
Backpatch-through: 16  

M doc/src/sgml/ref/set_role.sgml

Allow more cases to pass the unsafe-use-of-new-enum-value restriction.

commit   : af1d3958432c9438c4ec168bd16bdf9a91066a9f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 14:30:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 14:30:29 -0400    

Click here for diff

Up to now we've rejected cases like  
  
BEGIN;  
CREATE TYPE rainbow AS ENUM ();  
ALTER TYPE rainbow ADD VALUE 'red';  
-- use the value 'red', perhaps in a constraint or index  
COMMIT;  
  
The concern is that the uncommitted enum value 'red' might get into  
an index and then break the index if we roll back the ALTER ADD.  
If the ALTER is in the same transaction as the CREATE then it's really  
perfectly safe, but we weren't taking the trouble to identify that.  
  
pg_dump in binary-upgrade mode will emit enum definitions that look  
like the above, which up to now didn't fall foul of the unsafe-usage  
check because we processed each restore command as a separate  
transaction.  However an upcoming patch proposes to bundle the restore  
commands into large transactions to reduce XID consumption during  
pg_upgrade, and that makes this behavior a problem.  
  
To fix, remember the OIDs of enum types created in the current  
transaction, and allow use of enum values that are added to one later  
in the same transaction.  To do this fully correctly in the presence  
of subtransactions, we'd have to track subtransaction nesting level of  
the CREATE and do maintenance work at every subsequent subtransaction  
exit.  That seems expensive, and we don't need it to satisfy pg_dump's  
usage.  Hence, apply the additional optimization only when the CREATE  
and ALTER are at outermost transaction level.  
  
Patch by me, reviewed by Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_enum.c
M src/backend/utils/adt/enum.c
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Release PQconninfoOptions array in GetDbnameFromConnectionOptions().

commit   : d37e0d0c50ee560fa2e7dc2a4dc904a885957985    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 12:31:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 12:31:05 -0400    

Click here for diff

It wasn't getting freed in one code path, which Coverity identified as  
a resource leak.  It's probably of little consequence, but re-ordering  
the code into the correct sequence is no more work than dismissing the  
complaint.  Minor oversight in commit a145f424d.  
  
While here, improve the unreasonably clunky coding of  
FindDbnameInConnParams: use of an output parameter is unnecessary  
and prone to uninitialized-variable problems.  

M src/bin/pg_basebackup/streamutil.c

Release temporary array in check_for_data_types_usage().

commit   : 225e1dde463ae312714d71a929f45cfd153df2be    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 12:13:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2024 12:13:35 -0400    

Click here for diff

Coverity identified this as a resource leak.  It's surely of no  
consequence given that the function is called only once per run, but  
freeing the storage is no more work than dismissing the complaint.  
Minor oversight in commit 347758b12.  

M src/bin/pg_upgrade/check.c

ci: freebsd repartition script didn't copy .git directory

commit   : fc2d260c7e6236fe2447dad0f8415e72f4be66a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2024 08:41:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2024 08:41:14 +0100    

Click here for diff

We need a slightly different "cp" incantation to make sure top-level  
"dot" files, such as ".git", are also copied.  
  
This is relevant for example if a script wants to execute a git  
command.  This currently does not happen, but it has come up while  
testing other patches.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/40e80f77-a294-4f29-a16f-e21bc7bc75fc%40eisentraut.org  

M src/tools/ci/gcp_freebsd_repartition.sh

Add temporal FOREIGN KEY contraints

commit   : 34768ee361656841a122f1c8d52a2ad753612feb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2024 07:37:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2024 07:37:13 +0100    

Click here for diff

Add PERIOD clause to foreign key constraint definitions.  This is  
supported for range and multirange types.  Temporal foreign keys check  
for range containment instead of equality.  
  
This feature matches the behavior of the SQL standard temporal foreign  
keys, but it works on PostgreSQL's native ranges instead of SQL's  
"periods", which don't exist in PostgreSQL (yet).  
  
Reference actions ON {UPDATE,DELETE} {CASCADE,SET NULL,SET DEFAULT}  
are not supported yet.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/expected/without_overlaps.out
M contrib/btree_gist/sql/without_overlaps.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/pg_constraint.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/without_overlaps.out
M src/test/regress/sql/without_overlaps.sql

amcheck: Normalize index tuples containing uncompressed varlena

commit   : b1fe8efdf17eb4877f7c4c31c85111ec740ad872    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 23 Mar 2024 23:00:06 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 23 Mar 2024 23:00:06 +0200    

Click here for diff

It might happen that the varlena value wasn't compressed by index_form_tuple()  
due to current storage parameters.  If compression is currently enabled, we  
need to compress such values to match index tuple coming from the heap.  
  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru  
Author: Andrey Borodin  
Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov  
Backpatch-through: 12  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c

amcheck: Support for different header sizes of short varlena datum

commit   : ab65dfb0fb2908989c0ef3330464b7af171e9728    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 23 Mar 2024 22:59:56 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 23 Mar 2024 22:59:56 +0200    

Click here for diff

In the heap, tuples may contain short varlena datum with both 1B header and 4B  
headers.  But the corresponding index tuple should always have such varlena's  
with 1B headers.  So, for fingerprinting, we need to convert.  
  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru  
Author: Michael Zhilin  
Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov  
Backpatch-through: 12  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c

Revert "Add notBefore and notAfter to SSL cert info display"

commit   : 697f8d266cfb33409f7ccf3319f4448477066329    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Mar 2024 22:58:41 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Mar 2024 22:58:41 +0100    

Click here for diff

This reverts commit 6acb0a628eccab8764e0306582c2b7e2a1441b9b since  
LibreSSL didn't support ASN1_TIME_diff until OpenBSD 7.1, leaving  
the older OpenBSD animals in the buildfarm complaining.  
  
Per plover in the buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sslinfo/Makefile
M contrib/sslinfo/meson.build
D contrib/sslinfo/sslinfo–1.2–1.3.sql
M contrib/sslinfo/sslinfo.c
M contrib/sslinfo/sslinfo.control
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/test/regress/expected/rules.out
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl
M src/tools/pgindent/typedefs.list

Use a hash table for catcache.c's CatCList objects.

commit   : 473182c9523afad10e9507145690d902a0bc7f04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2024 17:13:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2024 17:13:53 -0400    

Click here for diff

Up to now, all of the "catcache list" objects within a catalog cache  
were just chained together on a single dlist, requiring O(N) time to  
search.  Remarkably, we've not had serious performance problems with  
that so far; but we got a complaint of a bad performance regression  
from v15 in a case with a large number of roles in the system, which  
traced down to O(N^2) total time when we probed N catcache lists.  
  
Replace that data structure with a hashtable having an enlargeable  
number of dlists, in an exactly parallel way to the data structure  
we've used for years for the plain CatCTup cache members.  The extra  
cost of maintaining a hash table seems negligible, since we were  
already computing a hash value for list searches.  
  
Normally this'd be HEAD-only material, but in view of the performance  
regression it seems advisable to back-patch into v16.  In the v16  
version of the patch, leave the dead cc_lists field where it is and  
add the new fields at the end of struct catcache, to avoid possible  
ABI breakage in case any external code is looking at these structs.  
(We assume no external code is actually allocating new catcache  
structs.)  
  
Per report from alex work.  
  
Discussion: https://postgr.es/m/CAGvXd3OSMbJQwOSc-Tq-Ro1CAz=vggErdSG7pv2s6vmmTOLJSg@mail.gmail.com  

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

Add notBefore and notAfter to SSL cert info display

commit   : 6acb0a628eccab8764e0306582c2b7e2a1441b9b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Mar 2024 21:25:25 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Mar 2024 21:25:25 +0100    

Click here for diff

This adds the X509 attributes notBefore and notAfter to sslinfo  
as well as pg_stat_ssl to allow verifying and identifying the  
validity period of the current client certificate. OpenSSL has  
APIs for extracting notAfter and notBefore, but they are only  
supported in recent versions so we have to calculate the dates  
by hand in order to make this work for the older versions of  
OpenSSL that we still support.  
  
Original patch by Cary Huang with additional hacking by Jacob  
and myself.  
  
Author: Cary Huang <[email protected]>  
Co-author: Jacob Champion <[email protected]>  
Co-author: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sslinfo/Makefile
M contrib/sslinfo/meson.build
A contrib/sslinfo/sslinfo–1.2–1.3.sql
M contrib/sslinfo/sslinfo.c
M contrib/sslinfo/sslinfo.control
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/test/regress/expected/rules.out
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl
M src/tools/pgindent/typedefs.list

Fix an oversight in refactoring in 06b10f80ba4.

commit   : b670b93a66fc554714e0fe8e51a944912bb9fd68    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 22 Mar 2024 15:25:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 22 Mar 2024 15:25:53 +0200    

Click here for diff

It was against intended skipping prechecking keys optimization in the  
first page of range queries to not influence point queries performance.  
  
Reported-by: Anton Melnikov  
Discussion: https://postgr.es/m/30cd7524-b9f1-4cf8-9c4a-223eb2e34441%40postgrespro.ru  
Author: Pavel Borisov  

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

Do not output actual value of location fields in node serialization by default

commit   : d20d8fbd3e4d327dd0778a02d5661b51f4f6423a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 09:13:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 09:13:35 +0100    

Click here for diff

This changes nodeToString() to not output the actual value of location  
fields in nodes, but instead it writes -1.  This mirrors the fact that  
stringToNode() also does not read location field values but always  
stores -1.  
  
For most uses of nodeToString(), which is to store nodes in catalog  
fields, this is more useful.  We don't store original query texts in  
catalogs, so any lingering query location values are not meaningful.  
  
For debugging purposes, there is a new nodeToStringWithLocations(),  
which mirrors the existing stringToNodeWithLocations().  This is used  
for WRITE_READ_PARSE_PLAN_TREES and nodes/print.c functions, which  
covers all the debugging uses.  
  
Reviewed-by: Matthias van de Meent <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEze2WgrCiR3JZmWyB0YTc8HV7ewRdx13j0CqD6mVkYAW+SFGQ@mail.gmail.com  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/tcop/postgres.c
M src/include/nodes/nodes.h

Track invalidation_reason in pg_replication_slots.

commit   : 6ae701b4378db2284c77314560e95a93d0ba9484    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 22 Mar 2024 13:52:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 22 Mar 2024 13:52:05 +0530    

Click here for diff

Till now, the reason for replication slot invalidation is not tracked  
directly in pg_replication_slots. A recent commit 007693f2a3 added  
'conflict_reason' to show the reasons for slot conflict/invalidation, but  
only for logical slots.  
  
This commit adds a new column 'invalidation_reason' to show invalidation  
reasons for both physical and logical slots. And, this commit also turns  
'conflict_reason' text column to 'conflicting' boolean column (effectively  
reverting commit 007693f2a3). The 'conflicting' column is true for  
invalidation reasons 'rows_removed' and 'wal_level_insufficient' because  
those make the slot conflict with recovery. When 'conflicting' is true,  
one can now look at the new 'invalidation_reason' column for the reason  
for the logical slot's conflict with recovery.  
  
The new 'invalidation_reason' column will also be useful to track other  
invalidation reasons in the future commit.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik  
Discussion: https://www.postgresql.org/message-id/ZfR7HuzFEswakt/a%40ip-10-97-1-34.eu-west-3.compute.internal  
Discussion: https://www.postgresql.org/message-id/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com  

M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/bin/pg_upgrade/info.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/rules.out

Make RangeTblEntry dump order consistent

commit   : b4080fa3dcf6c6359e542169e0e81a0662c53ba8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    

Click here for diff

Put the fields alias and eref earlier in the struct, so that it  
matches the order in _outRangeTblEntry()/_readRangeTblEntry().  This  
helps if we ever want to fully automate out/read of RangeTblEntry.  
Also, it makes dumps in the debugger easier to read in the same way.  
Internally, this makes no difference.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Remove custom _jumbleRangeTblEntry()

commit   : 367c989cd8405663bb9a35ec1aa4f79b673a55ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    

Click here for diff

This is part of an effort to reduce the number of special cases in the  
automatically generated node support functions.  
  
This patch removes _jumbleRangeTblEntry() and instead adds per-field  
query_jumble_ignore annotations to match the behavior of the previous  
custom code.  The pg_stat_statements test suite has some coverage of  
this.  It gets rid of the switch on rtekind; this should be  
technically correct, since we do the equal and copy functions like  
this also.  
  
The list of fields to jumble has been checked and is considered  
correct as of 8b29a119fd.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/queryjumblefuncs.c
M src/include/nodes/parsenodes.h

Reformat some node comments

commit   : d575051b9af99f9299dc33e627931ab612d8a147    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    

Click here for diff

Reformat some comments in node field definitions to avoid long lines.  
This makes room for per-field annotations.  Similar to 835d476fd2.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/nodes/parsenodes.h

Improve comment

commit   : 1e1eb12c25c3c38d7ff70809f958e75598ec14e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    

Click here for diff

Clarify that RangeTblEntry.lateral reflects whether LATERAL was  
specified in the statement (as opposed to whether lateralness is  
implicit).  Also, the list of applicable entry types was incomplete.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/nodes/parsenodes.h

Remove obsolete comment

commit   : 83d8065b1f7477f4fb49e53ece0e6e0e516993fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2024 07:12:28 +0100    

Click here for diff

The idea to use a union in the definition of RangeTblEntry is clearly  
not being pursued.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/nodes/parsenodes.h

Avoid splitting errmsg string to span multiple lines

commit   : 085e759e9da77b7f5e859d23f72653f36277a053    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 22 Mar 2024 12:00:14 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 22 Mar 2024 12:00:14 +0900    

Click here for diff

The error message being fixed was added in 6185c9737c.  
  
While at it, add an "a" to the sentence.  
  
Reported-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/20240322.095149.895185546948714852.horikyota.ntt%40gmail.com  

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

Fix dumping role comments when using --no-role-passwords

commit   : 7e65ad197f9dff7466cea7986450f9573adb4448    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 23:31:57 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 23:31:57 +0100    

Click here for diff

Commit 9a83d56b38c added support for allowing pg_dumpall to dump  
roles without including passwords, which accidentally made dumps  
omit COMMENTs on roles.  This fixes it by using pg_authid to get  
the comment.  
  
Backpatch to all supported versions. Patch simultaneously written  
independently by Álvaro and myself.  
  
Author: Álvaro Herrera <[email protected]>  
Author: Daniel Gustafsson <[email protected]>  
Reported-by: Bartosz Chroł <[email protected]>  
Discussion: https://postgr.es/m/AS8P194MB1271CDA0ADCA7B75FCD8E767F7332@AS8P194MB1271.EURP194.PROD.OUTLOOK.COM  
Discussion: https://postgr.es/m/CAEP4nAz9V4H41_4ESJd1Gf0v%3DdevkqO1%3Dpo91jUw-GJSx8Hxqg%40mail.gmail.com  
Backpatch-through: v12  

M src/bin/pg_dump/pg_dumpall.c

Add hash support functions and hash opclass for contrib/ltree.

commit   : 485f0aa85995340fb62113448c992ee48dc6fff1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Mar 2024 18:27:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Mar 2024 18:27:49 -0400    

Click here for diff

This also enables hash join and hash aggregation on ltree columns.  
  
Tommy Pavlicek, reviewed by jian he  
  
Discussion: https://postgr.es/m/CAEhP-W9ZEoHeaP_nKnPCVd_o1c3BAUvq1gWHrq8EbkNRiS9CvQ@mail.gmail.com  

M contrib/ltree/Makefile
M contrib/ltree/expected/ltree.out
A contrib/ltree/ltree–1.2–1.3.sql
M contrib/ltree/ltree.control
M contrib/ltree/ltree_op.c
M contrib/ltree/ltreetest.sql
M contrib/ltree/meson.build
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Add TupleTableSlotOps.is_current_xact_tuple() method

commit   : 0997e0af273d80add75bcf5616eee000d0a78397    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:43 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:43 +0200    

Click here for diff

This allows us to abstract how/whether table AM uses transaction identifiers.  
A custom table AM can use a custom slot, which may not store xmin directly,  
but determine the tuple belonging to the current transaction in the other way.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov  
Reviewed-by: Nikita Malakhov, Japin Li  

M src/backend/executor/execTuples.c
M src/backend/utils/adt/ri_triggers.c
M src/include/executor/tuptable.h

Allow table AM tuple_insert() method to return the different slot

commit   : c35a3fb5e067fc95f13206418e3785d2cb059da1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:40 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:40 +0200    

Click here for diff

This allows table AM to return a native tuple slot even if  
VirtualTupleTableSlot is given as an input.  Native tuple slots have knowledge  
about system attributes, which could be accessed in the future.  
table_multi_insert() method already can modify the input 'slots' array.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov  
Reviewed-by: Nikita Malakhov, Japin Li  

M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h

Allow table AM to store complex data structures in rd_amcache

commit   : 02eb07ea89d27f1d05a5055bf779042d2953b4e7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:34 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 21 Mar 2024 23:00:34 +0200    

Click here for diff

The new table AM method free_rd_amcache is responsible for freeing all the  
memory related to rd_amcache and setting free_rd_amcache to NULL.  If the new  
method is not specified, we still assume rd_amcache to be a single chunk of  
memory, which could be just pfree'd.  
  
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com  
Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov  
Reviewed-by: Nikita Malakhov, Japin Li  

M src/backend/access/heap/heapam_handler.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h
M src/include/utils/rel.h

docs: Make claims about the benefits of HOT updates more precise.

commit   : 57184c3b5d89763c882a15adfcdb00990a09d382    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Mar 2024 12:54:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Mar 2024 12:54:58 -0400    

Click here for diff

The old text claims that HOT completely removes old row versions.  
It was unclear whether it just meant the tuples themselves, or the  
tuples together with their line pointers. If it meant the former,  
it was wrong because we can remove dead row versions even when no  
HOT updates have occurred, so it's not describing a benefit of HOT.  
If it meant the latter, it was wrong because HOT doesn't allow  
reclaiming the root tuple's line pointer.  
  
This section does seems like it's intended to be more of an  
informal introduction to HOT than a precise technical description  
of every detail of how it works, but we still don't want it to  
say things that are just not true, so update the text enough  
to avoid that.  
  
Patch by me, reviewed by James Coleman (although he would have  
preferred more extensive changes) and Shubham Khanna.  
  
Discussion: http://postgr.es/m/CA+TgmobH6DPmR-u--Xgeg8cYUwhDhypNsv38nDrAJyf_xno=TQ@mail.gmail.com  

M doc/src/sgml/storage.sgml

Revise the style of a paragraph in README.md.

commit   : 84d80663199b98db32625b80b039a07487a11b47    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 21 Mar 2024 10:16:41 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 21 Mar 2024 10:16:41 -0500    

Click here for diff

Presently, one of the lines in README.md has trailing whitespace,  
which was added by commit 363eb05996 to maintain a line break that  
was in the non-Markdown version.  Instead of changing  
.gitattributes, let's match this paragraph's style with the style  
of the following paragraph, thereby removing the trailing  
whitespace.  
  
Reported-by: Peter Eisentraut  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/c0a4e906-c6fe-4519-bd15-28dfcd03fdb2%40eisentraut.org  

M README.md

Explicitly require password for SCRAM exchange

commit   : adcdb2c8dda4fb28e373ddff41a0de6936772249    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 14:45:54 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 14:45:54 +0100    

Click here for diff

This refactors the SASL init flow to set password_needed on the two  
SCRAM exchanges currently supported. The code already required this  
but was set up in such a way that all SASL exchanges required using  
a password, a restriction which may not hold for all exchanges (the  
example at hand being the proposed OAuthbearer exchange).  
  
This was extracted from a larger patchset to introduce OAuthBearer  
authentication and authorization.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor SASL exchange to return tri-state status

commit   : 24178e235ea56aca9233e640dd7ff9b17e858b07    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 14:45:46 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Mar 2024 14:45:46 +0100    

Click here for diff

The SASL exchange callback returned state in to output variables:  
done and success.  This refactors that logic by introducing a new  
return variable of type SASLStatus which makes the code easier to  
read and understand, and prepares for future SASL exchanges which  
operate asynchronously.  
  
This was extracted from a larger patchset to introduce OAuthBearer  
authentication and authorization.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/tools/pgindent/typedefs.list

Temporarily install debugging in partition_prune test

commit   : 1db689715d44276407dc4d6fadbc11da8d391bd9    
  
author   : David Rowley <[email protected]>    
date     : Thu, 21 Mar 2024 21:21:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 21 Mar 2024 21:21:05 +1300    

Click here for diff

The buildfarm animal parula has been sporadically failing in the  
partition_prune test for the past week or so.  It appears like an  
auto-vacuum or auto-analyze has run on one of the partitions of the "ab"  
table, causing the plan to change.  This is unexpected as the table is  
empty.  
  
Here we install some telemetry to find out if this is the case.  This  
also joins in pg_index to see if something has gone wrong with the index  
which could result in the planner being unable to use that index.  
  
We can revert this once we've figured out the cause of the plan  
instability.  
  
Reported-by: Tom Lane  
Investigation-by: Tom Lane  
Discussion: https://postgr.es/m/4009739.1710878318%40sss.pgh.pa.us  

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

Add SQL/JSON query functions

commit   : 6185c9737cf48c9540782d88f12bd2912d6ca1cc    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 21 Mar 2024 17:06:27 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 21 Mar 2024 17:06:27 +0900    

Click here for diff

This introduces the following SQL/JSON functions for querying JSON  
data using jsonpath expressions:  
  
JSON_EXISTS(), which can be used to apply a jsonpath expression to a  
JSON value to check if it yields any values.  
  
JSON_QUERY(), which can be used to to apply a jsonpath expression to  
a JSON value to get a JSON object, an array, or a string.  There are  
various options to control whether multi-value result uses array  
wrappers and whether the singleton scalar strings are quoted or not.  
  
JSON_VALUE(), which can be used to apply a jsonpath expression to a  
JSON value to return a single scalar value, producing an error if it  
multiple values are matched.  
  
Both JSON_VALUE() and JSON_QUERY() functions have options for  
handling EMPTY and ERROR conditions, which can be used to specify  
the behavior when no values are matched and when an error occurs  
during jsonpath evaluation, respectively.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Author: Jian He <[email protected]>  
  
Reviewers have included (in no particular order):  
  
Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup,  
Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson,  
Justin Pryzby, Álvaro Herrera, Jian He, Anton A. Melnikov,  
Nikita Malakhov, Peter Eisentraut, Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/formatting.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
A src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/sqljson_queryfuncs.sql
M src/tools/pgindent/typedefs.list

Allow dbname to be written as part of connstring via pg_basebackup's -R option.

commit   : a145f424d5248a09d766e8cb503b999290cb3b31    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 21 Mar 2024 10:48:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 21 Mar 2024 10:48:59 +0530    

Click here for diff

Commit cca97ce6a665 allowed dbname in pg_basebackup connstring and in this  
commit we allow it to be written in postgresql.auto.conf when -R option is  
used. The database name in the connection string will be used by the  
logical replication slot synchronization on standby.  
  
The dbname will be recorded only if specified explicitly in the connection  
string or environment variable.  
  
Masahiko Sawada hasn't reviewed the code in detail but endorsed the idea.  
  
Author: Vignesh C, Kuroda Hayato  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAB8KJ=hdKdg+UeXhReeHpHA6N6v3e0qFF+ZsPFHk9_ThWKf=2A@mail.gmail.com  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_rewind/pg_rewind.c
M src/fe_utils/recovery_gen.c
M src/include/fe_utils/recovery_gen.h

Add TIDStore, to store sets of TIDs (ItemPointerData) efficiently.

commit   : 30e144287a72529c9cd9fd6b07fe96eb8a1e270e    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 21 Mar 2024 10:08:42 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 21 Mar 2024 10:08:42 +0900    

Click here for diff

TIDStore is a data structure designed to efficiently store large sets  
of TIDs. For TID storage, it employs a radix tree, where the key is  
a block number, and the value is a bitmap representing offset  
numbers. The TIDStore can be created on a DSA area and used by  
multiple backend processes simultaneously.  
  
There are potential future users such as tidbitmap.c, though it's very  
likely the interface will need to evolve as we come to understand the  
needs of different kinds of users. For example, we can support  
updating the offset bitmap of existing values.  
  
Currently, the TIDStore is not used for anything yet, aside from the  
test code. But an upcoming patch will use it.  
  
This includes a unit test module, in src/test/modules/test_tidstore.  
  
Co-authored-by: John Naylor  
Discussion: https://postgr.es/m/CAD21AoAfOZvmfR0j8VmZorZjL7RhTiQdVttNuC4W-Shdc2a-AA%40mail.gmail.com  

M src/backend/access/common/Makefile
M src/backend/access/common/meson.build
A src/backend/access/common/tidstore.c
A src/include/access/tidstore.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_tidstore/.gitignore
A src/test/modules/test_tidstore/Makefile
A src/test/modules/test_tidstore/expected/test_tidstore.out
A src/test/modules/test_tidstore/meson.build
A src/test/modules/test_tidstore/sql/test_tidstore.sql
A src/test/modules/test_tidstore/test_tidstore–1.0.sql
A src/test/modules/test_tidstore/test_tidstore.c
A src/test/modules/test_tidstore/test_tidstore.control
M src/tools/pgindent/typedefs.list

Un-break genbki.pl's error reporting capabilities.

commit   : 995e0fbc1c57c9b705c57de456d25c6e448bc5dd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2024 18:02:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2024 18:02:50 -0400    

Click here for diff

This essentially reverts commit 69eb643b2, which added a fast path  
in Catalog::ParseData, but neglected to preserve the behavior of  
adding a line_number field in each hash.  That makes it impossible  
for genbki.pl to provide any localization of error reports, which is  
bad enough; but actually the affected error reports failed entirely,  
producing useless bleats like "use of undefined value in sprintf".  
  
69eb643b2 claimed to get a 15% speedup, but I'm not sure I believe  
that: the time to rebuild the bki files changes by less than 1% for  
me.  In any case, making debugging of mistakes in .dat files more  
difficult would not be justified by even an order of magnitude  
speedup here; it's just not that big a chunk of the total build time.  
  
Per report from David Wheeler.  Although it's also broken in v16,  
I don't think this is worth a back-patch, since we're very unlikely  
to touch the v16 catalog data again.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm

Add to_regtypemod function to extract typemod from a string type name.

commit   : 1218ca9956ee60afc6975f14c1a4c953bd6bbaa7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2024 17:11:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2024 17:11:23 -0400    

Click here for diff

In combination with to_regtype, this allows converting a string to  
the "canonicalized" form emitted by format_type.  That usage requires  
parsing the string twice, which is slightly annoying but not really  
too expensive.  We considered alternatives such as returning a record  
type, but that way was notationally uglier than this, and possibly  
less flexible.  
  
Like to_regtype(), we'd rather that this return NULL for any bad  
input, but the underlying type-parsing logic isn't yet capable of  
not throwing syntax errors.  Adjust the documentation for both  
functions to point that out.  
  
In passing, fix up a couple of nearby entries in the System Catalog  
Information Functions table that had not gotten the word about our  
since-v13 convention for displaying function usage examples.  
  
David Wheeler and Erik Wienhold, reviewed by Pavel Stehule, Jim Jones,  
and others.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid overflow in MaybeRemoveOldWalSummaries().

commit   : 80686761c49d5194d224b344e968c26981611726    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 20 Mar 2024 13:31:58 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 20 Mar 2024 13:31:58 -0500    

Click here for diff

This commit limits the maximum value of wal_summary_keep_time to  
INT_MAX / SECS_PER_MINUTE to avoid overflow when it is converted to  
seconds.  In passing, use the HOURS_PER_DAY, MINS_PER_HOUR, and  
SECS_PER_MINUTE macros in the code for this GUC instead of hard-  
coding those values.  
  
Discussion: https://postgr.es/m/20240314210010.GA3056455%40nathanxps13  

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

Inline basic UTF-8 functions.

commit   : 9acae56ce0b0812f3e940cf1f87e73e8d5784e78    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 20 Mar 2024 09:40:57 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 20 Mar 2024 09:40:57 -0700    

Click here for diff

Shows a measurable speedup when processing UTF-8 data, such as with  
the new builtin collation provider.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M src/common/wchar.c
M src/include/mb/pg_wchar.h

Revert "Temporary patch to help debug pg_walsummary test failures."

commit   : 2b520860c08ac946ec5e570065ede1c467e45618    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 20 Mar 2024 11:34:00 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 20 Mar 2024 11:34:00 -0500    

Click here for diff

Thanks to commits ea18eb7d62, b6ee30ec08, and 19a829a327, the  
002_blocks.pl test now consistently passes, so we can remove this  
temporary debugging code.  
  
This reverts commit 5ddf9973477729cf161b4ad0a1efd52f4fea9c88.  
  
Discussion: https://postgr.es/m/20240314210010.GA3056455%40nathanxps13  

M src/backend/backup/walsummary.c
M src/bin/pg_walsummary/t/002_blocks.pl

Review wording on tablespaces w.r.t. partitioned tables

commit   : a0390f6ca6c730949577e0d3c1fde7a77696ca17    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2024 15:28:14 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2024 15:28:14 +0100    

Click here for diff

Remove a redundant comment, and document pg_class.reltablespace properly  
in catalogs.sgml.  
  
After commits a36c84c3e4a9, 87259588d0ab and others.  
  
Backpatch to 12.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/tablecmds.c

Rework lwlocknames.txt to become lwlocklist.h

commit   : da952b415f4444fcc85ea79c3f006af142d3c90a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2024 11:46:11 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2024 11:46:11 +0100    

Click here for diff

This way, we can fold the list of lock names to occur in  
BuiltinTrancheNames instead of having its own separate array.  This  
saves two lines of code in GetLWTrancheName and some space in  
BuiltinTrancheNames, as foreseen in commit 74a730631065, as well as  
removing the need for a separate lwlocknames.c file.  
  
We still have to build lwlocknames.h using Perl code, which initially I  
wanted to avoid, but it gives us the chance to cross-check  
wait_event_names.txt.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/backend/storage/lmgr/.gitignore
M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lwlock.c
D src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/meson.build
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlock.h
A src/include/storage/lwlocklist.h
M src/include/storage/meson.build
M src/tools/pginclude/headerscheck

Catalog domain not-null constraints

commit   : e5da0fe3c22b34c4433f1729e88495554b5331ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Mar 2024 09:29:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Mar 2024 09:29:08 +0100    

Click here for diff

This applies the explicit catalog representation of not-null  
constraints introduced by b0e96f3119 for table constraints also to  
domain not-null constraints.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/9ec24d7b-633d-463a-84c6-7acff769c9e8%40eisentraut.org  

M src/backend/catalog/information_schema.sql
M src/backend/catalog/pg_constraint.c
M src/backend/commands/typecmds.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/typcache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Remove unused PruneState member rel

commit   : c9c260decd239159277c1baad9d929ebcdf2491e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 10:13:42 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 10:13:42 +0200    

Click here for diff

PruneState->rel is no longer being used, so just remove it.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240320013602.6sypr4cx6sefpemg@liskov  

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

Reorganize heap_page_prune() function comment

commit   : c33084205a865538212b7edd99ab5de8e7220fb7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 10:13:39 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 10:13:39 +0200    

Click here for diff

heap_page_prune()'s function header comment didn't explain the  
parameters in the same order they appear in the function. Fix that.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20240320013602.6sypr4cx6sefpemg@liskov  

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

Add "--exclude-extension" to pg_dump's options.

commit   : 522ed12f7c600243870b13d9ff59f8fd5af10978    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 20 Mar 2024 08:05:44 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 20 Mar 2024 08:05:44 +0000    

Click here for diff

This option (or equivalently specifying "exclude extension pattern" in  
a filter file) allows extensions matching the specified pattern to be  
excluded from the dump.  
  
Ayush Vatsa, reviewed by Junwang Zhao, Dean Rasheed, and Daniel  
Gustafsson.  
  
Discussion: https://postgr.es/m/CACX+KaP=VgVy9h-EUh598DTu+-fNr1jyEmpghC8rRp9s=w33Kg@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_dump.c
M src/test/modules/test_pg_dump/t/001_base.pl

Remove assertions that some compiler say are tautological

commit   : d63d486d6c393817810d0477569fc657c388bfb2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 09:14:51 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Mar 2024 09:14:51 +0200    

Click here for diff

To avoid the compiler warnings:  
  
    launch_backend.c:211:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare]  
    launch_backend.c:233:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare]  
  
The point of the assertions was to fail more explicitly if someone  
adds a new BackendType to the end of the enum, but forgets to add it  
to the child_process_kinds array. It was a pretty weak assertion to  
begin with, because it wouldn't catch if you added a new BackendType  
in the middle of the enum. So let's just remove it.  
  
Per buildfarm member ayu and a few others, spotted by Tom Lane.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/launch_backend.c
M src/include/miscadmin.h

commit   : 9578393bc513e350e9cbfa4679fc7be7309b41a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Mar 2024 07:08:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Mar 2024 07:08:01 +0100    

Click here for diff

Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/9ec24d7b-633d-463a-84c6-7acff769c9e8%40eisentraut.org  

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

Support C.UTF-8 locale in the new builtin collation provider.

commit   : f69319f2f1fb16eda4b535bcccec90dff3a6795e    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 19 Mar 2024 15:24:41 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 19 Mar 2024 15:24:41 -0700    

Click here for diff

The builtin C.UTF-8 locale has similar semantics to the libc locale of  
the same name. That is, code point sort order (fast, memcmp-based)  
combined with Unicode semantics for character operations such as  
pattern matching, regular expressions, and  
LOWER()/INITCAP()/UPPER(). The character semantics are based on  
Unicode simple case mappings.  
  
The builtin provider's C.UTF-8 offers several important advantages  
over libc:  
  
 * faster sorting -- benefits from additional optimizations such as  
   abbreviated keys and varstrfastcmp_c  
 * faster case conversion, e.g. LOWER(), at least compared with some  
   libc implementations  
 * available on all platforms with identical semantics, and the  
   semantics are stable, testable, and documentable within a given  
   Postgres major version  
  
Being based on memcmp, the builtin C.UTF-8 locale does not offer  
natural language sort order. But it is an improvement for most use  
cases that might otherwise use libc's "C.UTF-8" locale, as well as  
many use cases that use libc's "C" locale.  
  
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com  
Reviewed-by: Daniel Vérité, Peter Eisentraut, Jeremy Schneider  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/initdb.sgml
M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/scripts/t/020_createdb.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat
A src/test/regress/expected/collate.utf8.out
A src/test/regress/expected/collate.utf8_1.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/collate.utf8.sql

Improve EXPLAIN's display of SubPlan nodes and output parameters.

commit   : fd0398fcb099980fbedbb7750356ef234408c1c9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2024 18:19:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2024 18:19:24 -0400    

Click here for diff

Historically we've printed SubPlan expression nodes as "(SubPlan N)",  
which is pretty uninformative.  Trying to reproduce the original SQL  
for the subquery is still as impractical as before, and would be  
mighty verbose as well.  However, we can still do better than that.  
Displaying the "testexpr" when present, and adding a keyword to  
indicate the SubLinkType, goes a long way toward showing what's  
really going on.  
  
In addition, this patch gets rid of EXPLAIN's use of "$n" to represent  
subplan and initplan output Params.  Instead we now print "(SubPlan  
N).colX" or "(InitPlan N).colX" to represent the X'th output column  
of that subplan.  This eliminates confusion with the use of "$n" to  
represent PARAM_EXTERN Params, and it's useful for the first part of  
this change because it eliminates needing some other indication of  
which subplan is referenced by a SubPlan that has a testexpr.  
  
In passing, this adds simple regression test coverage of the  
ROWCOMPARE_SUBLINK code paths, which were entirely unburdened  
by testing before.  
  
Tom Lane and Dean Rasheed, reviewed by Aleksander Alekseev.  
Thanks to Chantal Keller for raising the question of whether  
this area couldn't be improved.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/perform.sgml
M src/backend/commands/explain.c
M src/backend/optimizer/plan/subselect.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/memoize.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/portals.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/sqljson.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/update.out
M src/test/regress/expected/window.out
M src/test/regress/expected/with.out
M src/test/regress/sql/subselect.sql

Inline pg_popcount{32,64} into pg_popcount().

commit   : cc4826dd5e52c8af7069feb49ce3cd9358fa6a6e    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 19 Mar 2024 14:46:16 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 19 Mar 2024 14:46:16 -0500    

Click here for diff

On some systems, calls to pg_popcount{32,64} are indirected through  
a function pointer.  This commit converts pg_popcount() to a  
function pointer on those systems so that we can inline the  
appropriate pg_popcount{32,64} implementations into each of the  
pg_popcount() implementations.  Since pg_popcount() may call  
pg_popcount{32,64} several times, this can significantly improve  
its performance.  
  
Suggested-by: David Rowley  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAApHDvrb7MJRB6JuKLDEY2x_LKdFHwVbogpjZBCX547i5%2BrXOQ%40mail.gmail.com  

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

Postpone reparameterization of paths until create_plan().

commit   : b7e2121ab7d6166b835a46ceaab1b6a6dc589703    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2024 14:51:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2024 14:51:58 -0400    

Click here for diff

When considering nestloop paths for individual partitions within  
a partitionwise join, if the inner path is parameterized, it is  
parameterized by the topmost parent of the outer rel, not the  
corresponding outer rel itself.  Therefore, we need to translate the  
parameterization so that the inner path is parameterized by the  
corresponding outer rel.  
  
Up to now, we did this while generating join paths.  However, that's  
problematic because we must also translate some expressions that are  
shared across all paths for a relation, such as restriction clauses  
(kept in the RelOptInfo and/or IndexOptInfo) and TableSampleClauses  
(kept in the RangeTblEntry).  The existing code fails to translate  
these at all, leading to wrong answers, odd failures such as  
"variable not found in subplan target list", or executor crashes.  
But we can't modify them during path generation, because that would  
break things if we end up choosing some non-partitioned-join path.  
  
So this patch postpones reparameterization of the inner path until  
createplan.c, where it is safe to modify the referenced RangeTblEntry,  
RelOptInfo or IndexOptInfo, because we have made a final choice of which  
Path to use.  We do still have to check during path generation that  
the reparameterization will be possible.  So we introduce a new  
function path_is_reparameterizable_by_child() to detect that.  
  
The duplication between path_is_reparameterizable_by_child() and  
reparameterize_path_by_child() is a bit annoying, but there seems  
no other good answer.  A small benefit is that we can avoid building  
useless reparameterized trees in cases where a non-partitioned join  
is ultimately chosen.  Also, reparameterize_path_by_child() can now  
be allowed to scribble on the input paths, saving a few cycles.  
  
This fix repairs the same problems previously addressed in the  
back branches by commits 62f120203 et al.  
  
Richard Guo, reviewed at various times by Ashutosh Bapat, Andrei  
Lepikhov, Alena Rybakina, Robert Haas, and myself  
  
Discussion: https://postgr.es/m/CAMbWs496+N=UAjOc=rcD3P7B6oJe4rZw08e_TZRUsWbPxZW3Tw@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

gen_node_support.pl: Mark location fields as type alias ParseLoc

commit   : 605721f819f5b603db6bc1405ef414747d182116    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 16:55:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 16:55:00 +0100    

Click here for diff

Instead of the rather ugly type=int + name ~= location$, we now have a  
marker type for offset pointers or sizes that are only relevant when a  
query text is included, which decreases the complexity required in  
gen_node_support.pl for handling these values.  
  
Author: Matthias van de Meent <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEze2WgrCiR3JZmWyB0YTc8HV7ewRdx13j0CqD6mVkYAW+SFGQ@mail.gmail.com  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/tools/pgindent/typedefs.list

pg_upgrade: run all data type checks per connection

commit   : 347758b1206364e3bec5ad6cd649b4ba9fe1be7b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Mar 2024 13:32:50 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Mar 2024 13:32:50 +0100    

Click here for diff

The checks for data type usage were each connecting to all databases  
in the cluster and running their query. On clusters which have a lot  
of databases this can become unnecessarily expensive. This moves the  
checks to run in a single connection instead to minimize setup and  
teardown overhead.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Use half-open interval notation in without_overlaps tests

commit   : 5577a71fb0cc16bb7f5e3c40b89eb77460eac724    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 11:44:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 11:44:14 +0100    

Click here for diff

This way, the input literals match the output in any error messages.  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

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

Fix misleading comments

commit   : 49b579f92dc6add10d1f03ba2cea6eab597a2f2f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 10:55:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 10:55:51 +0100    

Click here for diff

To match code changes in 229fb58d4f.  

M src/backend/replication/repl_gram.y

Use daterange and YMD in without_overlaps tests instead of tsrange.

commit   : a88c800deb6ff3fe5e5dccd56f771d2132f74a9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 10:17:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 10:17:03 +0100    

Click here for diff

This makes things a lot easier to read, especially when we get to the  
FOREIGN KEY tests later.  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

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

Add some UUID support functions

commit   : 794f10f6b920670cb9750b043a2b2587059d5051    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 09:30:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 09:30:24 +0100    

Click here for diff

Add uuid_extract_timestamp() and uuid_extract_version().  
  
Author: Andrey Borodin  
Reviewed-by: Sergey Prokhorenko, Kirk Wolak, Przemysław Sztoch  
Reviewed-by: Nikolay Samokhvalov, Jelte Fennema-Nio, Aleksander Alekseev  
Reviewed-by: Peter Eisentraut, Chris Travers, Lukas Fittl  
Discussion: https://postgr.es/m/CAAhFRxitJv%3DyoGnXUgeLB_O%2BM7J2BJAmb5jqAT9gZ3bij3uLDA%40mail.gmail.com  

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

Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings

commit   : d56cb42b54381d414f1f30929ca267e4768313c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 07:01:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2024 07:01:22 +0100    

Click here for diff

This checks that certain I/O-related Perl functions properly check  
their return value.  Some parts of the PostgreSQL code had been a bit  
sloppy about that.  The new perlcritic warnings are fixed here.  I  
didn't design any beautiful error messages, mostly just used "or die  
$!", which mostly matches existing code, and also this is  
developer-level code, so having the system error plus source code  
reference should be ok.  
  
Initially, we only activate this check for a subset of what the  
perlcritic check would warn about.  The effective list is  
  
    chmod flock open read rename seek symlink system  
  
The initial set of functions is picked because most existing code  
already checked the return value of those, so any omissions are  
probably unintended, or because it seems important for test  
correctness.  
  
The actual perlcritic configuration is written as an exclude list.  
That seems better so that we are clear on what we are currently not  
checking.  Maybe future patches want to investigate checking some of  
the other functions.  (In principle, we might eventually want to check  
all of them, but since this is test and build support code, not  
production code, there are probably some reasonable compromises to be  
made.)  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/88b7d4f2-46d9-4cc7-b1f7-613c90f9a76a%40eisentraut.org  

M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/pl/plperl/text2macro.pl
M src/test/kerberos/t/001_auth.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/ssl/t/SSL/Server.pm
M src/tools/msvc_gendef.pl
M src/tools/perlcheck/perlcriticrc
M src/tools/pgindent/pgindent

Fix documentation oversights from 2d819a08a1.

commit   : bb5604ba9e53e3a0fb9967f960e36cff4d36b0ab    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 17:13:18 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 17:13:18 -0700    

Click here for diff

M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml

Update src/common/unicode/README.

commit   : f9f3fb1cb71a6cf28283a8cc3185599ec0ce94d3    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 16:36:40 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 16:36:40 -0700    

Click here for diff

Change the test description to include the case mapping  
test. Oversight in 5c40364dd6.  

M src/common/unicode/README

Fix another warning, introduced by 846311051e.

commit   : 60769c62dc85680ee357aec92461fe97c715aebb    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 15:34:43 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 15:34:43 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reported-by: Tom Lane  

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

Address more review comments on commit 2d819a08a1.

commit   : 846311051e8fdca4c9db83b2b09425759a8b102d    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 11:56:45 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 11:56:45 -0700    

Click here for diff

Based on comments from Peter Eisentraut.  
  
 * Document CREATE DATABASE ... BUILTIN_LOCALE.  
 * Determine required encoding based on locale name for CREATE  
   COLLATION. Use -1 for "C" (requires catversion bump).  
 * initdb output fixups.  
 * Make ctype_is_c a constant true for now.  
 * Fixups to ICU 010_create_database.pl test.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_database.sgml
M src/backend/commands/collationcmds.c
M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/include/catalog/catversion.h
M src/include/utils/pg_locale.h
M src/test/icu/t/010_database.pl

dblink/isolationtester/fe_utils: Use new cancel API

commit   : 66ab9371a23320cf608e68e8e5d2811992941bea    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 18 Mar 2024 19:28:58 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 18 Mar 2024 19:28:58 +0100    

Click here for diff

Commit 61461a300c1c introduced new functions to libpq for cancelling  
queries.  This replaces the usage of the old ones in parts of the  
codebase with these newer ones.  This specifically leaves out changes to  
psql and pgbench, as those would need a much larger refactor to be able  
to call them due to the new functions not being signal-safe; and also  
postgres_fdw, because the original code there is not clear to me  
(Álvaro) and not fully tested.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQT_VgOWWENUqvUV9xQmbaCyXjtRRAYO8W07oqashk_N+g@mail.gmail.com  

M contrib/dblink/dblink.c
M src/fe_utils/connect_utils.c
M src/test/isolation/isolationtester.c

Fix unreachable code warning from commit 2d819a08a1.

commit   : 61f352ece9e7eb89c7154da178d0c3bc69fc72c9    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 09:15:47 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 18 Mar 2024 09:15:47 -0700    

Click here for diff

Found by Coverity.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Tom Lane  

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

Add missing source files to nls.mk

commit   : 5162f663fcbe837648ae28f00e18ed972f5e360b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2024 16:45:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2024 16:45:51 +0100    

Click here for diff

M src/bin/initdb/nls.mk
M src/bin/pg_resetwal/nls.mk

Put libpq_pipeline cancel test back

commit   : 6b3678d3474ff456b3229e4829c595be1c0c2888    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 18 Mar 2024 13:14:55 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 18 Mar 2024 13:14:55 +0100    

Click here for diff

I disabled it in cc6e64afda53 because it was unstable; hopefully the  
changes here make it more stable.  (Jelte proposed to submit the queries  
using simple query protocol, but I chose to instead make the monitor  
connection wait until the PgSleep wait event is seen.  This is probably  
not a terribly meaningful increase in coverage ...)  
  
Discussion: https://postgr.es/m/CAGECzQRQh_5tSy+5cndgv08eNJ2O0Zpwn2YddJtSsmC=Wpy1BQ@mail.gmail.com  

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

Fix EXPLAIN Bitmap heap scan to count pages with no visible tuples

commit   : 0960ae1967d0569be4d118c20e51a2ed98d76f65    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 14:03:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 14:03:58 +0200    

Click here for diff

Previously, bitmap heap scans only counted lossy and exact pages for  
explain when there was at least one visible tuple on the page.  
  
heapam_scan_bitmap_next_block() returned true only if there was a  
"valid" page with tuples to be processed. However, the lossy and exact  
page counters in EXPLAIN should count the number of pages represented  
in a lossy or non-lossy way in the constructed bitmap, regardless of  
whether or not the pages ultimately contained visible tuples.  
  
Backpatch to all supported versions.  
  
Author: Melanie Plageman  
Discussion: https://www.postgresql.org/message-id/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA@mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/CAAKRu_bxrXeZ2rCnY8LyeC2Ls88KpjWrQ%[email protected]  

M src/backend/executor/nodeBitmapHeapscan.c
M src/test/regress/expected/partition_prune.out

Add some const decorations

commit   : 48018f1d8c12d42b53c2a855626ee1ceb7f4ca71    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2024 12:07:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2024 12:07:09 +0100    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/fe_utils/recovery_gen.c
M src/include/fe_utils/recovery_gen.h

Move code for backend startup to separate file

commit   : 05c3980e7f473ac2061dad9bbb7a9f0ede0279d9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:38:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:38:10 +0200    

Click here for diff

This is code that runs in the backend process after forking, rather  
than postmaster. Move it out of postmaster.c for clarity.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/Makefile
A src/backend/tcop/backend_startup.c
M src/backend/tcop/meson.build
M src/include/postmaster/postmaster.h
A src/include/tcop/backend_startup.h

Refactor postmaster child process launching

commit   : aafc05de1bf5c0324cb5e690c6742118c1ac4af6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:08 +0200    

Click here for diff

Introduce new postmaster_child_launch() function that deals with the  
differences in EXEC_BACKEND mode.  
  
Refactor the mechanism of passing information from the parent to child  
process. Instead of using different command-line arguments when  
launching the child process in EXEC_BACKEND mode, pass a  
variable-length blob of startup data along with all the global  
variables. The contents of that blob depend on the kind of child  
process being launched. In !EXEC_BACKEND mode, we use the same blob,  
but it's simply inherited from the parent to child process.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/walreceiver.c
M src/backend/utils/init/globals.c
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walsummarizer.h
M src/include/postmaster/walwriter.h
M src/include/replication/slotsync.h
M src/include/replication/walreceiver.h
M src/tools/pgindent/typedefs.list

Move some functions from postmaster.c to a new source file

commit   : f1baed18bc3db50c72bfb00b6247b47689158445    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:05 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:05 +0200    

Click here for diff

This just moves the functions, with no other changes, to make the next  
commits smaller and easier to review. The moved functions are related  
to launching postmaster child processes in EXEC_BACKEND mode.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/Makefile
A src/backend/postmaster/launch_backend.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/postmaster.c
M src/include/postmaster/postmaster.h

Split registration of Win32 deadchild callback to separate function

commit   : 14cddee9cce349d4bf024316e014ccf891c39cef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:01 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Mar 2024 11:35:01 +0200    

Click here for diff

The next commit will move the internal_forkexec() function to a  
different source file, but it makes sense to keep all the code related  
to the win32 waitpid() emulation in postmaster.c. Split it off to a  
separate function now, to make the next commit more mechanical.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c

Remove references to backup_fs_hot() in Cluster.pm

commit   : ca108be72e7abf1f801c8e49dcffbbbbf412c0d9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2024 14:21:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2024 14:21:32 +0900    

Click here for diff

This routine has been removed in 39969e2a1e4d with the exclusive backup  
mode but there were still references to it.  
  
Issue noticed while working on 071e3ad59d6f.  

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

Initialize variables to placate compiler.

commit   : 949300402bde06699a23f216e26343e3503ba78b    
  
author   : Nathan Bossart <[email protected]>    
date     : Sun, 17 Mar 2024 20:16:15 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Sun, 17 Mar 2024 20:16:15 -0500    

Click here for diff

Since commit 012460ee93, some compilers have been warning that a  
couple of variables may be used uninitialized.  There doesn't  
appear to be any actual risk, so let's just initialize these  
variables to 0 to silence the compiler warnings.  
  
Discussion: https://postgr.es/m/20240317192927.GA3978212%40nathanxps13  

M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c

Support json_errdetail in FRONTEND code

commit   : d6607016c738a5ccdd9422f3c11778903a03cdbb    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sun, 17 Mar 2024 23:56:15 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sun, 17 Mar 2024 23:56:15 +0100    

Click here for diff

Allocate memory for the error message inside memory owned by the  
JsonLexContext and move responsibility away from the caller for  
freeing it.  This means that we can partially revert b44669b2ca  
as this is now safe to use in FRONTEND code.  The motivation for  
this comes from the OAuth and incremental JSON patchsets but it  
also adds value on its own.  
  
Author: Jacob Champion <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CAOYmi+mWdTd6ujtyF7MsvXvk7ToLRVG_tYAcaGbQLvf=N4KrQw@mail.gmail.com  

M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/common/jsonapi.c
M src/common/parse_manifest.c
M src/include/common/jsonapi.h

Mark hash_corrupted() as pg_attribute_noreturn.

commit   : 33f13168ccd6e65bf0b3959a7e894449e8b6cb36    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Mar 2024 17:54:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Mar 2024 17:54:45 -0400    

Click here for diff

Coverity started complaining about this after cc5ef90ed.  
The code's not really different from before, but might  
as well clarify its intent.  

M src/backend/utils/hash/dynahash.c

Fix PDF doc generation.

commit   : 7eb9a8201890f3b208fd4c109a5b08bf139b692a    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 14:48:39 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 14:48:39 +0000    

Click here for diff

Commit c649fa24a4 broke PDF generation, due to a misplaced id  
attribute.  
  
Per buildfarm member crake.  

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

Add RETURNING support to MERGE.

commit   : c649fa24a42ba89bf5460c7110e4fc8eeca65959    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 13:58:59 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 13:58:59 +0000    

Click here for diff

This allows a RETURNING clause to be appended to a MERGE query, to  
return values based on each row inserted, updated, or deleted. As with  
plain INSERT, UPDATE, and DELETE commands, the returned values are  
based on the new contents of the target table for INSERT and UPDATE  
actions, and on its old contents for DELETE actions. Values from the  
source relation may also be returned.  
  
As with INSERT/UPDATE/DELETE, the output of MERGE ... RETURNING may be  
used as the source relation for other operations such as WITH queries  
and COPY commands.  
  
Additionally, a special function merge_action() is provided, which  
returns 'INSERT', 'UPDATE', or 'DELETE', depending on the action  
executed for each row. The merge_action() function can be used  
anywhere in the RETURNING list, including in arbitrary expressions and  
subqueries, but it is an error to use it anywhere outside of a MERGE  
query's RETURNING list.  
  
Dean Rasheed, reviewed by Isaac Morland, Vik Fearing, Alvaro Herrera,  
Gurjeet Singh, Jian He, Jeff Davis, Merlin Moncure, Peter Eisentraut,  
and Wolfgang Walther.  
  
Discussion: http://postgr.es/m/CAEZATCWePEGQR5LBn-vD6SfeLZafzEm2Qy_L_Oky2=qw2w3Pzg@mail.gmail.com  

M doc/src/sgml/dml.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execPartition.c
M src/backend/executor/functions.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/paramassign.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/common.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/paramassign.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_node.h
M src/pl/plpgsql/src/pl_exec.c
M src/pl/tcl/pltcl.c
M src/test/regress/expected/merge.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/with.out
M src/test/regress/sql/merge.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/updatable_views.sql
M src/test/regress/sql/with.sql
M src/tools/pgindent/typedefs.list

Add attstattarget to FormExtraData_pg_attribute

commit   : 6a004f1be87d34cfe51acf2fe2552d2b08a79273    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:38:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:38:27 +0100    

Click here for diff

This allows setting attstattarget when a relation is created.  
  
We make use of this by having index_concurrently_create_copy() copy  
over the attstattarget values when the new index is created, instead  
of having index_concurrently_swap() fix it up later.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/include/catalog/index.h
M src/include/catalog/pg_attribute.h

Generalize handling of nullable pg_attribute columns in DDL

commit   : d939cb2fd612acde0304913213cfbdb01994e682    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:19:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:19:30 +0100    

Click here for diff

DDL code uses tuple descriptors to pass around pg_attribute values  
during table and index creation.  But tuple descriptors don't include  
the variable-length/nullable columns of pg_attribute, so they have to  
be handled separately.  Right now, the attoptions field is handled in  
a one-off way with a separate argument passed to  
InsertPgAttributeTuples().  The other affected fields of pg_attribute  
are right now not needed at relation creation time.  
  
The goal of this patch is to generalize this to allow handling  
additional variable-length/nullable columns of pg_attribute in a  
similar manner.  For that, create a new struct  
FormExtraData_pg_attribute, which is to be passed around in parallel  
to the tuple descriptor and optionally supplies the additional  
columns.  Right now, this struct only contains one field for  
attoptions, so no functionality is actually changed by this.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/include/catalog/heap.h
M src/include/catalog/pg_attribute.h
M src/tools/pgindent/typedefs.list

Make stxstattarget nullable

commit   : 012460ee93c304fbc7220e5b55d9d0577fc766ab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:22:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 12:22:05 +0100    

Click here for diff

To match attstattarget change (commit 4f622503d6d).  The logic inside  
CreateStatistics() is clarified a bit compared to that previous patch,  
and so here we also update ATExecSetStatistics() to match.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/statistics/extended_stats.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_statistic_ext.h
M src/include/nodes/parsenodes.h

Fix EXPLAIN output for subplans in MERGE.

commit   : 33e729c5148c3a697abc552621b34bdc5fd497ed    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 10:17:11 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 17 Mar 2024 10:17:11 +0000    

Click here for diff

Given a subplan in a MERGE query, EXPLAIN would sometimes fail to  
properly display expressions involving Params referencing variables in  
other parts of the plan tree.  
  
This would affect subplans outside the topmost join plan node, for  
which expansion of Params would go via the top-level ModifyTable plan  
node.  The problem was that "inner_tlist" for the ModifyTable node's  
deparse_namespace was set to the join node's targetlist, but  
"inner_plan" was set to the ModifyTable node itself, rather than the  
join node, leading to incorrect results when descending to the  
referenced variable.  
  
Fix and backpatch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCWAv-sZuH%2BwG5xJ-%2BGt7qGNGX8wUQd3XYydMFDKgRB9nw%40mail.gmail.com  

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

Separate equalRowTypes() from equalTupleDescs()

commit   : 20e58105badff383bd43f0b97e532771768f94df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 05:58:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2024 05:58:04 +0100    

Click here for diff

This introduces a new function equalRowTypes() that is effectively a  
subset of equalTupleDescs() but only compares the number of attributes  
and attribute name, type, typmod, and collation.  This is enough for  
most existing uses of equalTupleDescs(), which are changed to use the  
new function.  The only remaining callers of equalTupleDescs() are  
those that really want to check the full tuple descriptor as such,  
without concern about record or row or record type semantics.  
  
The existing function hashTupleDesc() is renamed to hashRowType(),  
because it now corresponds more to equalRowTypes().  
  
The purpose of this change is to be clearer about the semantics of the  
equality asked for by each caller.  (At least one caller had a comment  
that questioned whether equalTupleDescs() was too restrictive.)  For  
example, 4f622503d6d removed attstattarget from the tuple descriptor  
structure.  It was not fully clear at the time how this should affect  
equalTupleDescs().  Now the answer is clear: By their own definitions,  
equalRowTypes() does not care, and equalTupleDescs() just compares  
whatever is in the tuple descriptor but does not care why it is in  
there.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f656d6d9-6660-4518-a006-2f65cafbebd1%40eisentraut.org  

M src/backend/access/common/tupdesc.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/analyze.c
M src/backend/commands/view.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/typcache.c
M src/include/access/tupdesc.h

Add destroyStringInfo function for cleaning up StringInfos

commit   : b7831865159d5fb6f0d263e6023f0986589fe254    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 16 Mar 2024 23:18:28 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 16 Mar 2024 23:18:28 +0100    

Click here for diff

destroyStringInfo() is a counterpart to makeStringInfo(), freeing a  
palloc'd StringInfo and its data. This is a convenience function to  
align the StringInfo API with the PQExpBuffer API. Originally added  
in the OAuth patchset, it was extracted and committed separately in  
order to aid upcoming JSON work.  
  
Author: Daniel Gustafsson <[email protected]>  
Author: Jacob Champion <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CAOYmi+mWdTd6ujtyF7MsvXvk7ToLRVG_tYAcaGbQLvf=N4KrQw@mail.gmail.com  

M src/backend/backup/basebackup.c
M src/backend/commands/subscriptioncmds.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/xml.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/common/stringinfo.c
M src/include/lib/stringinfo.h
M src/test/regress/pg_regress.c

psql: fix variable existence tab completion

commit   : 927332b95e778c0d15a9fbf96e3efeab0d3d937c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2024 23:49:10 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2024 23:49:10 +0200    

Click here for diff

psql has the :{?name} syntax for testing for a psql variable existence.  This  
commit implements a tab completion for this syntax.  Notably, in order to  
implement this we have to remove '{' from WORD_BREAKS.  It appears that  
'{' here from the very beginning and it comes from the default value of  
rl_basic_word_break_characters.  And :{?name} is the only psql syntax using  
the '{' sign.  So, removing it from WORD_BREAKS shouldn't break anything.  
  
Discussion: https://postgr.es/m/CAGRrpzZU48F2oV3d8eDLr%3D4TU9xFH5Jt9ED%2BqU1%2BX91gMH68Sw%40mail.gmail.com  
Author: Steve Chavez  
Reviewed-by: Erik Wienhold  

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

Use locale-aware value for \watch in 005_timeouts.pl

commit   : 605062227fdc8331f2ffa0f60e7a8724b6e56480    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 21:35:18 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 21:35:18 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

M src/test/modules/test_misc/t/005_timeouts.pl

Fix handling of expecteddir in pg_regress

commit   : 196eeb6b2f7cf5f95293259efe0e5d73e8d0025d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 15 Mar 2024 17:02:07 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 15 Mar 2024 17:02:07 +0100    

Click here for diff

Commit c855872074b introduced a new parameter to pg_regress to set  
the directory where to look for expected files, but accidentally  
only implemented it for when compiling pg_regress for ECPG tests.  
Fix by adding support for the parameter to the main regression test  
compilation of pg_regress as well.  
  
Backpatch to v16 where --expecteddir was introduced.  
  
Author: Anthonin Bonnefoy <[email protected]>  
Discussion: https://postgr.es/m/CAO6_Xqq5yKJHcJsq__LPcKwSY0XHRqVERNWGxx5ttNXXj7+W=A@mail.gmail.com  
Backpatch-through: 16  

M src/test/regress/pg_regress_main.c

Fix backstop in gin test if injection point is not reached

commit   : d802ff06d0216d59aab3ddba6cb158d1f4b014db    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 17:55:12 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 17:55:12 +0200    

Click here for diff

Per Tom Lane's observation that the test got stuck in infinite loop if  
the injection_points module was not loaded. It was supposed to give up  
after 10000 iterations, but the backstop was broken.  
  
Discussion: https://www.postgresql.org/message-id/2498595.1710511222%40sss.pgh.pa.us  

M src/test/modules/gin/expected/gin_incomplete_splits.out
M src/test/modules/gin/sql/gin_incomplete_splits.sql

Try to unbreak injection-fault tests in the buildfarm

commit   : 85f65d7a26fc24ad9711aa5f1ca7e20ea3ea77e6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 15:18:44 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 15:18:44 +0200    

Click here for diff

The buildfarm script attempts to run all tests marked as  
NO_INSTALLCHECK under src/test/modules without paying attention to  
whether they are enabled or disabled in the parent Makefile. That  
hasn't been a problem so far, because all the tests marked with  
NO_INSTALLCHECK ran unconditionally in "make check". But commit  
e2e3b8ae9e changed that: the injection fault tests are marked as  
NO_INSTALLCHECK, and also depend on --enable-injection-points.  
  
Try to work around that by ensuring that "make check" does nothing in  
the those subdirectories. We can hopefully get rid of this hack soon,  
after fixing the buildfarm client, or by switching to meson.  
  
Discussion: https://www.postgresql.org/message-id/8e4cf596-dd70-432e-9068-16466ed596ed%40iki.fi  

M src/test/modules/gin/Makefile
M src/test/modules/injection_points/Makefile

Fix wordings in timeouts TAP test

commit   : 7a65cc079e717c5d87f1920929affe7138c31eee    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 14:32:25 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 14:32:25 +0200    

Click here for diff

Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20240315.104235.1835366724413653745.horikyota.ntt%40gmail.com  
Author: Andrey Borodin  

M src/test/modules/test_misc/t/005_timeouts.pl

Fix race condition in transaction timeout TAP tests

commit   : 4c2eda67f55a8a263820d12aaeaa7e1dfe7406ee    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 14:31:25 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 15 Mar 2024 14:31:25 +0200    

Click here for diff

The interruption handler within the injection point can get stuck in an  
infinite loop while handling transaction timeout. To avoid this situation  
we reset the timeout flag before invoking the injection point.  
  
Author: Alexander Korotkov  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/ZfPchPC6oNN71X2J%40paquier.xyz  

M src/backend/tcop/postgres.c

Improve log messages referring to background worker processes

commit   : a3f349c612923b53bd168b1dfb541a4ec712b421    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 13:14:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 13:14:38 +0200    

Click here for diff

"Worker" could also mean autovacuum worker or slot sync worker, so  
let's be more explicit.  
  
Per Tristan Partin's suggestion.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c

Disable tests using injection points in installcheck

commit   : e2e3b8ae9ed73fcd3096c5ca93971891a7767388    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 13:06:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Mar 2024 13:06:57 +0200    

Click here for diff

The 'gin' test injections faults to GIN index build. If another test  
running concurrently in the same cluster also tries to create a GIN  
index, it will hit the fault, too.  
  
To fix, disable tests using injection points when running against an  
existing cluster. A better long-term solution would be to make the  
injection points scoped to the database or process, but this will do  
for now.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJYhcG_o2nwSK6r01eOZJwNWUJUbX%3D%3DAVnW84f-%[email protected]  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/modules/gin/Makefile
M src/test/modules/gin/meson.build
M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/meson.build

Add basic TAP tests for the low-level backup method, take two

commit   : 071e3ad59d6fd2d6d1277b2bd9579397d10ded28    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2024 08:29:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2024 08:29:54 +0900    

Click here for diff

There are currently no tests for the low-level backup method where  
pg_backup_start() and pg_backup_stop() are involved while taking a  
file-system backup.  The tests introduced in this commit rely on a  
background psql process to make sure that the backup is taken while the  
session doing the SQL start and stop calls remains alive.  
  
Two cases are checked here with the backup taken:  
- Recovery without a backup_label, leading to a corrupted state.  
- Recovery with a backup_label, with a consistent state reached.  
Both cases cross-check some patterns in the logs generated when running  
recovery.  
  
Compared to the first attempt in 99b4a63bef94, this includes a couple of  
fixes making the CI stable (5 runs succeeded here):  
- Add the file to the list of tests in meson.build.  
- Race condition with the first WAL segment that we expect in the  
primary's archives, by adding a poll on pg_stat_archiver.  The second  
segment with the checkpoint record is archived thanks to pg_backup_stop  
waiting for it.  
- Fix failure of test where the backup_label does not exist.  The  
cluster inherits the configuration of the first node; it was attempting  
to store segments in the first node's archives, triggering failures with  
copy on Windows.  
- Fix failure of test on Windows because of incorrect parsing of the  
backup_file in the success case.  The data of the backup_label file is  
retrieved from the output pg_backup_stop() from a BackgroundPsql written  
directly to the backup's data folder.  This would include CRLFs (\r\n),  
causing the startup process to fail at the beginning of recovery when  
parsing the backup_label because only LFs (\n) are allowed.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/meson.build
A src/test/recovery/t/042_low_level_backup.pl

Refactor initial hash lookup in dynahash.c

commit   : cc5ef90edd809eaf85e11a0ee251229bbf7ce798    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2024 07:57:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2024 07:57:17 +0900    

Click here for diff

The same pattern is used three times in dynahash.c to retrieve a bucket  
number and a hash bucket from a hash value.  This has popped up while  
discussing improvements for the type cache, where this piece of  
refactoring would become useful.  
  
Note that hash_search_with_hash_value() does not need the bucket number,  
just the hash bucket.  
  
Author: Teodor Sigaev  
Reviewed-by: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/hash/dynahash.c

Trim ORDER BY/DISTINCT aggregate pathkeys in gather_grouping_paths

commit   : 4169850f0b6fc98a5f28d2b0ca4c3a4c1ecf4553    
  
author   : David Rowley <[email protected]>    
date     : Fri, 15 Mar 2024 11:54:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 15 Mar 2024 11:54:36 +1300    

Click here for diff

Similar to d8a295389, trim off any PathKeys which are for ORDER BY /  
DISTINCT aggregate functions from the PathKey List for the Gather Merge  
paths created by gather_grouping_paths().  These additional PathKeys are  
not valid to use after grouping has taken place as these PathKeys belong  
to columns which are inputs to an aggregate function and, therefore are  
unavailable after aggregation.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16, where 1349d2790 was added  

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

Login event trigger documentation wordsmithing

commit   : 4665cebc8a01dabd54b000bcc107a3468be3a81c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Mar 2024 23:35:35 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Mar 2024 23:35:35 +0100    

Click here for diff

Minor wordsmithing on the login trigger documentation and code  
comments to improve readability, as well as fixing a few small  
incorrect statements in the comments.  
  
Author: Robert Treat <[email protected]>  
Discussion: https://postgr.es/m/CAJSLCQ0aMWUh1m6E9YdjeqV61baQ=EhteJX8XOxXg8H_2Lcr0Q@mail.gmail.com  

M doc/src/sgml/event-trigger.sgml
M src/backend/commands/event_trigger.c

Make INSERT-from-multiple-VALUES-rows handle domain target columns.

commit   : b4a71cf65d70b98aaf890b13ec600e340ff69e3f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2024 14:57:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2024 14:57:16 -0400    

Click here for diff

Commit a3c7a993d fixed some cases involving target columns that are  
arrays or composites by applying transformAssignedExpr to the VALUES  
entries, and then stripping off any assignment ArrayRefs or  
FieldStores that the transformation added.  But I forgot about domains  
over arrays or composites :-(.  Such cases would either fail with  
surprising complaints about mismatched datatypes, or insert unexpected  
coercions that could lead to odd results.  To fix, extend the  
stripping logic to get rid of CoerceToDomain if it's atop an ArrayRef  
or FieldStore.  
  
While poking at this, I realized that there's a poorly documented and  
not-at-all-tested behavior nearby: we coerce each VALUES column to  
the domain type separately, and rely on the rewriter to merge those  
operations so that the domain constraints are checked only once.  
If that merging did not happen, it's entirely possible that we'd get  
unexpected domain constraint failures due to checking a  
partially-updated container value.  There's no bug there, but while  
we're here let's improve the commentary about it and add some test  
cases that explicitly exercise that behavior.  
  
Per bug #18393 from Pablo Kharo.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Add pg_column_toast_chunk_id().

commit   : d1162cfda885c5a8cb9cebfc8eed9f1d76855e83    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 14 Mar 2024 10:58:00 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 14 Mar 2024 10:58:00 -0500    

Click here for diff

This function returns the chunk_id of an on-disk TOASTed value.  If  
the value is un-TOASTed or not on-disk, it returns NULL.  This is  
useful for identifying which values are actually TOASTed and for  
investigating "unexpected chunk number" errors.  
  
Bumps catversion.  
  
Author: Yugo Nagata  
Reviewed-by: Jian He  
Discussion: https://postgr.es/m/20230329105507.d764497456eeac1ca491b5bd%40sraoss.co.jp  

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

Remove redundant snapshot copying from parallel leader to workers

commit   : 84c18acaf690e438e953e387caf1c13298d4ecb4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 14 Mar 2024 15:18:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 14 Mar 2024 15:18:10 +0200    

Click here for diff

The parallel query infrastructure copies the leader backend's active  
snapshot to the worker processes. But BitmapHeapScan node also had  
bespoken code to pass the snapshot from leader to the worker. That was  
redundant, so remove it.  
  
The removed code was analogous to the snapshot serialization in  
table_parallelscan_initialize(), but that was the wrong role model. A  
parallel bitmap heap scan is more like an independent non-parallel  
bitmap heap scan in each parallel worker as far as the table AM is  
concerned, because the coordination is done in nodeBitmapHeapscan.c,  
and the table AM doesn't need to know anything about it.  
  
This relies on the assumption that es_snapshot ==  
GetActiveSnapshot(). That's not a new assumption, things would get  
weird if you used the QueryDesc's snapshot for visibility checks in  
the scans, but the active snapshot for evaluating quals, for  
example. This could use some refactoring and cleanup, but for now,  
just add some assertions.  
  
Reviewed-by: Dilip Kumar, Robert Haas  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/table/tableam.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/include/access/tableam.h
M src/include/nodes/execnodes.h

Allow a no-wait lock acquisition to succeed in more cases.

commit   : 2346df6fc373df9c5ab944eebecf7d3036d727de    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Mar 2024 08:55:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Mar 2024 08:55:25 -0400    

Click here for diff

We don't determine the position at which a process waiting for a lock  
should insert itself into the wait queue until we reach ProcSleep(),  
and we may at that point discover that we must insert ourselves ahead  
of everyone who wants a conflicting lock, in which case we obtain the  
lock immediately. Up until now, a no-wait lock acquisition would fail  
in such cases, erroneously claiming that the lock couldn't be obtained  
immediately.  Fix that by trying ProcSleep even in the no-wait case.  
  
No back-patch for now, because I'm treating this as an improvement to  
the existing no-wait feature. It could instead be argued that it's a  
bug fix, on the theory that there should never be any case whatsoever  
where no-wait fails to obtain a lock that would have been obtained  
immediately without no-wait, but I'm reluctant to interpret the  
semantics of no-wait that strictly.  
  
Robert Haas and Jingxian Li  
  
Discussion: http://postgr.es/m/CA+TgmobCH-kMXGVpb0BB-iNMdtcNkTvcZ4JBxDJows3kYM+GDg@mail.gmail.com  

M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h
A src/test/isolation/expected/lock-nowait.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/lock-nowait.spec

Fix contrib/pg_visibility/meson.build

commit   : c20d90a41ca869f9c6dd4058ad1c7f5c9ee9d912    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:38:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:38:44 +0200    

Click here for diff

I broke that in e85662df44ff by oversight.  

M contrib/pg_visibility/meson.build

Add TAP tests for timeouts

commit   : eeefd4280f6e5167d70efabb89586b7d38922d95    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:10:21 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:10:21 +0200    

Click here for diff

This commit adds new tests to verify that transaction_timeout,  
idle_session_timeout, and idle_in_transaction_session_timeout work as expected.  
We introduce new injection points in before throwing a timeout FATAL error  
and check these injection points are reached.  
  
Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com  
Author: Andrey Borodin  
Reviewed-by: Alexander Korotkov  

M src/backend/tcop/postgres.c
M src/test/modules/test_misc/Makefile
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/005_timeouts.pl

Fix false reports in pg_visibility

commit   : e85662df44ff47acdf5d2d413339445d60a9c30c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:08:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 13:08:53 +0200    

Click here for diff

Currently, pg_visibility computes its xid horizon using the  
GetOldestNonRemovableTransactionId().  The problem is that this horizon can  
sometimes go backward.  That can lead to reporting false errors.  
  
In order to fix that, this commit implements a new function  
GetStrictOldestNonRemovableTransactionId().  This function computes the xid  
horizon, which would be guaranteed to be newer or equal to any xid horizon  
computed before.  
  
We have to do the following to achieve this.  
  
1. Ignore processes xmin's, because they consider connection to other databases  
   that were ignored before.  
2. Ignore KnownAssignedXids, because they are not database-aware. At the same  
   time, the primary could compute its horizons database-aware.  
3. Ignore walsender xmin, because it could go backward if some replication  
   connections don't use replication slots.  
  
As a result, we're using only currently running xids to compute the horizon.  
Surely these would significantly sacrifice accuracy.  But we have to do so to  
avoid reporting false errors.  
  
Inspired by earlier patch by Daniel Shelepanov and the following discussion  
with Robert Haas and Tom Lane.  
  
Discussion: https://postgr.es/m/1649062270.289865713%40f403.i.mail.ru  
Reviewed-by: Alexander Lakhin, Dmitry Koval  

M contrib/pg_visibility/Makefile
M contrib/pg_visibility/meson.build
M contrib/pg_visibility/pg_visibility.c
A contrib/pg_visibility/t/001_concurrent_transaction.pl
M src/backend/storage/ipc/procarray.c
M src/include/storage/standby.h

Comment out noisy libpq_pipeline test

commit   : cc6e64afda530576d83e331365d36c758495a7cd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 14 Mar 2024 10:23:38 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 14 Mar 2024 10:23:38 +0100    

Click here for diff

libpq_pipeline's new 'cancel' test needs more research; disable it  
temporarily to prevent measles in the buildfarm.  

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

Fix documentation comment for pg_md5_hash

commit   : 6b41ef03306f50602f68593d562cd73d5e39a9b9    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Mar 2024 09:23:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Mar 2024 09:23:37 +0100    

Click here for diff

Commit b69aba74578 added the errstr parameter to pg_md5_hash but  
missed updating the synopsis in the documentation comment.  The  
follow-up commit 587de223f03 added the parameter to the list of  
outputs.  The returnvalue had been changed from integer to bool  
before that but remained in the synopsis.  This fixes both.  
  
Author: Tatsuro Yamada <[email protected]>  
Discussion: https://postgr.es/m/TYYPR01MB82313576150CC86084A122CD9E292@TYYPR01MB8231.jpnprd01.prod.outlook.com  

M src/common/md5_common.c

Fix typos in reorderbuffer.c.

commit   : 9c40db3b02a41e978ebeb2c61930498a36812bbf    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 14 Mar 2024 12:12:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 14 Mar 2024 12:12:55 +0530    

Click here for diff

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

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

Introduce "builtin" collation provider.

commit   : 2d819a08a1cbc11364e36f816b02e33e8dcc030b    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 13 Mar 2024 23:33:44 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 13 Mar 2024 23:33:44 -0700    

Click here for diff

New provider for collations, like "libc" or "icu", but without any  
external dependency.  
  
Initially, the only locale supported by the builtin provider is "C",  
which is identical to the libc provider's "C" locale. The libc  
provider's "C" locale has always been treated as a special case that  
uses an internal implementation, without using libc at all -- so the  
new builtin provider uses the same implementation.  
  
The builtin provider's locale is independent of the server environment  
variables LC_COLLATE and LC_CTYPE. Using the builtin provider, the  
database collation locale can be "C" while LC_COLLATE and LC_CTYPE are  
set to "en_US", which is impossible with the libc provider.  
  
By offering a new builtin provider, it clarifies that the semantics of  
a collation using this provider will never depend on libc, and makes  
it easier to document the behavior.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com  
Reviewed-by: Daniel Vérité, Peter Eisentraut, Jeremy Schneider  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/initdb.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/psql/describe.c
M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/utils/pg_locale.h
M src/test/icu/t/010_database.pl
M src/test/regress/expected/collate.out
M src/test/regress/sql/collate.sql

Put genbki.pl output into src/include/catalog/ directly

commit   : 6ab2e8385d55e0b73bb8bbc41d9c286f5f7f357f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2024 06:57:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2024 06:57:16 +0100    

Click here for diff

With the makefile rules, the output of genbki.pl was written to  
src/backend/catalog/, and then the header files were linked to  
src/include/catalog/.  
  
This changes it so that the output files are written directly to  
src/include/catalog/.  This makes the logic simpler, and it also makes  
the behavior consistent with the meson build system.  Also, the list  
of catalog files is now kept in parallel in  
src/include/catalog/{meson.build,Makefile}, while before the makefiles  
had it in src/backend/catalog/Makefile.  
  
Reviewed-by: Andreas Karlsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/Makefile
D src/backend/catalog/.gitignore
M src/backend/catalog/Makefile
M src/include/Makefile
M src/include/catalog/.gitignore
M src/include/catalog/Makefile
M src/include/catalog/meson.build
M src/tools/pginclude/headerscheck

Revert "Add basic TAP tests for the low-level backup method"

commit   : 6cb1b632b354518a595f1b23bfbac28a798f7f1c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2024 13:19:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2024 13:19:12 +0900    

Click here for diff

This reverts commit 99b4a63bef94.  The test is proving to be unstable,  
so revert it for now.  
  
One of the failures seen involves the cluster started without the  
backup_label, where the archives of the primary are overwritten, causing  
recovery failures on Windows.  This is simple to fix, but there is  
another issue that's creeping behind in the form of an "invalid data in  
file" ERROR when parsing the backup_label for the second recovery case,  
as an effect of the backup_label data written after retrieving its  
contents from pg_backup_stop().  
_  
Per buildfarm member sidewinder.  

D src/test/recovery/t/042_low_level_backup.pl

Add basic TAP tests for the low-level backup method

commit   : 99b4a63bef94b8e62a9a96c2446d1c16f95acd3b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2024 10:49:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2024 10:49:52 +0900    

Click here for diff

There are currently no tests for the low-level backup method where  
pg_backup_start() and pg_backup_stop() are involved while taking a  
file-system backup.  The tests introduced in this commit rely on a  
background psql process to make sure that the backup is taken while the  
session doing the SQL start and stop calls remains alive.  
  
Two cases are checked here with the backup taken:  
- Recovery without a backup_label, leading to a corrupted state.  
- Recovery with a backup_label, with a consistent state reached.  
Both cases cross-check some patterns in the logs generated when running  
recovery.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  

A src/test/recovery/t/042_low_level_backup.pl

Improve documentation for pg_stat_checkpointer fields

commit   : e820db5b56b20c68bce2956f8f6c8ba6bfff5735    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 02:07:27 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 14 Mar 2024 02:07:27 +0200    

Click here for diff

pg_stat_checkpointer contains statistics for checkpoints and restartpoints.  
Before 12915a58eec9 documentation said only about checkpoints implying that  
restartpoint is the variation of checkpoint.  12915a58eec9 introduced  
new separate statistics fields for restartpoints.  This commit explicitly  
documents fields that are relevant for both checkpoints and restartpoints.  
  
Reported-by: Magnus Hagander  
Discussion: https://postgr.es/m/CABUevExav5-SR0x%2BG9kBUMV0G8XsvSUfuyyqmYBBJi6VHns6sw%40mail.gmail.com  
Reviewed-by: Anton A. Melnikov  

M doc/src/sgml/monitoring.sgml
M src/include/catalog/pg_proc.dat

Reintroduce MAINTAIN privilege and pg_maintain predefined role.

commit   : ecb0fd33720fab91df1207e85704f382f55e1eb7    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 13 Mar 2024 14:49:26 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 13 Mar 2024 14:49:26 -0500    

Click here for diff

Roles with MAINTAIN on a relation may run VACUUM, ANALYZE, REINDEX,  
REFRESH MATERIALIZE VIEW, CLUSTER, and LOCK TABLE on the relation.  
Roles with privileges of pg_maintain may run those same commands on  
all relations.  
  
This was previously committed for v16, but it was reverted in  
commit 151c22deee due to concerns about search_path tricks that  
could be used to escalate privileges to the table owner.  Commits  
2af07e2f74, 59825d1639, and c7ea3f4229 resolved these concerns by  
restricting search_path when running maintenance commands.  
  
Bumps catversion.  
  
Reviewed-by: Jeff Davis  
Discussion: https://postgr.es/m/20240305161235.GA3478007%40nathanxps13  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/commands/tablecmds.h
M src/include/commands/vacuum.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/test/isolation/expected/cluster-conflict-partition.out
M src/test/isolation/specs/cluster-conflict-partition.spec
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/regress/expected/cluster.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/cluster.sql
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/privileges.sql

Add the system identifier to backup manifests.

commit   : 2041bc4276c95ac014510032e622a4baf70b29f1    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2024 15:04:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2024 15:04:22 -0400    

Click here for diff

Before this patch, if you took a full backup on server A and then  
tried to use the backup manifest to take an incremental backup on  
server B, it wouldn't know that the manifest was from a different  
server and so the incremental backup operation could potentially  
complete without error. When you later tried to run pg_combinebackup,  
you'd find out that your incremental backup was and always had been  
invalid. That's poor timing, because nobody likes finding out about  
backup problems only at restore time.  
  
With this patch, you'll get an error when trying to take the (invalid)  
incremental backup, which seems a lot nicer.  
  
Amul Sul, revised by me. Review by Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoYLZzbSAMM3cAjV4Y+iCRZn-bR9H2+Mdz7NdaJFU1Zb5w@mail.gmail.com  

M doc/src/sgml/backup-manifest.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup_incremental.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_combinebackup/load_manifest.h
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/t/005_integrity.pl
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_combinebackup/write_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/common/parse_manifest.c
M src/include/common/parse_manifest.h

Hopefully make libpq_pipeline's new cancel test more reliable

commit   : 1ee910ce437188eab40eddf32dc7d81952e99f82    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Mar 2024 19:53:49 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Mar 2024 19:53:49 +0100    

Click here for diff

The newly introduced cancel test in libpq_pipeline was flaky. It's not  
completely clear why, but one option is that the check for "active" was  
actually seeing the active state for the previous query. This change  
should address any such race condition by first waiting until the  
connection is reported as idle.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQRvmUK5-d68A+cm+fgmfht9Dv2uZ28-qq3QiaF6EAZqPQ@mail.gmail.com  

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

Expose new function get_controlfile_by_exact_path().

commit   : dbfc44716596073b99e093a04e29e774a518f520    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2024 12:06:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2024 12:06:44 -0400    

Click here for diff

This works just like get_controlfile(), but expects the path to the  
control file rather than the path to the data directory that contains  
the control file. This makes more sense in cases where the caller  
has already constructed the path to the control file itself.  
  
Amul Sul and Robert Haas, reviewed by Michael Paquier  

M src/bin/pg_combinebackup/pg_combinebackup.c
M src/common/controldata_utils.c
M src/include/common/controldata_utils.h

Make the order of the header file includes consistent

commit   : 97d85be365443eb4bf84373a7468624762382059    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2024 15:07:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2024 15:07:00 +0100    

Click here for diff

Similar to commit 7e735035f20.  
  
Author: Richard Guo <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs4-WhpCFMbXCjtJ%2BFzmjfPrp7Hw1pk4p%2BZpU95Kh3ofZ1A%40mail.gmail.com  

M contrib/pageinspect/gistfuncs.c
M contrib/postgres_fdw/deparse.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/printsimple.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/backup/basebackup_incremental.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/statscmds.c
M src/backend/commands/vacuum.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parser.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/logical/tablesync.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/sync/sync.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/error/elog.c
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/sort/tuplesortvariants.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_walsummary/pg_walsummary.c
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/pl/plpython/plpy_procedure.c
M src/test/modules/injection_points/injection_points.c
M src/test/modules/ldap_password_func/ldap_password_func.c
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/worker_spi/worker_spi.c

doc: Improve a couple of places in the MERGE docs.

commit   : 97d4262683acb586778af2b2a3721fa7cdc402f1    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 13 Mar 2024 13:16:24 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 13 Mar 2024 13:16:24 +0000    

Click here for diff

In the synopsis, make the syntax for merge_update consistent with the  
syntax for a plain UPDATE command. It was missing the optional "ROW"  
keyword that can be used in a multi-column assignment, and the option  
to assign from a multi-column subquery, both of which have been  
supported by MERGE since it was introduced.  
  
In the parameters section for the with_query parameter, mention that  
WITH RECURSIVE isn't supported, since this is different from plain  
INSERT, UPDATE, and DELETE commands. While at it, move that entry to  
the top of the list, for consistency with the other pages.  
  
Back-patch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCWoQyWkMFfu7JXXQr8dA6%3DgxjhYzgpuBP2oz0QoJTxGWw%40mail.gmail.com  

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

meson: macos: Avoid warnings on Sonoma

commit   : a3da95deee38ee067b0bead639c830eacbe894d5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Mar 2024 01:40:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Mar 2024 01:40:53 -0700    

Click here for diff

Starting with the Sonoma toolchain macos' linker emits warnings when the same  
library is linked to twice. That's ill considered, as the same library can be  
used by multiple subsidiary libraries. Luckily there's a flag to suppress that  
warning.  
  
On Ventura meson's default of -Wl,-undefined,dynamic_lookup caused warnings,  
which we suppressed with -Wl,-undefined,error. Unfortunately that causes a  
warning on Sonoma, which is absurd, as it's documented linker default. To  
avoid that warning, only add -Wl,-undefined,error if it does not trigger  
warnings. Luckily dynamic_lookup doesn't trigger a warning on Sonoma anymore.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the meson build was added  

M meson.build

Fix incorrect format placeholders

commit   : 6612185883c6a43979693358423ee647421ff621    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2024 06:40:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2024 06:40:32 +0100    

Click here for diff

M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c

Add tests for more row patterns with COPY FROM .. (ON_ERROR ignore)

commit   : a189ed49d6292979be1478292246be61c4563043    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2024 14:19:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2024 14:19:21 +0900    

Click here for diff

While digging into the code of this feature, I got confused by the fact  
that a line is skipped when a value cannot be converted to its expected  
attribute even if the line has fewer attributes than the target  
relation.  The tests had a check for the case of an empty line, this  
commit a couple more patterns where a line is incomplete, but skipped  
because of a conversion error.  
  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

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

Fix a random failure in 038_save_logical_slots_shutdown.pl.

commit   : 0b84f5c419a300dc1b1a70cf63b9907208e52643    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 13 Mar 2024 08:33:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 13 Mar 2024 08:33:26 +0530    

Click here for diff

The test ensures that all the WAL on the publisher is sent to the  
subscriber before shutdown by comparing the confirmed_flush_lsn of the  
associated slot with the shutdown_checkpoint WAL location. But if the  
shutdown_checkpoint location falls into a new page in the WAL then the  
check won't work. So, ensure that the shutdown_checkpoint WAL record  
doesn't fall into a new page.  
  
Reported-by: Bharath Rupireddy  
Author: Bharath Rupireddy  
Reviewed-by: Vignesh C, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/CALj2ACVLzH5CN-h9=S26mdRHPuJ9yDLUw70yh4JOiPw03WL0CQ@mail.gmail.com  

M src/test/recovery/t/038_save_logical_slots_shutdown.pl

ci: Use a RAM disk and more CPUs on FreeBSD.

commit   : 0265e5c120e0971a9c50a1e27ce4cb847c15a1bf    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 13 Mar 2024 14:51:24 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 13 Mar 2024 14:51:24 +1300    

Click here for diff

Run the tests in a RAM disk.  It's still a UFS file system and is backed  
by 20GB of disk, but this avoids a lot of I/O.  Even though we disable  
fsync, our tests do a lot of directory manipulations, some of which  
force file system meta-data to disk and flush slow device write caches  
on UFS.  This was a bottleneck preventing effective scaling beyond 2  
CPUs.  
  
Now we can use 4 CPUs like on other OSes, for a huge speedup.  
  
Reviewed-by: Maxim Orlov <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BFXLcEg1dyTqJjDiNQ8pGom4KrJj4wF38C90thti9dVA%40mail.gmail.com  

M .cirrus.tasks.yml
M src/tools/ci/gcp_freebsd_repartition.sh

Add some asserts based on LWLockHeldByMe() for replication slot statistics

commit   : 77cf6a78de9fa48976d8c9152a48290beb06dc8b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2024 07:45:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2024 07:45:11 +0900    

Click here for diff

Two assertions checking that ReplicationSlotAllocationLock is acquired  
are added to pgstat_create_replslot() and pgstat_drop_replslot(),  
corresponding to the routines in charge of the creation and the drop of  
replication slot statistics.  The code previously relied on this  
assumption and documented it in comments, but did not enforce this  
policy at runtime.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Fix version check in 002_pg_upgrade.pl.

commit   : 32dd2c1eff540e454d50a1d59d2d90ab6e70e0b6    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 12 Mar 2024 15:24:03 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 12 Mar 2024 15:24:03 -0700    

Click here for diff

Commit f696c0cd5f tried to account for the version in a way that  
includes development versions, but it was broken. Fix with suggestion  
from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Tom Lane  

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

Fix confusion about the return rowtype of SQL-language procedures.

commit   : 6ee3261e9bb6f0aa30ec74896c57f69b0636bfdd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2024 18:16:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2024 18:16:10 -0400    

Click here for diff

There is a very ancient hack in check_sql_fn_retval that allows a  
single SELECT targetlist entry of composite type to be taken as  
supplying all the output columns of a function returning composite.  
(This is grotty and fundamentally ambiguous, but it's really hard  
to do nested composite-returning functions without it.)  
  
As far as I know, that doesn't cause any problems in ordinary  
functions.  It's disastrous for procedures however.  All procedures  
that have any output parameters are labeled with prorettype RECORD,  
and the CALL code expects it will get back a record with one column  
per output parameter, regardless of whether any of those parameters  
is composite.  Doing something else leads to an assertion failure  
or core dump.  
  
This is simple enough to fix: we just need to not apply that rule  
when considering procedures.  However, that requires adding another  
argument to check_sql_fn_retval, which at least in principle might be  
getting called by external callers.  Therefore, in the back branches  
convert check_sql_fn_retval into an ABI-preserving wrapper around a  
new function check_sql_fn_retval_ext.  
  
Per report from Yahor Yuzefovich.  This has been broken since we  
implemented procedures, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CABz5gWHSjj2df6uG0NRiDhZ_Uz=Y8t0FJP-_SVSsRsnrQT76Gg@mail.gmail.com  

M src/backend/catalog/pg_proc.c
M src/backend/executor/functions.c
M src/backend/optimizer/util/clauses.c
M src/include/executor/functions.h
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Fix incorrect filename reference in comment

commit   : fe4750effd61f5a37d18c48caa53892dbdcfb96d    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Mar 2024 09:34:11 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Mar 2024 09:34:11 +1300    

Click here for diff

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

M src/include/optimizer/paths.h

libpq: Add encrypted and non-blocking query cancellation routines

commit   : 61461a300c1cb5d53955ecd792ad0ce75a104736    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Mar 2024 17:32:25 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Mar 2024 17:32:25 +0100    

Click here for diff

The existing PQcancel API uses blocking IO, which makes PQcancel  
impossible to use in an event loop based codebase without blocking the  
event loop until the call returns.  It also doesn't encrypt the  
connection over which the cancel request is sent, even when the original  
connection required encryption.  
  
This commit adds a PQcancelConn struct and assorted functions, which  
provide a better mechanism of sending cancel requests; in particular all  
the encryption used in the original connection are also used in the  
cancel connection.  The main entry points are:  
  
- PQcancelCreate creates the PQcancelConn based on the original  
  connection (but does not establish an actual connection).  
- PQcancelStart can be used to initiate non-blocking cancel requests,  
  using encryption if the original connection did so, which must be  
  pumped using  
- PQcancelPoll.  
- PQcancelReset puts a PQcancelConn back in state so that it can be  
  reused to send a new cancel request to the same connection.  
- PQcancelBlocking is a simpler-to-use blocking API that still uses  
  encryption.  
  
Additional functions are  
 - PQcancelStatus, mimicks PQstatus;  
 - PQcancelSocket, mimicks PQcancelSocket;  
 - PQcancelErrorMessage, mimicks PQerrorMessage;  
 - PQcancelFinish, mimicks PQfinish.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Reviewed-by: Denis Laxalde <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/tools/pgindent/typedefs.list

Fix copying SockAddr struct

commit   : cb9663e20dc2ddc904660d12638f6c82af7b420e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 15:31:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 15:31:02 +0200    

Click here for diff

Valgrind alerted about accessing uninitialized bytes after commit  
4945e4ed4a:  
  
==700242== VALGRINDERROR-BEGIN  
==700242== Conditional jump or move depends on uninitialised value(s)  
==700242==    at 0x6D8A2A: getnameinfo_unix (ip.c:253)  
==700242==    by 0x6D8BD1: pg_getnameinfo_all (ip.c:122)  
==700242==    by 0x4B3EB6: BackendInitialize (postmaster.c:4266)  
==700242==    by 0x4B684E: BackendStartup (postmaster.c:4114)  
==700242==    by 0x4B6986: ServerLoop (postmaster.c:1780)  
==700242==    by 0x4B80CA: PostmasterMain (postmaster.c:1478)  
==700242==    by 0x3F7424: main (main.c:197)  
==700242==  Uninitialised value was created by a stack allocation  
==700242==    at 0x4B6934: ServerLoop (postmaster.c:1737)  
==700242==  
==700242== VALGRINDERROR-END  
  
That was because the SockAddr struct was not copied correctly.  
  
Per buildfarm animal "skink".  

M src/backend/libpq/pqcomm.c

Move initialization of the Port struct to the child process

commit   : 4945e4ed4a72c3ff41560ccef722c3d70ae07dbb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:38 +0200    

Click here for diff

In postmaster, use a more lightweight ClientSocket struct that  
encapsulates just the socket itself and the remote endpoint's address  
that you get from accept() call. ClientSocket is passed to the child  
process, which initializes the bigger Port struct. This makes it more  
clear what information postmaster initializes, and what is left to the  
child process.  
  
Rename the StreamServerPort and StreamConnection functions to make it  
more clear what they do. Remove StreamClose, replacing it with plain  
closesocket() calls.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/tools/pgindent/typedefs.list

Pass CAC as an argument to the backend process

commit   : d162c3a73bf14416ff4012de6f01c3d825610f70    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:36 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:36 +0200    

Click here for diff

We used to smuggle it to the child process in the Port struct, but it  
seems better to pass it down as a separate argument. This paves the  
way for the next commit, which moves the initialization of the Port  
struct to the backend process, after forking.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c
M src/include/libpq/libpq-be.h

Set socket options in child process after forking

commit   : 73f7fb2a4c4480cfebc52dddf0049e69b830b214    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:28 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 13:42:28 +0200    

Click here for diff

Try to minimize the work done in the postmaster process for each  
accepted connection, so that postmaster can quickly proceed with its  
duties. These function calls are very fast so this doesn't make any  
measurable performance difference in practice, but it's nice to have  
all the socket options initialization code in one place for sake of  
readability too. This also paves the way for an upcoming commit that  
will move the initialization of the Port struct to the child process.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqcomm.c

Disconnect if socket cannot be put into non-blocking mode

commit   : f8c5317d001556a51441fad81e8f6c32994f2d79    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 10:18:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 12 Mar 2024 10:18:32 +0200    

Click here for diff

Commit 387da18874 moved the code to put socket into non-blocking mode  
from socket_set_nonblocking() into the one-time initialization  
function, pq_init(). In socket_set_nonblocking(), there indeed was a  
risk of recursion on failure like the comment said, but in pq_init(),  
ERROR or FATAL is fine. There's even another elog(FATAL) just after  
this, if setting FD_CLOEXEC fails.  
  
Note that COMMERROR merely logged the error, it did not close the  
connection, so if putting the socket to non-blocking mode failed we  
would use the connection anyway. You might not immediately notice,  
because most socket operations in a regular backend wait for the  
socket to become readable/writable anyway. But e.g. replication will  
be quite broken.  
  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqcomm.c

libpq: Move pg_cancel to fe-cancel.c

commit   : 4dec98c2af64851b643af14c36c8b99215dfd70d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Mar 2024 09:11:24 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Mar 2024 09:11:24 +0100    

Click here for diff

No other files need to access this struct, so there is no need to have  
its definition in a header file.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Keep replication slot statistics on invalidation

commit   : d6e171fed6c56fc17405445951d5028b7c86a4e3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2024 14:22:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2024 14:22:31 +0900    

Click here for diff

The code path in charge of invalidating a replication slot includes a  
call to pgstat_drop_replslot(), which would result in removing the  
statistics of the slot once invalidated.  However, there is no need to  
remove the statistics of an invalidated slot as one could still be  
interested in looking at them to understand the activity of the slot  
until its actual removal.  
  
The initial design of the feature committed in be87200efd used the  
approach to drop the slots, which is likely why the statistics were  
still removed during the invalidation.  
  
Another problem with this operation is that it was done without holding  
ReplicationSlotAllocationLock, leaving it unprotected on concurrent  
activity.  This part is arguably a bug, but that's a limited problem in  
practice so no backpatch is done.  
  
In passing, this commit adds a test to check this behavior.  The only  
remaining code path where slot statistics are dropped now related to the  
slot getting dropped.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Remove redundant fetch of the recent flush pointer in WalSndWaitForWal.

commit   : 397cd0b3c7d18c21daea175a8280afea723f4eac    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 12 Mar 2024 10:25:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 12 Mar 2024 10:25:27 +0530    

Click here for diff

In WalSndWaitForWal(), we fetch a recent flush pointer both outside the  
loop and inside the loop. But we start using RecentFlushPtr only after we  
fetch it inside the loop. So we can remove one outside the loop.  
  
Author: Shveta Malik  
Reviewed-by: Bertrand Drouvot, Matthias van de Meent, Amit Kapila  
Discussion: https://postgr.es/m/CAJpy0uBSCQz1yMD-WiEthzEe23dti2-Kr_pitVb7vAPFbFKm=A@mail.gmail.com  

M src/backend/replication/walsender.c

Use printf's %m format instead of strerror(errno) in more places

commit   : 2c8118ee5d980e11f73683fcda2329c323aa381e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2024 10:02:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2024 10:02:54 +0900    

Click here for diff

Most callers of strerror() are removed from the backend code.  The  
remaining callers require special handling with a saved errno from a  
previous system call.  The frontend code still needs strerror() where  
error states need to be handled outside of fprintf.  
  
Note that pg_regress is not changed to use %m as the TAP output may  
clobber errno, since those functions call fprintf() and friends before  
evaluating the format string.  
  
Support for %m in src/port/snprintf.c has been added in d6c55de1f99a,  
hence all the stable branches currently supported include it.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/findtimezone.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/version.c
M src/common/psprintf.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/port/path.c
M src/test/isolation/isolationtester.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/tools/ifaddrs/test_ifaddrs.c

Update obsolete index scan TID comments.

commit   : 3045324214467dd3f0bef31f6f33562b9eb93aa3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 11 Mar 2024 18:07:10 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 11 Mar 2024 18:07:10 -0400    

Click here for diff

Oversight in commit c2fe139c20.  

M src/backend/access/hash/hashsearch.c
M src/backend/access/nbtree/nbtsearch.c

Fix 002_pg_upgrade.pl.

commit   : bbbf71d9a68103e00f73dae02fa6de6d60c3b86a    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 11 Mar 2024 13:57:37 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 11 Mar 2024 13:57:37 -0700    

Click here for diff

Commit f696c0cd5f caused a test failure in 002_pg_upgrade.pl, because  
an earlier s/// operator caused qr// to no longer match the empty  
string. Use qr/^$/ instead, which is a better test anyway, because we  
expect the stderr to be empty.  
  
Initially this appeared to be a perl bug, but per discussion, it seems  
that it was a misunderstanding of how perl works: an empty pattern  
uses the last successful pattern. Given how surprising that behavior  
is to perl non-experts, we will need to look for similar problems  
elsewhere and eliminate the use of empty patterns throughout the  
code. For now, address this one instance to fix the buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tom Lane  

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

Add tests for libpq query cancellation APIs

commit   : 319e9e53f3797fe4a4753b54a98ab717bb2f2ca0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2024 21:54:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2024 21:54:03 +0100    

Click here for diff

This is in preparation of making changes and additions to these APIs.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQRb21spiiykQ48rzz8w+Hcykz+mB2_hxR65D9Qk6nnw=w@mail.gmail.com  

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

reindexdb: Allow specifying objects to process in all databases.

commit   : 24c928ad9ad801048684569d2b67463c3ec8fdb0    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 15:42:27 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 15:42:27 -0500    

Click here for diff

Presently, reindexdb's --table, --schema, --index, and --system  
options cannot be used together with --all, i.e., you cannot  
specify objects to process in all databases.  This commit removes  
this unnecessary restriction.  Furthermore, it removes the  
restriction that --system cannot be used with --table, --schema,  
and --index.  There is no such restriction for the latter options,  
and there is no technical reason to disallow these combinations.  
  
Reviewed-by: Kyotaro Horiguchi, Dean Rasheed  
Discussion: https://postgr.es/m/20230628232402.GA1954626%40nathanxps13  

M doc/src/sgml/ref/reindexdb.sgml
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl

Remove unneeded vacuum_delay_point from heap_vac_scan_get_next_block

commit   : 3d8652cd32846e4f9eaff9580858d281136bd0fd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 20:43:04 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 20:43:04 +0200    

Click here for diff

heap_vac_scan_get_next_block() does relatively little work, so there  
is no need to call vacuum_delay_point(). A future commit will call  
heap_vac_scan_get_next_block() from a callback, and we would like to  
avoid calling vacuum_delay_point() in that callback.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_Yf3gvXGcCnqqfoq0Q8LX8UM-e-qbm_B1LeZh60f8WhWA%40mail.gmail.com  

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

Confine vacuum skip logic to lazy_scan_skip()

commit   : 4e76f984a7730cde81e2cfc015de6c2b3dadca99    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 20:43:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 20:43:58 +0200    

Click here for diff

Rename lazy_scan_skip() to heap_vac_scan_next_block() and move more  
code into the function, so that the caller doesn't need to know about  
ranges or skipping anymore. heap_vac_scan_next_block() returns the  
next block to process, and the logic for determining that block is all  
within the function. This makes the skipping logic easier to  
understand, as it's all in the same function, and makes the calling  
code easier to understand as it's less cluttered. The state variables  
needed to manage the skipping logic are moved to LVRelState.  
  
heap_vac_scan_next_block() now manages its own VM buffer separately  
from the caller's vmbuffer variable. The caller's vmbuffer holds the  
VM page for the current block its processing, while  
heap_vac_scan_next_block() keeps a pin on the VM page for the next  
unskippable block. Most of the time they are the same, so we hold two  
pins on the same buffer, but it's more convenient to manage them  
separately.  
  
For readability inside heap_vac_scan_next_block(), move the logic of  
finding the next unskippable block to separate function, and add some  
comments.  
  
This refactoring will also help future patches to switch to using a  
streaming read interface, and eventually AIO  
(https://postgr.es/m/CA%2BhUKGJkOiOCa%2Bmag4BF%2BzHo7qo%3Do9CFheB8%3Dg6uT5TUm2gkvA%40mail.gmail.com)  
  
Author: Melanie Plageman, Heikki Linnakangas  
Reviewed-by: Andres Freund (older version)  
Discussion: https://postgr.es/m/CAAKRu_Yf3gvXGcCnqqfoq0Q8LX8UM-e-qbm_B1LeZh60f8WhWA%40mail.gmail.com  

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

clusterdb: Allow specifying tables to process in all databases.

commit   : 1b49d56d358a9c2e310d66c0ac87216d9b932b78    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 13:11:20 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 13:11:20 -0500    

Click here for diff

Presently, clusterdb's --table option cannot be used together with  
--all, i.e., you cannot specify tables to process in all databases.  
This commit removes this unnecessary restriction.  In passing,  
change the synopsis in the documentation to use "[option...]"  
instead of "[--verbose | -v]".  There are other general-purpose  
options (e.g., --quiet and --echo), but the synopsis currently only  
lists --verbose.  
  
Reviewed-by: Kyotaro Horiguchi, Dean Rasheed  
Discussion: https://postgr.es/m/20230628232402.GA1954626%40nathanxps13  

M doc/src/sgml/ref/clusterdb.sgml
M src/bin/scripts/clusterdb.c
M src/bin/scripts/t/011_clusterdb_all.pl

doc: add missing word "the"

commit   : 5fb4cea1b4a28267eeb564f1e57cbdfd39f1eea6    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 Mar 2024 13:31:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 Mar 2024 13:31:13 -0400    

Click here for diff

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

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

Add missing connection statuses to docs

commit   : 095493a3771a99d0e4c906ad1cc33791efaa7248    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2024 17:20:36 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2024 17:20:36 +0100    

Click here for diff

The list of connection statuses that PQstatus might return during an  
asynchronous connection attempt was outdated:  
  
1. CONNECTION_SETENV is never returned anymore and is only part of the  
   enum for backwards compatibility, so remove it from the docs.  
2. CONNECTION_CHECK_STANDBY and CONNECTION_GSS_STARTUP were not listed,  
   so add them.  
  
CONNECTION_NEEDED and CONNECTION_CHECK_TARGET are not listed in the docs  
on purpose, since these are internal states that can never be observed  
by a caller of PQstatus.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQRb21spiiykQ48rzz8w+Hcykz+mB2_hxR65D9Qk6nnw=w@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/libpq-fe.h

vacuumdb: Allow specifying objects to process in all databases.

commit   : 648928c79bed975a89fa2e4ef8bc0bade8e0e0d8    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 10:33:36 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 11 Mar 2024 10:33:36 -0500    

Click here for diff

Presently, vacuumdb's --table, --schema, and --exclude-schema  
options cannot be used together with --all, i.e., you cannot  
specify tables or schemas to process in all databases.  This commit  
removes this unnecessary restriction, thus enabling potentially  
useful commands like "vacuumdb --all --schema pg_catalog".  
  
Reviewed-by: Kyotaro Horiguchi, Dean Rasheed  
Discussion: https://postgr.es/m/20230628232402.GA1954626%40nathanxps13  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

Set all_visible_according_to_vm correctly with DISABLE_PAGE_SKIPPING

commit   : 674e49c73c1c442d05a46388fcc1431fbd59ca44    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 09:28:09 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 09:28:09 +0200    

Click here for diff

It's important for 'all_visible_according_to_vm' to correctly reflect  
whether the VM bit is set or not, even when we are not trusting the VM  
to skip pages, because contrary to what the comment said,  
lazy_scan_prune() relies on it.  
  
If it's incorrectly set to 'false', when the VM bit is in fact set,  
lazy_scan_prune() will try to set the VM bit again and dirty the page  
unnecessarily. As a result, if you used DISABLE_PAGE_SKIPPING, all  
heap pages were dirtied, even if there were no changes. We would also  
fail to clear any VM bits that were set incorrectly.  
  
This was broken in commit 980ae17310, so backpatch to v16.  
  
Backpatch-through: 16  
Reviewed-by: Melanie Plageman, Peter Geoghegan  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Don't destroy SMgrRelations at relcache invalidation

commit   : af0e7deb4a1c369bb8154ac55f085d6a93fe5c35    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 09:08:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Mar 2024 09:08:02 +0200    

Click here for diff

With commit 21d9c3ee4e, SMgrRelations remain valid until end of  
transaction (or longer if they're "pinned"). Relcache invalidation can  
happen in the middle of a transaction, so we must not destroy them at  
relcache invalidation anymore.  
  
This was revealed by failures in the 'constraints' test in buildfarm  
animals using -DCLOBBER_CACHE_ALWAYS. That started failing with commit  
8af2565248, which was the first commit that started to rely on an  
SMgrRelation living until end of transaction.  
  
Diagnosed-by: Tomas Vondra, Thomas Munro  
Reviewed-by: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGK%2B5DOmLaBp3Z7C4S-Yv6yoROvr1UncjH2S1ZbPT8D%2BZg%40mail.gmail.com  

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

Fix incorrect accessing of pfree'd memory in Memoize

commit   : e629846472255c7a636c453a522755ef05489c90    
  
author   : David Rowley <[email protected]>    
date     : Mon, 11 Mar 2024 18:19:56 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 11 Mar 2024 18:19:56 +1300    

Click here for diff

For pass-by-reference types, the code added in 0b053e78b, which aimed to  
resolve a memory leak, was overly aggressive in resetting the per-tuple  
memory context which could result in pfree'd memory being accessed  
resulting in failing to find previously cached results in the hash  
table.  
  
What was happening was prepare_probe_slot() was switching to the  
per-tuple memory context and calling ExecEvalExpr().  ExecEvalExpr() may  
have required a memory allocation.  Both MemoizeHash_hash() and  
MemoizeHash_equal() were aggressively resetting the per-tuple context  
and after determining the hash value, the context would have gotten reset  
before MemoizeHash_equal() was called.  This could have resulted in  
MemoizeHash_equal() looking at pfree'd memory.  
  
This is less likely to have caused issues on a production build as some  
other allocation would have had to have reused the pfree'd memory to  
overwrite it.  Otherwise, the original contents would have been intact.  
However, this clearly caused issues on MEMORY_CONTEXT_CHECKING builds.  
  
Author: Tender Wang, Andrei Lepikhov  
Reported-by: Tender Wang (using SQLancer)  
Reviewed-by: Andrei Lepikhov, Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAHewXNnT6N6UJkya0z-jLFzVxcwGfeRQSfhiwA+NyLg-x8iGew@mail.gmail.com  
Backpatch-through: 14, where Memoize was added  

M src/backend/executor/nodeMemoize.c
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Doc: Warn about two_phase when altering a subscription's slot name.

commit   : 21e3a8bc3544a1cfcff85933bc9c0664af32a8b8    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 11 Mar 2024 09:33:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 11 Mar 2024 09:33:04 +0530    

Click here for diff

We expect the 'two_phase' and 'failover' properties to match between the  
slot on the publisher and a subscription option on the subscriber.  
Otherwise, the slot on the publisher may behave differently from what the  
subscription's failover option says.  
  
Author: Bertrand Drouvot  
Reviewed-by: Peter Smith, Tristen Raab, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_subscription.sgml

Improve consistency of replication slot statistics

commit   : b36fbd9f8da140f5b0ef9f7daa6b3cb4cae8a69b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 10:25:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 10:25:01 +0900    

Click here for diff

The replication slot stats stored in shared memory rely on an internal  
index number.  Both pgstat_reset_replslot() and pgstat_fetch_replslot()  
lacked some LWLock protections with ReplicationSlotControlLock while  
operating on these index numbers.  This issue could cause these two  
functions to potentially operate on incorrect slots when taken in  
isolation in the event of slots dropped and/or re-created concurrently.  
  
Note that pg_stat_get_replication_slot() is called once per slot when  
querying pg_stat_replication_slots, meaning that the stats are retrieved  
across multiple ReplicationSlotControlLock acquisitions.  So, while this  
commit improves more consistency, it may still be possible that  
statistics are not completely consistent for a single scan of  
pg_stat_replication_slots under concurrent replication slot drop or  
creation activity.  
  
The issue should unlikely be a problem in practice, causing the report  
of inconsistent stats or or the stats reset of an incorrect slot, so no  
backpatch is done.  
  
Author: Bertrand Drouvot  
Reviewed-by: Heikki Linnakangas, Shveta Malik, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add some checkpoint and redo LSNs to a couple of recovery errors

commit   : f500ba07fa9d00eaa2d26ea66401e62f950163ae    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 09:08:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 09:08:05 +0900    

Click here for diff

Two FATALs and one PANIC gain details about the LSNs they fail at:  
- When restoring from a backup_label, the FATAL log generated when not  
finding the checkpoint record now reports its LSN.  
- When restoring from a backup_label, the FATAL log generated when not  
finding the redo record referenced by a checkpoint record now shows both  
the redo and checkpoint record LSNs.  
- When not restoring from a backup_label, the PANIC error generated when  
not finding the checkpoint record now reports its LSN.  
  
This information is useful when debugging corruption issues, and these  
LSNs may not show up in the logs depending on the level of logging  
configured in the backend.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  

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

Improve support for ExplainOneQuery() hook

commit   : a04ddd077e61096da660e1c2f205e0c8277f2dcd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 08:40:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2024 08:40:40 +0900    

Click here for diff

There is a hook called ExplainOneQuery_hook that gives modules the  
possibility to plug into this code path, but, like utility.c for utility  
statement execution, there is no corresponding "standard" routine in  
the case of EXPLAIN executed for one Query.  
  
This commit adds a new standard_ExplainOneQuery() in explain.c, which is  
able to run explain on a non-utility Query without calling its hook.  
  
Per the feedback received from a couple of hackers, this change gives  
the possibility to cut a few hundred lines of code in some of the  
popular out-of-core modules as these maintained a copy of  
ExplainOneQuery(), adding custom extra information at the beginning or  
the end of the EXPLAIN output.  
  
Author: Mats Kindahl  
Reviewed-by: Aleksander Alekseev, Jelte Fennema-Nio, Andrei Lepikhov  
Discussion: https://postgr.es/m/CA+14427V_B4EAoC_o-iYYucRdMSOTfpuH9k-QbexffY1HYJBiA@mail.gmail.com  

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

Fix deparsing of Consts in postgres_fdw ORDER BY

commit   : c399248b3b44bd6cece1ada47eee346b67a88a0a    
  
author   : David Rowley <[email protected]>    
date     : Mon, 11 Mar 2024 12:27:11 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 11 Mar 2024 12:27:11 +1300    

Click here for diff

For UNION ALL queries where a union child query contained a foreign  
table, if the targetlist of that query contained a constant, and the  
top-level query performed an ORDER BY which contained the column for the  
constant value, then postgres_fdw would find the EquivalenceMember with  
the Const and then try to produce an ORDER BY containing that Const.  
  
This caused problems with INT typed Consts as these could appear to be  
requests to order by an ordinal column position rather than the constant  
value.  This could lead to either an error such as:  
  
ERROR:  ORDER BY position <int const> is not in select list  
  
or worse, if the constant value is a valid column, then we could just  
sort by the wrong column altogether.  
  
Here we fix this issue by just not including these Consts in the ORDER  
BY clause.  
  
In passing, add a new section for testing ORDER BY in the postgres_fdw  
tests and move two existing tests which were misplaced in the WHERE  
clause testing section into it.  
  
Reported-by: Michał Kłeczek  
Reviewed-by: Ashutosh Bapat, Richard Guo  
Bug: #18381  
Discussion: https://postgr.es/m/0714C8B8-8D82-4ABB-9F8D-A0C3657E7B6E%40kleczek.org  
Discussion: https://postgr.es/m/18381-137456acd168bf93%40postgresql.org  
Backpatch-through: 12, oldest supported version  

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

Combine headerscheck and cpluspluscheck scripts

commit   : 7b8e2ae2fd3bec55e2d8c51e49871954851b5df8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 10 Mar 2024 07:33:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 10 Mar 2024 07:33:57 +0100    

Click here for diff

They are mostly the same, and it is tedious to maintain two copies of  
essentially the same exclude list.  headerscheck now has a new option  
--cplusplus to select the cpluspluscheck functionality.  The top-level  
make targets are still the same.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M GNUmakefile.in
D src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Catalog changes preparing for builtin collation provider.

commit   : f696c0cd5f299f1b51e214efc55a22a782cc175d    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 14:48:18 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 14:48:18 -0800    

Click here for diff

Rename pg_collation.colliculocale to colllocale, and  
pg_database.daticulocale to datlocale. These names reflects that the  
fields will be useful for the upcoming builtin provider as well, not  
just for ICU.  
  
This is purely a rename; no changes to the meaning of the fields.  
  
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/psql.out
M src/test/regress/sql/collate.icu.utf8.sql

Make contrib/tablefunc crosstab() also check typmod

commit   : 81d13a8dc066e571dca032da0a5fc1d81214d2bb    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 9 Mar 2024 17:32:32 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 9 Mar 2024 17:32:32 -0500    

Click here for diff

contrib/tablefunc connectby() checks both type OID and typmod for  
its output columns while crosstab() only checks type OID. Fix that  
by makeing the crosstab() check look more like the connectby() check.  
  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/flat/18937.1709676295%40sss.pgh.pa.us  

M contrib/tablefunc/tablefunc.c

Simplify and merge unwanted-module drop logic in AdjustUpgrade.pm.

commit   : 519443162dce52a3b10372338401d63084f720b8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2024 16:20:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2024 16:20:44 -0500    

Click here for diff

In be7800674 and followups, we failed to notice that there was  
already a better way to do it: instead of using DROP DATABASE  
IF EXISTS, we can check the list of existing DBs.  Also, there  
seems no reason not to merge this into the pre-existing code  
for getting rid of unwanted module databases.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve wrong-tuple-type error reports in contrib/tablefunc.

commit   : 76904eda25500dd4c6969f3a2a7c0f00146fd763    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2024 15:48:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2024 15:48:21 -0500    

Click here for diff

These messages were fairly confusing, and didn't match the  
column names used in the SGML docs.  Try to improve that.  
Also use error codes more specific than ERRCODE_SYNTAX_ERROR.  
  
Patch by me, reviewed by Joe Conway  
  
Discussion: https://postgr.es/m/[email protected]  

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

Run perltidy on 002_pg_upgrade.pl.

commit   : b0289574bdf1202248201a3143d1459bdf5727fd    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 11:51:10 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 11:51:10 -0800    

Click here for diff

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

Fix cross-version pg_upgrade test.

commit   : 5ba8b70debb119813f241069bf359c00e4a784f0    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 11:48:52 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 9 Mar 2024 11:48:52 -0800    

Click here for diff

Pass each statement as a separate '-c' arg, so they don't get combined  
into a single transaction.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tom Lane  

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

Document units of "timeout" in ConditionVariableTimedSleep()

commit   : f160bf06f72ab242a8336eff108a1f4e69539b77    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 9 Mar 2024 15:44:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 9 Mar 2024 15:44:41 +0900    

Click here for diff

The timeout is passed down to WaitLatch() as milliseconds.  
  
Author: Shveta Malik  
Discussion: https://postgr.es/m/CAJpy0uC=xiBQD1WapgYYvOiytap6ULJaakLd867zZXqu9tYc8w@mail.gmail.com  

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

Fix type signedness error in commit 5c40364dd6.

commit   : 33ee2550d30bebb938238846369b2aae10e7f00f    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Mar 2024 15:58:32 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Mar 2024 15:58:32 -0800    

Click here for diff

Use ssize_t instead of size_t.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Heikki Linnakangas  

M src/common/unicode_case.c
M src/include/common/unicode_case.h

Fix errorhandling for reading from a pipe

commit   : be41a9b0380778a07386208afbf3f41ba7286cf3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Mar 2024 22:53:06 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Mar 2024 22:53:06 +0100    

Click here for diff

When reading a line from a pipe failed on no data being read, the  
errorhandling was erroneously logging with %m even thoug no error  
description is available for %m to print.  This flaw accidentally  
introduced in 5c7038d70bb.  
  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c

Replace perror with custom postgres logging

commit   : 6929e133b309d5d4568b5ed25b136935f63be618    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Mar 2024 22:50:20 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Mar 2024 22:50:20 +0100    

Click here for diff

perror() is not used in postgres anymore out of policy, this replaces  
the final callsites with the custom postgres logging framework.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c

Improve WIN32 waiting logic in psql's \watch command.

commit   : f07a20c8a3b15e71d3cbfcfed0600956042cbe74    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2024 12:07:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2024 12:07:35 -0500    

Click here for diff

do_watch had some leftover logic for enabling siglongjmp out of  
waiting for input.  That's never done anything on Windows (cf.  
psql_cancel_callback), and do_watch no longer relies on it for  
non-Windows, so let's drop it.  
  
Also, when the user cancels \watch by pressing ^C, the Windows  
code would run the query one more time before exiting.  That doesn't  
seem very desirable, and it's not what happens on other platforms.  
Use the "done" flag similarly to non-Windows to avoid the extra query  
execution.  
  
Yugo Nagata (with minor fixes by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Admit deferrable PKs into rd_pkindex, but flag them as such

commit   : 270af6f0df764d326e1a7355f4ce10dc73b05dac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Mar 2024 16:32:29 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Mar 2024 16:32:29 +0100    

Click here for diff

... and in particular don't return them as replica identity.  
  
The motivation for this change is letting the primary keys be seen by  
code that derives NOT NULL constraints from them, when creating  
inheritance children; before this change, if you had a deferrable PK,  
pg_dump would not recreate the attnotnull marking properly, because the  
column would not be considered as having anything to back said marking  
after dropping the throwaway NOT NULL constraint.  
  
The reason we don't want these PKs as replica identities is that  
replication can corrupt data, if the uniqueness constraint is  
transiently broken.  
  
Reported-by: Amul Sul <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  
Discussion: https://postgr.es/m/CAAJ_b94QonkgsbDXofakHDnORQNgafd1y3Oa5QXfpQNJyXyQ7A@mail.gmail.com  

M src/backend/replication/logical/relation.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h
M src/test/regress/expected/constraints.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/publication.sql
M src/test/regress/sql/replica_identity.sql

Avoid recursion in MemoryContext functions

commit   : 4c1973fcaecd9ef11de14ac55d3ec1432f6b82dc    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:01:36 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:01:36 +0200    

Click here for diff

You might run out of stack space with recursion, which is not nice in  
functions that might be used e.g. at cleanup after transaction  
abort. MemoryContext contains pointer to parent and siblings, so we  
can traverse a tree of contexts iteratively, without using  
stack. Refactor the functions to do that.  
  
MemoryContextStats() still recurses, but it now has a limit to how  
deep it recurses. Once the limit is reached, it prints just a summary  
of the rest of the hierarchy, similar to how it summarizes contexts  
with lots of children. That seems good anyway, because a context dump  
with hundreds of nested contexts isn't very readable.  
  
Report by Egor Chindyaskin and Alexander Lakhin.  
  
Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru  
Author: Heikki Linnakangas  
Reviewed-by: Robert Haas, Andres Freund, Alexander Korotkov, Tom Lane  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Avoid stack overflow in ShowTransactionStateRec()

commit   : 6f38c43eb135f5d6b873924180562d8334d6e31d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:01:12 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:01:12 +0200    

Click here for diff

The function recurses, but didn't perform stack-depth checks. It's  
just a debugging aid, so instead of the usual check_stack_depth()  
call, stop the printing if we'd risk stack overflow.  
  
Here's an example of how to test this:  
  
    (n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT s$i;"; done; printf "SET log_min_messages = 'DEBUG5'; SAVEPOINT sp;") | psql >/dev/null  
  
In the passing, swap building the list of child XIDs and recursing to  
parent. That saves memory while recursing, reducing the risk of out of  
memory errors with lots of subtransactions. The saving is not very  
significant in practice, but this order seems more logical anyway.  
  
Report by Egor Chindyaskin and Alexander Lakhin.  
  
Discussion: https://www.postgresql.org/message-id/1672760457.940462079%40f306.i.mail.ru  
Author: Heikki Linnakangas  
Reviewed-by: Robert Haas, Andres Freund, Alexander Korotkov  

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

Turn tail recursion into iteration in CommitTransactionCommand()

commit   : fefd9a3fed275cecd9ed4091b00698deed39b92e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:00:40 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 8 Mar 2024 13:00:40 +0200    

Click here for diff

Usually the compiler will optimize away the tail recursion anyway, but  
if it doesn't, you can drive the function into stack overflow. For  
example:  
  
    (n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT s$i;"; done; printf "ERROR; COMMIT;") | psql >/dev/null  
  
In order to get better readability and less changes to the existing code the  
recursion-replacing loop is implemented as a wrapper function.  
  
Report by Egor Chindyaskin and Alexander Lakhin.  
Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru  
Author: Alexander Korotkov, Heikki Linnakangas  

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

commit   : 6d9751fa8fd40c988541c9c72ac7a2095ba73c19    
  
author   : John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 11:08:01 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 11:08:01 +0700    

Click here for diff

This reverts commit 9552e3ace317ac8bb0a80613c0e5cd6536c96dc8.  
  
I (john) forgot to revert this locally when a more principled  
fix was found, which has the same message title.  

M src/test/modules/test_radixtree/meson.build

commit   : ab6ae6260372074de71805cb7fd54d55d2da994d    
  
author   : John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 10:57:40 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 10:57:40 +0700    

Click here for diff

Add PGDLLIMPORT to pg_popcount32/64. In passing, fix a typo.  
  
Diagnosis by Masahiko Sawada, patch by David Rowley  
  
Per buildfarm members drongo and fairywren  
  
Discussion: https://postgr.es/m/CAD21AoAMm1mQd%3Dw4PrfrKK%3DOMP8j8%3D7ntJRPF8%2B%3D10iUuvwiCA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvov7724UrD1Ug0D1eV%2B9Pd_x5VEQmw-6HVG9w1WdCxXPA%40mail.gmail.com  

M src/include/port/pg_bitutils.h
M src/test/modules/test_radixtree/test_radixtree.c

commit   : 9552e3ace317ac8bb0a80613c0e5cd6536c96dc8    
  
author   : John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 10:25:23 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 8 Mar 2024 10:25:23 +0700    

Click here for diff

Add back "link_with" directive, similar to the one removed by 1f1d73a8b,  
but only for Windows, but use the "_shlib" variation.  
  
Diagnosis by Masahiko Sawada, proposed fix adjusted and tested by me  
  
Per buildfarm members drongo and fairywren  
  
Discussion: https://postgr.es/m/CAD21AoAMm1mQd%3Dw4PrfrKK%3DOMP8j8%3D7ntJRPF8%2B%3D10iUuvwiCA%40mail.gmail.com  

M src/test/modules/test_radixtree/meson.build

Introduce a new GUC 'standby_slot_names'.

commit   : bf279ddd1c28ce0251446ee90043a4cb96e5db0f    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 8 Mar 2024 08:10:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 8 Mar 2024 08:10:45 +0530    

Click here for diff

This patch provides a way to ensure that physical standbys that are  
potential failover candidates have received and flushed changes before  
the primary server making them visible to subscribers. Doing so guarantees  
that the promoted standby server is not lagging behind the subscribers  
when a failover is necessary.  
  
The logical walsender now guarantees that all local changes are sent and  
flushed to the standby servers corresponding to the replication slots  
specified in 'standby_slot_names' before sending those changes to the  
subscriber.  
  
Additionally, the SQL functions pg_logical_slot_get_changes,  
pg_logical_slot_peek_changes and pg_replication_slot_advance are modified  
to ensure that they process changes for failover slots only after physical  
slots specified in 'standby_slot_names' have confirmed WAL receipt for those.  
  
Author: Hou Zhijie and Shveta Malik  
Reviewed-by: Masahiko Sawada, Peter Smith, Bertrand Drouvot, Ajin Cherian, Nisha Moond, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Cope with a deficiency in OpenSSL 3.x's error reporting.

commit   : 453c46873774219243501b8efc16b2b5a5e9d194    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Mar 2024 19:37:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Mar 2024 19:37:51 -0500    

Click here for diff

In OpenSSL 3.0.0 and later, ERR_reason_error_string randomly refuses  
to provide a string for error codes representing system errno values  
(e.g., "No such file or directory").  There is a poorly-documented way  
to extract the errno from the SSL error code in this case, so do that  
and apply strerror, rather than falling back to reporting the error  
code's numeric value as we were previously doing.  
  
Problem reported by David Zhang, although this is not his proposed  
patch; it's instead based on a suggestion from Heikki Linnakangas.  
Back-patch to all supported branches, since any of them are likely  
to be used with recent OpenSSL.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add support for DEFAULT in ALTER TABLE .. SET ACCESS METHOD

commit   : d61a6cad6418f643a5773352038d0dfe5d3535b8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2024 09:31:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2024 09:31:52 +0900    

Click here for diff

This option can be used to switch a relation to use the access method  
set by default_table_access_method when running the command.  
  
This has come up when discussing the possibility to support setting  
pg_class.relam for partitioned tables (left out here as future work),  
while being useful on its own for relations with physical storage as  
these must have an access method set.  
  
Per suggestion from Justin Pryzby.  
  
Author: Michael Paquier  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/ZeCZ89xAVFeOmrQC@pryzbyj2023  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

Update comment of AlterTableCmd->name in parsenodes.h

commit   : 4f8c1e7aaf11c42fa658eeab9baef0a035e76fe2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2024 08:44:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2024 08:44:13 +0900    

Click here for diff

Since b0483263dda0, this field can be used to store an access method  
name for ALTER TABLE, but access methods were not mentioned in the  
field's description.  
  
Issue noticed while working on the area.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/parsenodes.h

Unicode case mapping tables and functions.

commit   : 5c40364dd6d9c6a260c8965dffe2e066642d6f79    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 7 Mar 2024 11:15:06 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 7 Mar 2024 11:15:06 -0800    

Click here for diff

Implements Unicode simple case mapping, in which all code points map  
to exactly one other code point unconditionally.  
  
These tables are generated from UnicodeData.txt, which is already  
being used by other infrastructure in src/common/unicode. The tables  
are checked into the source tree, so they only need to be regenerated  
when we update the Unicode version.  
  
In preparation for the builtin collation provider, and possibly useful  
for other callers.  
  
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com  
Reviewed-by: Peter Eisentraut, Daniel Verite, Jeremy Schneider  

M src/common/Makefile
M src/common/meson.build
M src/common/unicode/Makefile
A src/common/unicode/case_test.c
A src/common/unicode/generate-unicode_case_table.pl
M src/common/unicode/meson.build
A src/common/unicode_case.c
M src/common/wchar.c
A src/include/common/unicode_case.h
A src/include/common/unicode_case_table.h
M src/include/mb/pg_wchar.h

Fix description and grouping of RangeTblEntry.inh

commit   : 6d470211e54f7a617783b99b27c9d8056a890a57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Mar 2024 11:50:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Mar 2024 11:50:24 +0100    

Click here for diff

The inh field of RangeTblEntry was doubly confusingly documented.  
Some parts of the code insisted that it was only valid for  
RTE_RELATION entries, other parts said the field was valid for all  
entries.  Neither was quite correct.  More correctly, the field is  
valid for RTE_RELATION entries but is also used in the planner for  
RTE_SUBQUERY entries.  So it makes more sense to group it with other  
fields that are primarily for RTE_RELATION but borrowed by  
RTE_SUBQUERY.  (The exact position was chosen so that it is next to  
relkind for better struct packing, and next to relid, since relid and  
inh are sort of the input fields and the others are filled in later.)  
Also add documentation for the planner's use at the struct definition.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/parse_relation.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Blind attempt to fix ODR violations

commit   : 1f1d73a8b83fb6de929af36eb9d3cd590875daf5    
  
author   : John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 16:59:25 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 16:59:25 +0700    

Click here for diff

Remove apparently useless "link_with" directive. Even if this isn't the  
root cause, it makes the .build file more like the other test modules.  
  
Reviewed by Masahiko Sawada  
  
Follow-up to ee1b30f12, per buildfarm members olingo and grassquit.  
  
Discussion: https://postgr.es/m/CANWCAZaJAaO8MimTU%2BY-DZutM6HQLQu%3DK2HyoQULdB3v_6BSCg%40mail.gmail.com  

M src/test/modules/test_radixtree/meson.build

Fix handling of self-modified tuples in MERGE.

commit   : 29ef1dd19b4f3eb54569b2eece4a8a65034a2216    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 7 Mar 2024 09:57:02 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 7 Mar 2024 09:57:02 +0000    

Click here for diff

When an UPDATE or DELETE action in MERGE returns TM_SelfModified,  
there are 2 possible causes:  
  
1). The target tuple was already updated or deleted by the current  
    command. This can happen if the target row joins to more than one  
    source row, and the SQL standard explicitly says that this must be  
    an error.  
  
2). The target tuple was already updated or deleted by a later command  
    in the current transaction. This can happen if the tuple is  
    modified by a BEFORE trigger or a volatile function used in the  
    query, and should be an error for the same reason that it is in a  
    plain UPDATE or DELETE command.  
  
In MERGE's primary error handling block, it failed to check for (2),  
causing it to return a misleading error message in such cases.  
  
In the secondary error handling block, following a concurrent update  
from another session, it failed to check for (1), causing it to  
silently ignore target rows joined to more than one source row,  
instead of reporting an error.  
  
Fix this, and add tests for both of these cases.  
  
Per report from Wenjiang Zhang. Back-patch to v15, where MERGE was  
introduced.  
  
Discussion: https://postgr.es/m/tencent_41DE0FF443FE14B94A5898D373792109E408%40qq.com  

M src/backend/executor/nodeModifyTable.c
M src/test/isolation/expected/merge-update.out
M src/test/isolation/specs/merge-update.spec
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Fix incorrect format specifier for int64

commit   : e444ebcb85c0b55b1ccf7bcb785ad2708090a2a2    
  
author   : John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 14:25:30 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 14:25:30 +0700    

Click here for diff

Follow-up to ee1b30f12, per buildfarm member mamba.  
  
Discussion: https://postgr.es/m/CANWCAZYwyRMU%2BOTVOjK%3Dno1hm-W3ZQ5vrSFM1MFAaLtLydvwzA%40mail.gmail.com  

M src/include/lib/radixtree.h

Fix redefinition of typedefs

commit   : ac234e6377dd8bccc83f256fce043bf4ecf9d1f7    
  
author   : John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 14:11:49 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 14:11:49 +0700    

Click here for diff

Per buildfarm members sifaka and longfin, clang with  
-Wtypedef-redefinition warns of duplicate typedefs unless building with  
C11. Follow-up to ee1b30f12.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/CANWCAZauSg%3DLUbBbXhpeQtBuPifmzQNTYS6O8NsoAPz1zL-Txg%40mail.gmail.com  

M src/include/lib/radixtree.h

Add template for adaptive radix tree

commit   : ee1b30f128d8f63a5184d2bcf1c48a3efc3fcbf9    
  
author   : John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 12:40:11 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 7 Mar 2024 12:40:11 +0700    

Click here for diff

This implements a radix tree data structure based on the design in  
"The Adaptive Radix Tree: ARTful Indexing for Main-Memory Databases"  
by Viktor Leis, Alfons Kemper, and ThomasNeumann, 2013. The main  
technique that makes it adaptive is using several different node types,  
each with a different capacity of elements, and a different algorithm  
for accessing them. The nodes start small and grow/shrink as needed.  
  
The main advantage over hash tables is efficient sorted iteration and  
better memory locality when successive keys are lexicographically  
close together. The implementation currently assumes 64-bit integer  
keys, and traversing the tree is in general slower than a linear  
probing hash table, so this is not a general-purpose associative array.  
  
The paper describes two other techniques not implemented here,  
namely "path compression" and "lazy expansion". These can further  
reduce memory usage and speed up traversal, but the former would add  
significant complexity and the latter requires storing the full key  
with the value. We do trivially compress the path when leading bytes  
of the key are zeros, however.  
  
For value storage, we use "combined pointer/value slots", as  
recommended in the paper. Values of size equal or smaller than the the  
platform's pointer type are stored in the array of child pointers in  
the last level node, while larger values are each stored in a separate  
allocation. This is for now fixed at compile time, but it would be  
fairly trivial to allow determining at runtime how variable-length  
values are stored.  
  
One innovation in our implementation compared to the ART paper is  
decoupling the notion of node "size class" from "kind". The size  
classes within a given node kind have the same underlying type, but  
a variable capacity for children, so we can introduce additional node  
sizes with little additional code.  
  
To enable different use cases to specialize for different value types  
and for shared/local memory, we use macro-templatized code generation  
in the same manner as simplehash.h and sort_template.h.  
  
Future commits will use this infrastructure for storing TIDs.  
  
Patch by Masahiko Sawada and John Naylor, but a substantial amount of  
credit is due to Andres Freund, whose proof-of-concept was a valuable  
source of coding idioms and awareness of performance pitfalls, and  
who reviewed earlier versions.  
  
Discussion: https://postgr.es/m/CAD21AoAfOZvmfR0j8VmZorZjL7RhTiQdVttNuC4W-Shdc2a-AA%40mail.gmail.com  

M src/backend/utils/mmgr/dsa.c
A src/include/lib/radixtree.h
M src/include/utils/dsa.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_radixtree/.gitignore
A src/test/modules/test_radixtree/Makefile
A src/test/modules/test_radixtree/expected/test_radixtree.out
A src/test/modules/test_radixtree/meson.build
A src/test/modules/test_radixtree/sql/test_radixtree.sql
A src/test/modules/test_radixtree/test_radixtree–1.0.sql
A src/test/modules/test_radixtree/test_radixtree.c
A src/test/modules/test_radixtree/test_radixtree.control
M src/tools/pgindent/typedefs.list

Revert "Add recovery TAP test for race condition with slot invalidations"

commit   : 65db0cfb4c036b14520a22dba5a858185b713643    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Mar 2024 09:57:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Mar 2024 09:57:52 +0900    

Click here for diff

This reverts commit 08a52ab151ca, due to some sporadic instability in  
the test.  Getting the test right should require some redesign with a  
second injection point, but let's revert it for now to avoid these  
issues in the CI as a lot of patches are under discussion in this last  
commit fest.  
  
Per buildfarm members hachi and gokiburi.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Fix parallel-safety check of expressions and predicate for index builds"

commit   : 099ca50bd41c1a72fe5a086bb095858ea74c88de    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Mar 2024 08:30:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Mar 2024 08:30:35 +0900    

Click here for diff

This reverts commit eae7be600be7, following a discussion with Tom Lane,  
due to concerns that this impacts the decisions made by the planner for  
the number of workers spawned based on the inlining and const-folding of  
index expressions and predicate for cases that would have worked until  
this commit.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/optimizer/plan/planner.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Add Unicode property tables.

commit   : ad49994538c57270c244fab4e1de040568066313    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 6 Mar 2024 12:50:01 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 6 Mar 2024 12:50:01 -0800    

Click here for diff

Provide functions to test for Unicode properties, such as Alphabetic  
or Cased. These functions use tables derived from Unicode data files,  
similar to the tables for Unicode normalization or general category,  
and those tables can be updated with the 'update-unicode' build  
target.  
  
Use Unicode properties to provide functions to test for regex  
character classes, like 'punct' or 'alnum'.  
  
Infrastructure in preparation for a builtin collation provider, and  
may also be useful for other callers.  
  
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com  
Reviewed-by: Daniel Verite, Peter Eisentraut, Jeremy Schneider  

M src/common/unicode/Makefile
M src/common/unicode/README
M src/common/unicode/category_test.c
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/meson.build
M src/common/unicode_category.c
M src/include/common/unicode_category.h
M src/include/common/unicode_category_table.h

Fix type-checking of RECORD-returning functions in FROM.

commit   : 2ed8f9a01e74bfc63a56b2108f44237bc5eab9f5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Mar 2024 14:41:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Mar 2024 14:41:13 -0500    

Click here for diff

In the corner case where a function returning RECORD has been  
simplified to a RECORD constant or an inlined ROW() expression,  
ExecInitFunctionScan failed to cross-check the function's result  
rowtype against the coldeflist provided by the calling query.  
That happened because get_expr_result_type is able to extract a  
tupdesc from such expressions, which led ExecInitFunctionScan to  
ignore the coldeflist.  (Instead, it used the extracted tupdesc  
to check the function's output, which of course always succeeds.)  
  
I have not been able to demonstrate any really serious consequences  
from this, because if some column of the result is of the wrong  
type and is directly referenced by a Var of the calling query,  
CheckVarSlotCompatibility will catch it.  However, we definitely do  
fail to report the case where the function returns more columns than  
the coldeflist expects, and in the converse case where it returns  
fewer columns, we get an assert failure (but, seemingly, no worse  
results in non-assert builds).  
  
To fix, always build the expected tupdesc from the coldeflist if there  
is one, and consult get_expr_result_type only when there isn't one.  
  
Also remove the failing Assert, even though it is no longer reached  
after this fix.  It doesn't seem to be adding anything useful, since  
later checking will deal with cases with the wrong number of columns.  
  
The only other place I could find that is doing something similar  
is inline_set_returning_function.  There's no live bug there because  
we cannot be looking at a Const or RowExpr, but for consistency  
change that code to agree with ExecInitFunctionScan.  
  
Per report from PetSerAl.  After some debate I've concluded that  
this should be back-patched.  There is a small risk that somebody  
has been relying on such a case not throwing an error, but I judge  
this outweighed by the risk that I've missed some way in which the  
failure to cross-check has worse consequences than sketched above.  
  
Discussion: https://postgr.es/m/CAKygsHSerA1eXsJHR9wft3Gn3wfHQ5RfP8XHBzF70_qcrrRvEg@mail.gmail.com  

M src/backend/executor/nodeFunctionscan.c
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

Fix signedness error in 9f225e992 for gcc

commit   : de7c6fe8347ab726c80ebbfcdb57f4b714d5243d    
  
author   : John Naylor <[email protected]>    
date     : Wed, 6 Mar 2024 15:54:25 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 6 Mar 2024 15:54:25 +0700    

Click here for diff

The first argument of vshrq_n_s8 needs to be a signed vector type,  
but it was passed unsigned. Clang is more lax with conversion, but  
gcc needs a cast.  
  
Fix by me, tested by Masahiko Sawada  
  
Per buildfarm members splitfin, batta, widowbird, snakefly, parula,  
massasauga  
  
Discussion: https://postgr.es/m/20240306074106.mg6w4koohdlworbs%40alap3.anarazel.de  

M src/include/port/simd.h

Fix parallel-safety check of expressions and predicate for index builds

commit   : eae7be600be715b2f393b018fc4b98c5b89296da    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2024 17:23:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2024 17:23:56 +0900    

Click here for diff

As coded, the planner logic that calculates the number of parallel  
workers to use for a parallel index build uses expressions and  
predicates from the relcache, which are flattened for the planner by  
eval_const_expressions().  
  
As reported in the bug, an immutable parallel-unsafe function flattened  
in the relcache would become a Const, which would be considered as  
parallel-safe, even if the predicate or the expressions including the  
function are not safe in parallel workers.  Depending on the expressions  
or predicate used, this could cause the parallel build to fail.  
  
Tests are included that check parallel index builds with parallel-unsafe  
predicate and expressions.  Two routines are added to lsyscache.h to be  
able to retrieve expressions and predicate of an index from its pg_index  
data.  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang  
Reviewed-by: Jian He, Michael Paquier  
Discussion: https://postgr.es/m/CAHewXN=UaAaNn9ruHDH3Os8kxLVmtWqbssnf=dZN_s9=evHUFA@mail.gmail.com  
Backpatch-through: 12  

M src/backend/optimizer/plan/planner.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Move some bitmap logic out of bitmapset.c

commit   : 3e76a806cbb0f8a6cf3ba7a3b371643fa1e0fe96    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Dec 2022 13:39:41 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Dec 2022 13:39:41 +0700    

Click here for diff

Move the logic for selecting appropriate pg_bitutils.h  
functions based on word size to bitmapset.h for wider  
visibility.  
  
Reviewed (in a previous version) by Tom Lane  
Discussion: https://postgr.es/m/CAFBsxsFW2JjTo58jtDB%2B3sZhxMx3t-3evew8%3DAcr%2BGGhC%2BkFaA%40mail.gmail.com  

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

Introduce helper SIMD functions for small byte arrays

commit   : 9f225e992bedd7615b48418bd53d21b6b003dd3f    
  
author   : John Naylor <[email protected]>    
date     : Wed, 6 Mar 2024 14:22:15 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 6 Mar 2024 14:22:15 +0700    

Click here for diff

vector8_min - helper for emulating ">=" semantics  
  
vector8_highbit_mask - used to turn the result of a vector  
comparison into a bitmask  
  
Masahiko Sawada  
  
Reviewed by Nathan Bossart, with additional adjustments by me  
Discussion: https://postgr.es/m/CAFBsxsHbBm_M22gLBO%2BAZT4mfMq3L_oX3wdKZxjeNnT7fHsYMQ%40mail.gmail.com  

M src/include/port/simd.h

Doc: Improve replication slot synchronization section.

commit   : 60c07820d62231d9110119b92cc1136df6dd4fb7    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 6 Mar 2024 11:16:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 6 Mar 2024 11:16:51 +0530    

Click here for diff

Author: Peter Smith  
Reviewed-by: Michael Paquier, Laurenz Albe  
Discussion: https://postgr.es/m/CAHut+Ps01fV9bjhj6njCFiHu0W0gu1Jcu0tKo0RYMhHx-hZZ7g@mail.gmail.com  

M doc/src/sgml/logicaldecoding.sgml

Add recovery TAP test for race condition with slot invalidations

commit   : 08a52ab151ca599406883768cdc08b7929e516de    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2024 14:38:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2024 14:38:25 +0900    

Click here for diff

This commit adds a recovery test to provide coverage for the bug fixed  
in 818fefd8fd, using an injection point to wait just after the process  
of an active slot is killed.  The trick is to give enough time for  
effective_xmin and effective_catalog_xmin to advance so as the slot  
invalidation robustness can be checked since the active process is  
killed without holding its slot's mutex for a short time.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Add --copy-file-range option to pg_upgrade.

commit   : d93627bcbe5001750e7611f0e637200e2d81dcff    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 6 Mar 2024 11:39:50 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 6 Mar 2024 11:39:50 +1300    

Click here for diff

The copy_file_range() system call is available on at least Linux and  
FreeBSD, and asks the kernel to use efficient ways to copy ranges of a  
file.  Options available to the kernel include sharing block ranges  
(similar to --clone mode), and pushing down block copies to the storage  
layer.  
  
For automated testing, see PG_TEST_PG_UPGRADE_MODE.  (Perhaps in a later  
commit we could consider setting this mode for one of the CI targets.)  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKe7Hb0-UNih8VD5UNZy5-ojxFb3Pr3xSBBL8qj2M2%3DdQ%40mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/ref/pgupgrade.sgml
M meson.build
M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenumber.c
M src/include/pg_config.h.in

Remove surplus trailing semicolon

commit   : 2bce0ad67f93af6d1889ec611a8f618245291e3f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 6 Mar 2024 10:57:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 6 Mar 2024 10:57:31 +1300    

Click here for diff

Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4-qjotfa7G=5PEOw4LDDDX58MmTwDdpdoU3Quse_BKv1Q@mail.gmail.com  

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

Add a few recent commits to .git-blame-ignore-revs.

commit   : 571530452fe0b15727b8b6730e64800a5e96a7b2    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 5 Mar 2024 14:15:06 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 5 Mar 2024 14:15:06 -0600    

Click here for diff

M .git-blame-ignore-revs

Run pgindent again on the same file.

commit   : 0984a3b851abe89bec6c3eff51b03038808e1997    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 11:16:23 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 11:16:23 -0800    

Click here for diff

Apparently, pgindent got confused by the double space. The first time  
I ran it, it moved the function name to the next line. The second time  
I ran it, it moved the function name back, but without the double  
space.  
  
Now the results appear stable.  

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

Run pgindent for commit ef4cfdce0e.

commit   : b406af1806e9fc5c090e58282c7d98f22a4b397f    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 10:58:24 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 10:58:24 -0800    

Click here for diff

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

docs: Update HOT update docs for 19d8e2308b

commit   : 7a9328e8e40534fb4de41b4ac152e3c6989d84e7    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 09:25:46 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 09:25:46 -0800    

Click here for diff

Commit 19d8e2308b changed when the HOT update optimization is possible  
but neglected to update the Heap-Only Tuples (HOT) documentation.  This  
patch updates that documentation accordingly.  
  
Author: Elizabeth Christensen  
Backpatch-through: 16  
Reviewed-By: Stephen Frost, Alvaro Herrera  
Discussion: https://postgr.es/m/CABoUFXRjisr58Ct_3VsFEdQx+fJeQTWTdJnM7XAp=8MUbtoa9A@mail.gmail.com  

M doc/src/sgml/storage.sgml

Update sepgsql expected output.

commit   : c7ea3f42291bf5c74be8f957c775c5e7b3f78592    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 08:44:38 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 5 Mar 2024 08:44:38 -0800    

Click here for diff

Fix for buildfarm member rhinoceros after commit 2af07e2f74.  

M contrib/sepgsql/expected/ddl.out

Fix references to renamed function in comments

commit   : ef4cfdce0ef8b926803b0d5ffafef1c42b15bbfb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2024 18:23:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2024 18:23:58 +0200    

Click here for diff

I renamed the function in commit 024c521117, but missed these  
comments.  
  
Reported-by: Richard Guo  
Discussion: https://www.postgresql.org/message-id/CAMbWs4-jR6qc7JRMKwz-zXQy_AYLUZ3PHjGep4B91of321cqWw@mail.gmail.com  

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

Improve field order in RangeTblEntry

commit   : e03349144b00b775523f3e0ea8ef56ec2fb44b11    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2024 13:34:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2024 13:34:43 +0100    

Click here for diff

When perminfoindex was added, it was just added at the end of the  
block.  It would make sense to keep it closer to more related fields.  
In passing, also add an inline comment, like the other fields have.  
(Other field reorderings and documentation improvements in  
RangeTblEntry are being discussed, but it's better not to mix them  
together.)  
  
Discussion: https://www.postgresql.org/message-id/flat/6c1fbccc-85c8-40d3-b08b-4f47f2093711%40eisentraut.org  

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

Fix misspelled assertions

commit   : 0d3a71d0c8a762247cf558cf41847e599a1f5539    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Mar 2024 12:13:12 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Mar 2024 12:13:12 +0100    

Click here for diff

Remove an extra & operator, per Tom Lane.  My bugs, introduced with  
commit 53c2a97a9266.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rework redundant code in subtrans.c

commit   : 1a2654b32b546d25e39a0c02410049559a3d4573    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Mar 2024 12:09:18 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Mar 2024 12:09:18 +0100    

Click here for diff

When this code was written the duplicity didn't matter, but with all the  
SLRU-bank stuff we just added, it has become excessive.  Turn it into a  
simpler loop with no code duplication.  Also add a test so that this  
code becomes covered.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/subtrans.c
M src/test/recovery/t/009_twophase.pl

Rename pg_constraint.conwithoutoverlaps to conperiod

commit   : 030e10ff1a365796bd4bcbbc5b6a8552f7efc765    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2024 11:15:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2024 11:15:06 +0100    

Click here for diff

pg_constraint.conwithoutoverlaps was recently added to support primary  
keys and unique constraints with the WITHOUT OVERLAPS clause.  An  
upcoming patch provides the foreign-key side of this functionality,  
but the syntax there is different and uses the keyword PERIOD.  It  
would make sense to use the same pg_constraint field for both of  
these, but then we should pick a more general name that conveys "this  
constraint has a temporal/period-related feature".  conperiod works  
for that and is nicely compact.  Changing this now avoids possibly  
having to introduce versioning into clients.  Note there are still  
some "without overlaps" variables left, which deal specifically with  
the parsing of the primary key/unique constraint feature.  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h

Fix a leftover reference to backend_id in comment

commit   : 55cdba2647ed6bbe1126c6b6d8f53e8602ec05a1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2024 09:15:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2024 09:15:02 +0200    

Click here for diff

Commit 024c521117 replaced backend_id with proc_number.  
  
Reported-by: Alexander Lakhin  

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

Fix buildfarm failures from 2af07e2f74.

commit   : 59825d16399699e2f99016b9add46cb2d4916f82    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 4 Mar 2024 19:42:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 4 Mar 2024 19:42:16 -0800    

Click here for diff

Use GUC_ACTION_SAVE rather than GUC_ACTION_SET, necessary for working  
with parallel query.  
  
Now that the call requires more arguments, wrap the call in a new  
function to avoid code duplication and offer a place for a comment.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/vacuum.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Fix incorrectly reported stats kind in "can't happen" ERROR

commit   : a37a3e2b36d7de965f974b8caca0c295833708f2    
  
author   : David Rowley <[email protected]>    
date     : Tue, 5 Mar 2024 16:17:02 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 5 Mar 2024 16:17:02 +1300    

Click here for diff

The error message(s) were reporting the stats kind of 'f', which is not  
correct as that's for the "dependencies" statistics kind.  
  
Reported-by: Horst Reiterer  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12, where MCV extended stats were added.  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c

Fix search_path to a safe value during maintenance operations.

commit   : 2af07e2f749a9208ca1ed84fa1d8fe0e75833288    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 4 Mar 2024 17:31:38 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 4 Mar 2024 17:31:38 -0800    

Click here for diff

While executing maintenance operations (ANALYZE, CLUSTER, REFRESH  
MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to  
'pg_catalog, pg_temp' to prevent inconsistent behavior.  
  
Functions that are used for functional indexes, in index expressions,  
or in materialized views and depend on a different search path must be  
declared with CREATE FUNCTION ... SET search_path='...'.  
  
This change was previously committed as 05e1737351, then reverted in  
commit 2fcc7ee7af because it was too late in the cycle.  
  
Preparation for the MAINTAIN privilege, which was previously reverted  
due to search_path manipulation hazards.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org  
Discussion: https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com  
Reviewed-by: Greg Stark, Nathan Bossart, Noah Misch  

M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/vacuum.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/utils/guc.h
M src/test/modules/test_oat_hooks/expected/alter_table.out
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/namespace.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/matview.sql
M src/test/regress/sql/namespace.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/vacuum.sql

Add macro for customizing an archiving WARNING message.

commit   : 2c29e7fc95b24f5ccfec0d2db458d2130606f446    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 4 Mar 2024 15:41:42 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 4 Mar 2024 15:41:42 -0600    

Click here for diff

Presently, if an archive module's check_configured_cb callback  
returns false, a generic WARNING message is emitted, which  
unfortunately provides no actionable details about the reason why  
the module is not configured.  This commit introduces a macro that  
archive module authors can use to add a DETAIL line to this WARNING  
message.  
  
Co-authored-by: Tung Nguyen  
Reviewed-by: Daniel Gustafsson, Álvaro Herrera  
Discussion: https://postgr.es/m/4109578306242a7cd5661171647e11b2%40oss.nttdata.com  

M contrib/basic_archive/basic_archive.c
M doc/src/sgml/archive-modules.sgml
M src/backend/archive/shell_archive.c
M src/backend/postmaster/pgarch.c
M src/include/archive/archive_module.h

Explicitly list dependent types as extension members in pg_depend.

commit   : e5bc9454e527b1cba97553531d8d4992892fdeef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 14:49:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 14:49:31 -0500    

Click here for diff

Auto-generated array types, multirange types, and relation rowtypes  
are treated as dependent objects: they can't be dropped separately  
from the base object, nor can they have their own ownership or  
permissions.  We previously felt that, for objects that are in an  
extension, only the base object needs to be listed as an extension  
member in pg_depend.  While that's sufficient to prevent inappropriate  
drops, it results in undesirable answers if someone asks whether a  
dependent type belongs to the extension.  It looks like the dependent  
type is just some random separately-created object that happens to  
depend on the base object.  Notably, this results in postgres_fdw  
concluding that expressions involving an array type are not shippable  
to the remote server, even when the defining extension has been  
whitelisted.  
  
To fix, cause GenerateTypeDependencies to make extension dependencies  
for dependent types as well as their base objects, and adjust  
ExecAlterExtensionContentsStmt so that object addition and removal  
operations recurse to dependent types.  The latter change means that  
pg_upgrade of a type-defining extension will end with the dependent  
type(s) now also listed as extension members, even if they were  
not that way in the source database.  Normally we want pg_upgrade  
to precisely reproduce the source extension's state, but it seems  
desirable to make an exception here.  
  
This is arguably a bug fix, but we can't back-patch it since it  
causes changes in the expected contents of pg_depend.  (Because  
it does, I've bumped catversion, even though there's no change  
in the immediate post-initdb catalog contents.)  
  
Tom Lane and David Geier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_type.c
M src/backend/commands/extension.c
M src/include/catalog/catversion.h
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext9–1.0.sql
A src/test/modules/test_extensions/test_ext9.control

pg_verifybackup: Refactor parse_manifest_file.

commit   : dc8f2d7c064ac2ba76e5821fd96fa3837076f0d2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 14:42:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 14:42:17 -0500    

Click here for diff

Return a pointer to the manifest_data instead of individual pointers  
to relevant data stored within the manifest_data object. The previous  
approach scales poorly if we add more things to the backup manifest,  
as has been proposed.  
  
Amul Sul, reviewed by Sravan Velagandula, Michael Paquier, and me.  
  
Discussion: http://postgr.es/m/CAAJ_b95=1LONf99-M_ep588fL_WgLJfdnb7XG4GWE7JDD22E4w@mail.gmail.com  

M src/bin/pg_verifybackup/pg_verifybackup.c

Fix pgindent damage.

commit   : dd7ea37c435e10f9c5aa3fb257a05c08814a4ad2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 14:37:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 14:37:13 -0500    

Click here for diff

Apparently, I neglected to pgindent the prior commit.  
  
Per buildfarm.  

M src/backend/backup/basebackup_incremental.c
M src/backend/postmaster/walsummarizer.c

Fix incremental backup interaction with XLOG_DBASE_CREATE_FILE_COPY.

commit   : d75c4027b6f260f2045b162017567aeeb909b056    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 13:33:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Mar 2024 13:33:12 -0500    

Click here for diff

After XLOG_DBASE_CREATE_FILE_COPY, a correct incremental backup needs  
to copy in full everything with the database and tablespace OID  
mentioned in that record; but that record doesn't specifically mention  
the blocks, or even the relfilenumbers, of the affected relations.  
As a result, we were failing to copy data that we should have copied.  
  
To fix, enter the DB OID and tablespace OID into the block reference  
table with relfilenumber 0 and limit block 0; and treat that as a  
limit block of 0 for every relfilenumber whose DB OID and tablespace  
OID match.  
  
Also, add a test case.  
  
Patch by me, reviewed by Noah Misch.  
  
Discussion: http://postgr.es/m/CA+Tgmob0xa=ByvGLMdAgkUZyVQE=r4nyYZ_VEa40FCfEDFnTKA@mail.gmail.com  

M src/backend/backup/basebackup_incremental.c
M src/backend/postmaster/walsummarizer.c
M src/bin/pg_combinebackup/meson.build
A src/bin/pg_combinebackup/t/006_db_file_copy.pl

Further further fix pg_upgrade crossversion test for adminpack.

commit   : cb6945dc8061d03e6ec670a6856228f12e94264c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 13:10:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 13:10:30 -0500    

Click here for diff

Apparently, buildfarm animal crake has the adminpack regression DB  
named as "regression_adminpack" in some branches.  Not clear why  
I didn't see that when testing here.  In any case, drop that too.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix initdb's -c option to treat the GUC name case-insensitively.

commit   : fce2ce797c412df8b794b8a92c5a586db5e1bedc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 12:00:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 12:00:39 -0500    

Click here for diff

The backend treats GUC names case-insensitively, so this code should  
too.  This avoids ending up with a confusing set of redundant entries  
in the generated postgresql.conf file.  
  
Per report from Kyotaro Horiguchi.  Back-patch to v16 where this  
feature was added (in commit 3e51b278d).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl

Rework locking code in GetMultiXactIdMembers

commit   : a0b808baef39e9f9465b7f63f2d735f35852aa21    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2024 17:48:01 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2024 17:48:01 +0100    

Click here for diff

After commit 53c2a97a9266, the code flow around the "retry" goto label  
in GetMultiXactIdMembers was confused about what was possible: we never  
return there with a held lock, so there's no point in testing for one.  
This realization lets us simplify the code a bit.  While at it, make the  
scope of a couple of local variables in the same function a bit tighter.  
  
Per Coverity.  

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

Simplify coding in slru.c

commit   : f9baaf96d3395c3afc2c558fb74279c4923ddb24    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2024 17:37:47 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2024 17:37:47 +0100    

Click here for diff

New code in 53c2a97a9266 uses direct array access to  
shared->bank_locks[bankno].lock which can be made a little bit more  
legible by using the SimpleLruGetBankLock helper function.  
Nothing terribly serious, but let's add some clarity.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Further fix pg_upgrade crossversion test for adminpack.

commit   : c8a61e350db40f81e088f2333fd30cc7f96a8b35    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 11:31:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Mar 2024 11:31:32 -0500    

Click here for diff

The DROP DATABASE step needs an "if exists" option, as the oldest  
branches we test don't have the contrib_regression_adminpack DB.  
Also remove unnecessary command to drop the extension from the  
regression database; no version has installed it there during  
buildfarm testing.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix crossversion test for unsupported versions

commit   : 084cff7899d62c142f5c5190ef6924a0ffe93893    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 15:09:59 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 15:09:59 +0100    

Click here for diff

The fix in be78006741 only accounted for supported versions of postgres  
but the crossversion test use 11 as the source version, which is an EOL  
version.  Fix by removing the lower bound in the adminpack cleanup.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Adjust pg_upgrade crossversion test for adminpack

commit   : be7800674117756a63f3fee68ee4563eff303839    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 14:37:45 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 14:37:45 +0100    

Click here for diff

Commit cc09e6549f which removed the adminpack extension failed to  
instrument the crossversion pg_upgrade test to drop the extension  
before attempting an upgrade to v17.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Put back required #include

commit   : 43a8875f4919e05ea25f88c3b94563f45a5bdb9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Mar 2024 13:16:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Mar 2024 13:16:18 +0100    

Click here for diff

Fix for dbbca2cf29: "storage/shmem.h" is required with  
-Dspinlocks=false.  

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

Remove the adminpack contrib extension

commit   : cc09e6549f2bd2142b154d7d9802fb7a0abc643e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 12:39:22 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 12:39:22 +0100    

Click here for diff

The adminpack extension was only used to support pgAdmin III,  which  
in turn was declared EOL many years ago. Removing the extension also  
allows us to remove functions from core as well which were only used  
to support old version of adminpack.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACUmL5TraYBUBqDZBi1C+Re8_=SekqGYqYprj_W8wygQ8w@mail.gmail.com  

M contrib/Makefile
D contrib/adminpack/.gitignore
D contrib/adminpack/Makefile
D contrib/adminpack/adminpack–1.0–1.1.sql
D contrib/adminpack/adminpack–1.0.sql
D contrib/adminpack/adminpack–1.1–2.0.sql
D contrib/adminpack/adminpack–2.0–2.1.sql
D contrib/adminpack/adminpack.c
D contrib/adminpack/adminpack.control
D contrib/adminpack/expected/adminpack.out
D contrib/adminpack/meson.build
D contrib/adminpack/sql/adminpack.sql
M contrib/meson.build
D doc/src/sgml/adminpack.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Remove unused #include's from backend .c files

commit   : dbbca2cf299b81299112ca6ada671a36235ec008    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Mar 2024 12:00:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Mar 2024 12:00:11 +0100    

Click here for diff

as determined by include-what-you-use (IWYU)  
  
While IWYU also suggests to *add* a bunch of #include's (which is its  
main purpose), this patch does not do that.  In some cases, a more  
specific #include replaces another less specific one.  
  
Some manual adjustments of the automatic result:  
  
- IWYU currently doesn't know about includes that provide global  
  variable declarations (like -Wmissing-variable-declarations), so  
  those includes are being kept manually.  
  
- All includes for port(ability) headers are being kept for now, to  
  play it safe.  
  
- No changes of catalog/pg_foo.h to catalog/pg_foo_d.h, to keep the  
  patch from exploding in size.  
  
Note that this patch touches just *.c files, so nothing declared in  
header files changes in hidden ways.  
  
As a small example, in src/backend/access/transam/rmgr.c, some IWYU  
pragma annotations are added to handle a special case there.  
  
Discussion: https://www.postgresql.org/message-id/flat/af837490-6b2f-46df-ba05-37ea6a6653fc%40eisentraut.org  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/attmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/table.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_server.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/main/main.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_mutation.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/utility.c
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c

Remove unused 'countincludesself' argument to pq_sendcountedtext()

commit   : 24eebc65c26cfcc0ea5b8a95b61fa2fda6118e68    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 12:56:05 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 12:56:05 +0200    

Click here for diff

It has been unused since we removed support for protocol version 2.  

M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/libpq/pqformat.c
M src/backend/replication/logical/proto.c
M src/backend/tcop/fastpath.c
M src/include/libpq/pqformat.h

Remove unused ParallelWorkerInfo.pid field

commit   : 0dd094c4a0a4766cfb3c4932fa32af906229e3e3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 12:56:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 12:56:02 +0200    

Click here for diff

The pid was originally used in error context of messages propagated  
from parallel workers, but commit 292794f82b removed that. If the need  
arises in the future, you can also get the pid with  
"shm_mq_get_sender(pcxt->worker[i].error_mqh)->pid".  

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

Fix doc omission for MERGE into updatable views.

commit   : 8545b28679a2ec2aa66ad2ec81f17019dab5d780    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 4 Mar 2024 10:48:40 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 4 Mar 2024 10:48:40 +0000    

Click here for diff

Commit 5f2e179bd3 missed one place in rules.sgml that should have  
mentioned MERGE. Also, be more specific when saying that MERGE doesn't  
support rules, since it does support SELECT rules.  

M doc/src/sgml/rules.sgml

doc: Fix datatype for postgres_fdw option

commit   : 0cf79a7f6801d3e69de6450d585e385a4064b057    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 10:52:19 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Mar 2024 10:52:19 +0100    

Click here for diff

The datatype for analyze_sampling had accidentally been set to text  
and not string.  Backpatch to v16 where analyze_sampling first was  
introduced.  
  
Author: Shinya Kato <[email protected]>  
Reviewed-by: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v16  

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

Use MyBackendType in more places to check what process this is

commit   : 393b5599e5177e456cdce500039813629d370b38    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:12 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:12 +0200    

Click here for diff

Remove IsBackgroundWorker, IsAutoVacuumLauncherProcess(),  
IsAutoVacuumWorkerProcess(), and IsLogicalSlotSyncWorker() in favor of  
new Am*Process() macros that use MyBackendType. For consistency with  
the existing Am*Process() macros.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/slotsync.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h
M src/include/postmaster/autovacuum.h
M src/include/replication/slotsync.h

Remove MyAuxProcType, use MyBackendType instead

commit   : 067701f57758f9baed5bd9d868539738d77bfa92    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:09 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:09 +0200    

Click here for diff

MyAuxProcType was redundant with MyBackendType.  
  
Reviewed-by: Reid Thompson, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/postmaster.c
M src/include/miscadmin.h
M src/include/postmaster/auxprocess.h
M src/tools/pgindent/typedefs.list

Optimize GenerationAlloc() and SlabAlloc()

commit   : a0cd95448067273a5cf92ad578a1e2de3b62aa2f    
  
author   : David Rowley <[email protected]>    
date     : Mon, 4 Mar 2024 17:42:10 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 4 Mar 2024 17:42:10 +1300    

Click here for diff

In a similar effort to 413c18401, separate out the hot and cold paths in  
GenerationAlloc() and SlabAlloc() to avoid having to setup the stack frame  
for the hot path.  
  
This additionally adjusts how we use the GenerationContext's freeblock.  
Freeblock, when set, is now always empty and we only switch to using it  
when the current allocation request finds the current block does not have  
enough space and the freeblock is large enough to accomodate the  
allocation.  
  
This commit also adjusts GenerationFree() so that if we pfree the final  
allocation in the current generation block, we now mark that block as  
empty and keep it as the current block.  Previously we free'd that block  
and set the current block to NULL.  Doing that meant we needed a special  
case in GenerationAlloc to check if GenerationContext.block was NULL.  
So this both reduces free/malloc calls and reduces the work done in  
GenerationAlloc().  
  
In passing, improve some comments in aset.c  
  
Discussion: https://postgr.es/m/CAApHDvpHVSJqqb4B4OZLixr=CotKq-eKkbwZqvZVo_biYvUvQA@mail.gmail.com  

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

Support partition pruning on boolcol IS [NOT] UNKNOWN

commit   : 07c36c1333e00df5a4baf6b04ba2f3f300f57d69    
  
author   : David Rowley <[email protected]>    
date     : Mon, 4 Mar 2024 14:40:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 4 Mar 2024 14:40:03 +1300    

Click here for diff

While working on 4c2369ac5, I noticed we went out of our way not to  
support clauses on boolean partitioned tables in the form of "IS  
UNKNOWN" and "IS NOT UNKNOWN".  It's almost as much code to disallow  
this as it is to allow it, so let's allow it.  
  
Discussion: https://postgr.es/m/CAApHDvobKtcN6+xOuOfcutfp6T7jP=JPA9y3=MAEqnuKdDsQrw@mail.gmail.com  

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

Add PostgreSQL::Test::Cluster::wait_for_event()

commit   : eca2c1ea85eb22716f93339f4e7cec3145c25723    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 10:25:50 +0900    

Click here for diff

Per a demand from the author and the reviewer of this commit, this adds  
to Cluster.pm a helper routine that can be used to monitor when a  
process reaches a wanted wait event.  This can be used in combination  
with the module injection_points for the "wait" callback, though it is  
not limited to it as this monitors pg_stat_activity for a wait_event and  
a backend_type.  
  
Author: Bertrand Drouvot  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/041_checkpoint_at_promote.pl

Add regression test for restart points during promotion

commit   : 6782709df81f6c68450172605907fa9ff2b7f2b1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 09:49:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 09:49:03 +0900    

Click here for diff

This test serves as a way to demonstrate how to use the features  
introduced in 37b369dc67bc, while providing coverage for 7863ee4def65  
that caused the startup process to throw "PANIC: could not locate a  
valid checkpoint record" when starting recovery.  The test checks that a  
node is able to properly restart following a crash when a restart point  
was finishing across a promotion, with an injection point added in the  
middle of CreateRestartPoint() to stop the restartpoint in flight.  Note  
that this test fails when 7863ee4def65 is reverted.  
  
Kyotaro Horiguchi is the original author of this test, that has been  
originally posted on the thread where 7863ee4def65 was discussed.  I  
have just upgraded and polished it to rely on injection points, making  
it much cheaper to reproduce the failure.  
  
This test requires injection points to be enabled in the builds, hence  
meson and ./configure need an update to pass this knowledge down to the  
test.  The name of the new injection point follows the same naming  
convention as 6a1ea02c491d.  The Makefile's EXTRA_INSTALL of recovery  
TAP tests is updated to include modules/injection_points.  
  
Author: Kyotaro Horiguchi, Michael Paquier  
Reviewed-by: Andrey Borodin, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/test/recovery/Makefile
M src/test/recovery/meson.build
A src/test/recovery/t/041_checkpoint_at_promote.pl

injection_points: Add wait and wakeup of processes

commit   : 37b369dc67bc44a3aab5c07e2c0012475efd00f3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 09:19:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2024 09:19:13 +0900    

Click here for diff

This commit adds two features to the in-core module for injection  
points:  
- A new callback called "wait" that can be attached to an injection  
point to make it wait.  
- A new SQL function to update the shared state and broadcast the update  
using a condition variable.  This function uses an input an injection  
point name.  
  
This offers the possibility to stop a process in flight and wake it up  
in a controlled manner, which is useful when implementing tests that aim  
to trigger scenarios for race conditions (some tests are planned for  
integration).  The logic uses a set of counters with a condition  
variable to monitor and broadcast the changes.  Up to 8 waits can be  
registered in a single run, which should be plenty enough.  Waits can be  
monitored in pg_stat_activity, based on the injection point name which  
is registered in a custom wait event under the "Extension" category.  
  
The shared memory state used by the module is registered using the DSM  
registry, and is optional, so there is no need to load the module with  
shared_preload_libraries to be able to use these features.  
  
Author: Michael Paquier  
Reviewed-by: Andrey Borodin, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
M src/tools/pgindent/typedefs.list

Replace BackendIds with 0-based ProcNumbers

commit   : 024c521117579a6d356050ad3d78fdc95e44eefa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Mar 2024 19:38:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Mar 2024 19:38:22 +0200    

Click here for diff

Now that BackendId was just another index into the proc array, it was  
redundant with the 0-based proc numbers used in other places. Replace  
all usage of backend IDs with proc numbers.  
  
The only place where the term "backend id" remains is in a few pgstat  
functions that expose backend IDs at the SQL level. Those IDs are now  
in fact 0-based ProcNumbers too, but the documentation still calls  
them "backend ids". That term still seems appropriate to describe what  
the numbers are, so I let it be.  
  
One user-visible effect is that pg_temp_0 is now a valid temp schema  
name, for backend with ProcNumber 0.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/xact.sgml
M src/backend/access/transam/README
M src/backend/access/transam/clog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup_incremental.c
M src/backend/catalog/catalog.c
M src/backend/catalog/namespace.c
M src/backend/catalog/storage.c
M src/backend/commands/async.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/sequence.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/init/globals.c
M src/backend/utils/time/snapmgr.c
M src/common/relpath.c
M src/include/access/twophase.h
M src/include/catalog/namespace.h
M src/include/common/relpath.h
M src/include/libpq/pqmq.h
M src/include/miscadmin.h
M src/include/postmaster/postmaster.h
D src/include/storage/backendid.h
M src/include/storage/lock.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
A src/include/storage/procnumber.h
M src/include/storage/procsignal.h
M src/include/storage/relfilelocator.h
M src/include/storage/sinval.h
M src/include/storage/smgr.h
M src/include/utils/backend_status.h
M src/include/utils/rel.h

Redefine backend ID to be an index into the proc array

commit   : ab355e3a88de745607f6dd4c21f0119b5c68f2ad    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Mar 2024 19:37:28 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Mar 2024 19:37:28 +0200    

Click here for diff

Previously, backend ID was an index into the ProcState array, in the  
shared cache invalidation manager (sinvaladt.c). The entry in the  
ProcState array was reserved at backend startup by scanning the array  
for a free entry, and that was also when the backend got its backend  
ID. Things become slightly simpler if we redefine backend ID to be the  
index into the PGPROC array, and directly use it also as an index to  
the ProcState array. This uses a little more memory, as we reserve a  
few extra slots in the ProcState array for aux processes that don't  
need them, but the simplicity is worth it.  
  
Aux processes now also have a backend ID. This simplifies the  
reservation of BackendStatusArray and ProcSignal slots.  
  
You can now convert a backend ID into an index into the PGPROC array  
simply by subtracting 1. We still use 0-based "pgprocnos" in various  
places, for indexes into the PGPROC array, but the only difference now  
is that backend IDs start at 1 while pgprocnos start at 0. (The next  
commmit will get rid of the term "backend ID" altogether and make  
everything 0-based.)  
  
There is still a 'backendId' field in PGPROC, now part of 'vxid' which  
encapsulates the backend ID and local transaction ID together. It's  
needed for prepared xacts. For regular backends, the backendId is  
always equal to pgprocno + 1, but for prepared xact PGPROC entries,  
it's the ID of the original backend that processed the transaction.  
  
Reviewed-by: Andres Freund, Reid Thompson  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/catalog/namespace.c
M src/backend/commands/sequence.c
M src/backend/executor/functions.c
M src/backend/postmaster/auxprocess.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/init/postinit.c
M src/backend/utils/time/snapmgr.c
M src/include/miscadmin.h
M src/include/storage/backendid.h
M src/include/storage/lock.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/sinvaladt.h
M src/pl/plpgsql/src/pl_exec.c

GUC table: Add description to computed variables

commit   : 30b8d6e4ce1112168ddfe8cdbba76fbefd304b34    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 3 Mar 2024 14:53:47 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 3 Mar 2024 14:53:47 +0100    

Click here for diff

Per suggestion from Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Documentation update for Standard Collations.

commit   : 875e46a0a246e416b12a9debe084ede9d02f1b5d    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 2 Mar 2024 13:37:43 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 2 Mar 2024 13:37:43 -0800    

Click here for diff

Correct out-of-date text that said the "default" collation is always  
based on LC_COLLATE and LC_CTYPE.  
  
Also reformat into a list to make it easier to understand and compare  
the available collations, and briefly document the stability  
characteristics of each one.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml

Fix overflow in Windows replacement pg_pread/pg_pwrite.

commit   : 1e013746544bd1f9df70f5547894fd72719c4b85    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 3 Mar 2024 08:40:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 3 Mar 2024 08:40:41 +1300    

Click here for diff

When calling the Windows file I/O APIs there is an implicit conversion  
from size_t to DWORD, which could overflow.  Clamp the size at 1GB to  
avoid that.  
  
Not a really a live bug as we don't expect anything in PostgreSQL to  
call with such large values.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/1672202.1703441340%40sss.pgh.pa.us  

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

Return ssize_t in fd.c I/O functions.

commit   : 653b55b57081dc6fb8c75d61870c5fdc8c8554cc    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 2 Mar 2024 11:59:34 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 2 Mar 2024 11:59:34 +1300    

Click here for diff

In the past, FileRead() and FileWrite() used types based on the Unix  
read() and write() functions from before C and POSIX standardization,  
though not exactly (we had int for amount instead of unsigned).  In  
commit 2d4f1ba6 we changed to the appropriate standard C types, just  
like the modern POSIX functions they wrap, but again not exactly: the  
return type stayed as int.  In theory, a ssize_t value could be returned  
by the underlying call that is too large for an int.  
  
That wasn't really a live bug, because we don't expect PostgreSQL code  
to perform reads or writes of gigabytes, and OSes probably apply  
internal caps smaller than that anyway.  This change is done on the  
principle that the return might as well follow the standard interfaces  
consistently.  
  
Reported-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/1672202.1703441340%40sss.pgh.pa.us  

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

Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax

commit   : 655dc310460c601d434d05339b7fa46ed97675b3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2024 18:03:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2024 18:03:48 +0900    

Click here for diff

This commit switches pg_enc2gettext_tbl[] in encnames.c to use a  
C99-designated initializer syntax.  
  
pg_bind_textdomain_codeset() is simplified so as it is possible to do  
a direct lookup at the gettext() array with a value of the enum pg_enc  
rather than doing a loop through all its elements, as long as the  
encoding value provided by GetDatabaseEncoding() is in the correct range  
of supported encoding values.  Note that PG_MULE_INTERNAL gains a value  
in the array, pointing to NULL.  
  
Author: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/utils/mb/mbutils.c
M src/common/encnames.c
M src/include/mb/pg_wchar.h
M src/tools/pgindent/typedefs.list

Fix BF failure introduced by commit b3f6b14cf4.

commit   : def0ce3370689b939c6d7a3c3eb824d69989ef6e    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2024 10:25:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2024 10:25:36 +0530    

Click here for diff

The test added by commit b3f6b14cf4 uses a non-superuser and forgot to set  
up pg_hba.conf to allow connections from it. The special setup is only  
needed on Windows machines that don't use UNIX sockets.  
  
As per buildfarm  
  
Discussion: https://postgr.es/m/CAJpy0uCfrSspV1x3VWkgamqyhYaUWQZpP0nqjJx4YPvKqN6P_A@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Convert unloggedLSN to an atomic variable.

commit   : 963d3072af21afbcb1183b3c960135cc7df02f3f    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 14:34:10 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 14:34:10 -0600    

Click here for diff

Currently, this variable is an XLogRecPtr protected by a spinlock.  
By converting it to an atomic variable, we can remove the spinlock,  
which saves a small amount of shared memory space.  Since this code  
is not performance-critical, we use atomic operations with full  
barrier semantics to make it easy to reason about correctness.  
  
Author: John Morris  
Reviewed-by: Michael Paquier, Robert Haas, Andres Freund, Stephen Frost, Bharath Rupireddy  
Discussion: https://postgr.es/m/BYAPR13MB26772534335255E50318C574A0409%40BYAPR13MB2677.namprd13.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR13MB2688FD8B757316CB5C54C8A2A0DDA%40MN2PR13MB2688.namprd13.prod.outlook.com  

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

Convert archiver's force_dir_scan variable to an atomic variable.

commit   : 3179701505b9ec58243ffba9d22b1803f320bf60    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:17:55 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:17:55 -0600    

Click here for diff

Commit bd5132db55 introduced new atomic read/write functions with  
full barrier semantics, which are intended to simplify converting  
non-performance-critical code to use atomic variables.  This commit  
demonstrates one such conversion.  
  
Reviewed-by: Yong Li  
Discussion: https://postgr.es/m/20231110205128.GB1315705%40nathanxps13  

M src/backend/postmaster/pgarch.c

Introduce atomic read/write functions with full barrier semantics.

commit   : bd5132db558b6c8d11eb838be81e2177a95c7388    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:00:44 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:00:44 -0600    

Click here for diff

Writing correct code using atomic variables is often difficult due  
to the memory barrier semantics (or lack thereof) of the underlying  
operations.  This commit introduces atomic read/write functions  
with full barrier semantics to ease this cognitive load.  For  
example, some spinlocks protect a single value, and these new  
functions make it easy to convert the value to an atomic variable  
(thus eliminating the need for the spinlock) without modifying the  
barrier semantics previously provided by the spinlock.  Since these  
functions may be less performant than the other atomic reads and  
writes, they are not suitable for every use-case.  However, using a  
single atomic operation with full barrier semantics may be more  
performant in cases where a separate explicit barrier would  
otherwise be required.  
  
The base implementations for these new functions are atomic  
exchanges (for writes) and atomic fetch/adds with 0 (for reads).  
These implementations can be overwritten with better architecture-  
specific versions as they are discovered.  
  
This commit leaves converting existing code to use these new  
functions as a future exercise.  
  
Reviewed-by: Andres Freund, Yong Li, Jeff Davis  
Discussion: https://postgr.es/m/20231110205128.GB1315705%40nathanxps13  

M src/include/port/atomics.h
M src/include/port/atomics/generic.h

Support MERGE into updatable views.

commit   : 5f2e179bd31e5f5803005101eb12a8d7bf8db8f3    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 15:56:59 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 15:56:59 +0000    

Click here for diff

This allows the target relation of MERGE to be an auto-updatable or  
trigger-updatable view, and includes support for WITH CHECK OPTION,  
security barrier views, and security invoker views.  
  
A trigger-updatable view must have INSTEAD OF triggers for every type  
of action (INSERT, UPDATE, and DELETE) mentioned in the MERGE command.  
An auto-updatable view must not have any INSTEAD OF triggers. Mixing  
auto-update and trigger-update actions (i.e., having a partial set of  
INSTEAD OF triggers) is not supported.  
  
Rule-updatable views are also not supported, since there is no  
rewriter support for non-SELECT rules with MERGE operations.  
  
Dean Rasheed, reviewed by Jian He and Alvaro Herrera.  
  
Discussion: https://postgr.es/m/CAEZATCVcB1g0nmxuEc-A+gGB0HnfcGQNGYH7gS=7rq0u0zOBXA@mail.gmail.com  

M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/rules.sgml
M src/backend/commands/copyfrom.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/parser/parse_merge.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/executor/executor.h
M src/include/nodes/parsenodes.h
M src/include/rewrite/rewriteHandler.h
M src/test/regress/expected/merge.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/merge.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/updatable_views.sql

Add missing RangeTblEntry field to jumble

commit   : 8b29a119fdaa381d6f75105f539b1e658c0f8cdb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Feb 2024 14:05:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Feb 2024 14:05:56 +0100    

Click here for diff

RangeTblEntry.funcordinality should be jumbled, because the WITH  
ORDINALITY clause changes the query result.  
  
This was apparently an oversight in the past.  
  
Discussion: https://www.postgresql.org/message-id/flat/d7f421f8-fd6d-4759-adc3-247090a5d44b%40eisentraut.org  

M src/backend/nodes/queryjumblefuncs.c

Remove field UpdateContext->updated in nodeModifyTable.c

commit   : 362de947cd7e8c826d9b3c5dc2590348263ed3c1    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 11:49:30 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 11:49:30 +0000    

Click here for diff

This field has been redundant ever since it was added by commit  
25e777cf8e, which split up ExecUpdate() and ExecDelete() into reusable  
pieces. The only place that reads it is ExecMergeMatched(), if the  
result from ExecUpdateAct() is TM_Ok. However, all paths through  
ExecUpdateAct() that return TM_Ok also set this field to true, so the  
return status by itself is sufficient to tell if the update happened.  
  
Removing this field is a modest simplification, and it brings the  
UPDATE path in ExecMergeMatched() more into line with ExecUpdate(),  
ensuring that ExecUpdateEpilogue() is always called if ExecUpdateAct()  
returns TM_Ok, reducing the chance of bugs.  
  
Dean Rasheed, reviewed by Alvaro Herrera.  
  
Discussion: https://postgr.es/m/CAEZATCWGGmigGBzLHkJm5Ccv2mMxXmwi3%2Buq0yhwDHm-tsvSLg%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Fix integer underflow in shared memory debugging

commit   : 6fd144e3a9664ea545d10008c48dceb6c4e9d38a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Feb 2024 12:19:52 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Feb 2024 12:19:52 +0100    

Click here for diff

dsa_dump would print a large negative number instead of zero for  
segment bin 0.  Fix by explicitly checking for underflow and add  
special case for bin 0. Backpatch to all supported versions.  
  
Author: Ian Ilyasov <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/GV1P251MB1004E0D09D117D3CECF9256ECD502@GV1P251MB1004.EURP251.PROD.OUTLOOK.COM  
Backpatch-through: v12  

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

Fixups for commit 93db6cbda0.

commit   : b3f6b14cf48ffa81084072f1fdeee2fe9df20746    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 29 Feb 2024 09:45:20 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 29 Feb 2024 09:45:20 +0530    

Click here for diff

Ensure to set always-secure search path for both local and remote  
connections during slot synchronization, so that malicious users can't  
redirect user code (e.g. operators).  
  
In the passing, improve the name of define, remove spurious return  
statement, and a minor change in one of the comments.  
  
Author: Bertrand Drouvot and Shveta Malik  
Reviewed-by: Amit Kapila, Peter Smith  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAJpy0uBNP=nrkNJkJSfF=jSocEh8vU2Owa8Rtpi=63fG=SvfVQ@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/slotsync.c
M src/test/recovery/t/040_standby_failover_slots_sync.pl

commit   : ada87a4d95fc39dfb1214edf6653390314b6f0df    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Feb 2024 09:54:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Feb 2024 09:54:25 +0900    

Click here for diff

This updates the following lookup arrays to use C99-designated  
initializer syntax, indexed based on the enum pg_enc:  
pg_enc2icu_tbl[]  
pg_enc2name_tbl[]  
pg_wchar_table[]  
  
This is more readable, and removes problems with ordering mistakes as  
this removes dependencies between the arrays and their lookup index in  
the enum pg_enc.  So, adding new encodings becomes easier, even if this  
does not happen often.  
  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Japin Li  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/common/encnames.c
M src/common/wchar.c
M src/include/mb/pg_wchar.h

Fix cross-version upgrade tests after f0827b443.

commit   : e8aecc5c2ce1d3b2b1b01bd770c14f5214c2a369    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 17:47:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 17:47:25 -0500    

Click here for diff

Removing the get_columns_length() function from regress.so  
means we have to drop it when testing upgrades from versions  
that had it.  Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix documentation comments for test CA config files

commit   : 6a6b7f5de3ff0dad46aab9e8e17a3747370199a3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 28 Feb 2024 22:57:00 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 28 Feb 2024 22:57:00 +0100    

Click here for diff

The config files which are used to generate the server and client  
CAs claimed that these were self-signed, when they in reality are  
signed by the root_ca (which however is self-signed).  Reword the  
comments to match.  
  
Author: David Zhang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/conf/client_ca.config
M src/test/ssl/conf/root_ca.config
M src/test/ssl/conf/server_ca.config

Improve plpgsql's error messages for incorrect %TYPE and %ROWTYPE.

commit   : 2a6b47cb50eb9b62b050de2cddd03a9ac267e61f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 16:05:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 16:05:17 -0500    

Click here for diff

If one of these constructs referenced a nonexistent object, we'd fall  
through to feeding the whole construct to the core parser, which would  
reject it with a "syntax error" message.  That's pretty unhelpful and  
misleading.  There's no good reason for plpgsql_parse_wordtype and  
friends not to throw a useful error for incorrect input, so make them  
do that instead of returning NULL.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/sql/plpgsql_misc.sql

Convert README to Markdown.

commit   : 363eb059966d0be0a41c206cee40dfd21eb73251    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 28 Feb 2024 14:53:52 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 28 Feb 2024 14:53:52 -0600    

Click here for diff

This is a first step toward modernizing our README file.  Some  
popular developer platforms support rendering README.md files, so  
a direct conversion to Markdown seems like a good place to start.  
The intent is to keep this file legible as plain text even as it  
accumulates more content.  
  
Suggested-by: Andrew Atkinson  
Reviewed-by: Tom Lane, Daniel Gustafsson, Joe Conway  
Discussion: https://postgr.es/m/CAG6XLEmGE95DdKqjk%2BDd9vC8mfN7BnV2WFgYk_9ovW6ikN0YSg%40mail.gmail.com  

R075 README README.md

Mop-up for AIX-ectomy: remove now-dead test code.

commit   : f0827b443e6014a9d9fdcdd099603576154a3733    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:34:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:34:19 -0500    

Click here for diff

Commit 0b16bb877 removed the test query added by commit 79b716cfb,  
but not the C-language support function used by that query.  I don't  
see any plausible reason why we'd need that function again, so throw  
it overboard too.  

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

Fix mis-rounding and overflow hazards in date_bin().

commit   : d163fdbfea82a5a578de5bc6392ae84c590bb454    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:00:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:00:30 -0500    

Click here for diff

In the case where the target timestamp is before the origin timestamp  
and their difference is already an exact multiple of the stride, the  
code incorrectly subtracted the stride anyway.  
  
Also detect several integer-overflow cases that previously produced  
bogus results.  (The submitted patch tried to avoid overflow, but  
I'm not convinced it's right, and problematic cases are so far out of  
the plausibly-useful range that they don't seem worth sweating over.  
Let's just use overflow-detecting arithmetic and throw errors.)  
  
timestamp_bin() and timestamptz_bin() are basically identical and  
so had identical bugs.  Fix both.  
  
Report and patch by Moaaz Assali, adjusted some by me.  Back-patch  
to v14 where date_bin() was introduced.  
  
Discussion: https://postgr.es/m/CALkF+nvtuas-2kydG-WfofbRSJpyODAJWun==W-yO5j2R4meqA@mail.gmail.com  

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

Improve performance of subsystems on top of SLRU

commit   : 53c2a97a92665be6bd7d70bd62ae6158fe4db96e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:31 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:31 +0100    

Click here for diff

More precisely, what we do here is make the SLRU cache sizes  
configurable with new GUCs, so that sites with high concurrency and big  
ranges of transactions in flight (resp. multixacts/subtransactions) can  
benefit from bigger caches.  In order for this to work with good  
performance, two additional changes are made:  
  
1. the cache is divided in "banks" (to borrow terminology from CPU  
   caches), and algorithms such as eviction buffer search only affect  
   one specific bank.  This forestalls the problem that linear searching  
   for a specific buffer across the whole cache takes too long: we only  
   have to search the specific bank, whose size is small.  This work is  
   authored by Andrey Borodin.  
  
2. Change the locking regime for the SLRU banks, so that each bank uses  
   a separate LWLock.  This allows for increased scalability.  This work  
   is authored by Dilip Kumar.  (A part of this was previously committed as  
   d172b717c6f4.)  
  
Special care is taken so that the algorithms that can potentially  
traverse more than one bank release one bank's lock before acquiring the  
next.  This should happen rarely, but particularly clog.c's group commit  
feature needed code adjustment to cope with this.  I (Álvaro) also added  
lots of comments to make sure the design is sound.  
  
The new GUCs match the names introduced by bcdfa5f2e2f2 in the  
pg_stat_slru view.  
  
The default values for these parameters are similar to the previous  
sizes of each SLRU.  commit_ts, clog and subtrans accept value 0, which  
means to adjust by dividing shared_buffers by 512 (so 2MB for every 1GB  
of shared_buffers), with a cap of 8MB.  (A new slru.c function  
SimpleLruAutotuneBuffers() was added to support this.)  The cap was  
previously 1MB for clog, so for sites with more than 512MB of shared  
memory the total memory used increases, which is likely a good tradeoff.  
However, other SLRUs (notably multixact ones) retain smaller sizes and  
don't support a configured value of 0.  These values based on  
shared_buffers may need to be revisited, but that's an easy change.  
  
There was some resistance to adding these new GUCs: it would be better  
to adjust to memory pressure automatically somehow, for example by  
stealing memory from shared_buffers (where the caches can grow and  
shrink naturally).  However, doing that seems to be a much larger  
project and one which has made virtually no progress in several years,  
and because this is such a pain point for so many users, here we take  
the pragmatic approach.  
  
Author: Andrey Borodin <[email protected]>  
Author: Dilip Kumar <[email protected]>  
Reviewed-by: Amul Sul, Gilles Darold, Anastasia Lubennikova,  
	Ivan Lazarev, Robert Haas, Thomas Munro, Tomas Vondra,  
	Yura Sokolov, Васильев Дмитрий (Dmitry Vasiliev).  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/multixact.h
M src/include/access/slru.h
M src/include/access/subtrans.h
M src/include/commands/async.h
M src/include/miscadmin.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h
M src/include/utils/guc_hooks.h
M src/test/modules/test_slru/test_slru.c

Remove configure --with-CC option

commit   : 1c1eec0f2d88b7e823af959103b2100da493caa9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:09 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:09 +0400    

Click here for diff

It's been deprecated since commit cb292206c5 from July 2000.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M configure
M configure.ac

Run autoconf, for update of a comment.

commit   : 802d886054ff948022a93bae324eae66276623cc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 16:44:32 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 16:44:32 +0400    

Click here for diff

I forgot to run autoconf in commit 0b16bb8776, after some last minute  
comment changes.  

M configure

Remove AIX support

commit   : 0b16bb8776bb834eb1ef8204ca95dd7667ab948b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 15:10:51 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 15:10:51 +0400    

Click here for diff

There isn't a lot of user demand for AIX support, we have a bunch of  
hacks to work around AIX-specific compiler bugs and idiosyncrasies,  
and no one has stepped up to the plate to properly maintain it.  
Remove support for AIX to get rid of that maintenance overhead. It's  
still supported for stable versions.  
  
The acute issue that triggered this decision was that after commit  
8af2565248, the AIX buildfarm members have been hitting this  
assertion:  
  
    TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728  
  
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX  
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.  
That could be worked around, but we decided to just drop the AIX support  
instead.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro  

M Makefile
M config/c-compiler.m4
M configure
M configure.ac
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/runtime.sgml
M meson.build
M src/Makefile.shlib
M src/backend/Makefile
M src/backend/meson.build
D src/backend/port/aix/mkldexport.sh
M src/backend/utils/error/elog.c
M src/backend/utils/misc/ps_status.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/include/c.h
D src/include/port/aix.h
M src/include/port/atomics.h
M src/include/storage/s_lock.h
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/meson.build
D src/makefiles/Makefile.aix
M src/port/README
M src/port/strerror.c
D src/template/aix
M src/test/regress/Makefile
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/sanity_check.sql
M src/tools/gen_export.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Rename SLRU elements in view pg_stat_slru

commit   : bcdfa5f2e2f274caeed20b2f986012a9cb6a259c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 09:39:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 09:39:52 +0100    

Click here for diff

The new names are intended to match those in an upcoming patch that adds  
a few GUCs to configure the SLRU buffer sizes.  
  
Backwards compatibility concern: this changes the accepted names for  
function pg_stat_slru_rest().  Since this function recognizes "any other  
string" as a request to reset the entry for "other", this means that  
calling it with the old names would silently reset "other" instead of  
doing nothing or throwing an error.  
  
Reviewed-by: Andrey M. Borodin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/predicate.c
M src/include/utils/pgstat_internal.h
M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Remove last NULL element in config_group_names[]

commit   : 48920476b490544a3ee137da714424cd354bc2b6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 12:51:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 12:51:35 +0900    

Click here for diff

This has not been needed since 9d77708d83ee where there was a loop to  
print all the possible GUC groups, relying on the last element to be  
NULL.  
  
Author: Japin Li  
Reviewed-By: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

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

Refactor AllocSetAlloc(), separating hot and cold paths

commit   : 413c18401dcc170636429127e2494d8beba4b92f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Feb 2024 14:20:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Feb 2024 14:20:43 +1300    

Click here for diff

Allocating from a free list or from a block which contains enough space  
already, we deem to be common code paths and want to optimize for those.  
Having to allocate a new block, either a normal block or a dedicated one  
for a large allocation, we deem to be less common, therefore we class  
that as "cold".  Both cold paths require a malloc so are going to be  
slower as a result of that regardless.  
  
The main motivation here is to remove the calls to malloc() in the hot  
path and because of this, the compiler is now free to not bother setting  
up the stack frame in AllocSetAlloc(), thus making the hot path much  
cheaper.  
  
Author: Andres Freund  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

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

Use C99-designated initializer syntax for more arrays

commit   : afd8ef39094b0dff9d1f2bfecb1d9fa056b85e19    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 08:42:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 08:42:36 +0900    

Click here for diff

This is in the same spirit as ef5e2e90859a, updating this time some  
arrays in parser.c, relpath.c, guc_tables.c and pg_dump_sort.c so as the  
order of their elements has no need to match the enum structures they  
are based on anymore.  
  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Japin Li  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/parser/parser.c
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_dump/pg_dump_sort.c
M src/common/relpath.c

Fix comments for the dshash_parameters struct.

commit   : e1724af42c7b0bddad2785f8f7a15c4c123862b2    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 27 Feb 2024 09:44:59 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 27 Feb 2024 09:44:59 -0600    

Click here for diff

A recent commit added a copy_function member to the  
dshash_parameters struct, but it missed updating a couple of  
comments that refer to the function pointer members of this struct.  
One of those comments also refers to a tranche_name member and non-  
arg variants of the function pointer members, all of which were  
either removed during development or removed shortly after dshash  
table support was committed.  
  
Oversights in commits 8c0d7bafad, d7694fc148, and 42a1de3013.  
  
Discussion: https://postgr.es/m/20240227045213.GA2329190%40nathanxps13  

M src/backend/lib/dshash.c
M src/include/lib/dshash.h

Rationalize and improve error messages for some jsonpath items

commit   : 92d2ab7554f92b841ea71bcc72eaa8ab11aae662    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 27 Feb 2024 01:31:40 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 27 Feb 2024 01:31:40 -0500    

Click here for diff

This is a followup to commit 66ea94e8e6.  
  
Error mssages concerning incorrect formats for date-time types are  
unified and parameterized, instead of using a fully separate error  
message for each type.  
  
Similarly, error messages regarding numeric and string arguments to  
certain items are standardized, and instead of saying that the argument  
is out of range simply say that it is invalid. The actual invalid  
arguments to these itesm are now shown in the error message.  
  
Error messages relating to numeric inputs of Nan or Infinity are  
made more informative.  
  
Jeevan Chalke and Kyotaro Horiguchi, with some input from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove unnecessary array object_classes[] in dependency.c

commit   : ef5e2e90859a39efdd3a78e528c544b585295a78    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 15:18:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 15:18:17 +0900    

Click here for diff

object_classes[] provided unnecessary indirection between catalog OIDs  
and the enum ObjectClass when calling add_object_address().  This array  
has been originally introduced in 30ec31604d5 and was useful because not  
all relation OIDs were compile-time constants back then, which has not  
been the case for a long time now for all the elements of ObjectClass.  
  
This commit removes object_classes[], switching to the catalog OIDs  
when calling add_object_address().  This shaves some code while saving  
in maintenance because it was necessary to maintain the enum ObjectClass  
and the array in sync when adding new object types.  
  
Reported-by: Jeff Davis  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Michael Paquier  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/catalog/dependency.c
M src/include/catalog/dependency.h

Adjust memory allocation functions to allow sibling calls

commit   : 743112a2e9938b98d716384fa9374c41afe74e41    
  
author   : David Rowley <[email protected]>    
date     : Tue, 27 Feb 2024 16:39:42 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 27 Feb 2024 16:39:42 +1300    

Click here for diff

Many modern compilers are able to optimize function calls to functions  
where the parameters of the called function match a leading subset of  
the calling function's parameters.  If there are no instructions in the  
calling function after the function is called, then the compiler is free  
to avoid any stack frame setup and implement the function call as a  
"jmp" rather than a "call".  This is called sibling call optimization.  
  
Here we adjust the memory allocation functions in mcxt.c to allow this  
optimization.  This requires moving some responsibility into the memory  
context implementations themselves.  It's now the responsibility of the  
MemoryContext to check for malloc failures.  This is good as it both  
allows the sibling call optimization, but also because most small and  
medium allocations won't call malloc and just allocate memory to an  
existing block.  That can't fail, so checking for NULLs in that case  
isn't required.  
  
Also, traditionally it's been the responsibility of palloc and the other  
allocation functions in mcxt.c to check for invalid allocation size  
requests.  Here we also move the responsibility of checking that into the  
MemoryContext.  This isn't to allow the sibling call optimization, but  
more because most of our allocators handle large allocations separately  
and we can just add the size check when doing large allocations.  We no  
longer check this for non-large allocations at all.  
  
To make checking the allocation request sizes and ERROR handling easier,  
add some helper functions to mcxt.c for the allocators to use.  
  
Author: Andres Freund  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils_internal.h

Fix comment thinko in sequence.c

commit   : 17a3f79f812cf196063c4146d64c6479e974a5c5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 08:19:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 08:19:39 +0900    

Click here for diff

One comment mentioned indexes, but the relation opened should be  
sequences.  
  
Reported-by: Matthias van de Meent  
Discussion: https://postgr.es/m/CAEze2WiMGNG9XK3NSUen-5BARhCnP=u=FXnf8pvpL2qDKeOsZg@mail.gmail.com  

M src/backend/access/sequence/sequence.c

Add helper functions for dshash tables with string keys.

commit   : 42a1de3013eac394c3a170ce728f0280a62187bd    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:47:13 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:47:13 -0600    

Click here for diff

Presently, string keys are not well-supported for dshash tables.  
The dshash code always copies key_size bytes into new entries'  
keys, and dshash.h only provides compare and hash functions that  
forward to memcmp() and tag_hash(), both of which do not stop at  
the first NUL.  This means that callers must pad string keys so  
that the data beyond the first NUL does not adversely affect the  
results of copying, comparing, and hashing the keys.  
  
To better support string keys in dshash tables, this commit does  
a couple things:  
  
* A new copy_function field is added to the dshash_parameters  
  struct.  This function pointer specifies how the key should be  
  copied into new table entries.  For example, we only want to copy  
  up to the first NUL byte for string keys.  A dshash_memcpy()  
  helper function is provided and used for all existing in-tree  
  dshash tables without string keys.  
  
* A set of helper functions for string keys are provided.  These  
  helper functions forward to strcmp(), strcpy(), and  
  string_hash(), all of which ignore data beyond the first NUL.  
  
This commit also adjusts the DSM registry's dshash table to use the  
new helper functions for string keys.  
  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/20240119215941.GA1322079%40nathanxps13  

M src/backend/lib/dshash.c
M src/backend/replication/logical/launcher.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/cache/typcache.c
M src/include/lib/dshash.h

Use NULL instead of 0 for 'arg' argument in dshash_create() calls.

commit   : 5fe08c006c826da4a7f5db2a79327477599edbc6    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:46:01 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:46:01 -0600    

Click here for diff

A couple of dshash_create() callers provide 0 for the 'void *arg'  
argument, which might give readers the incorrect impression that  
this is some sort of "flags" parameter.  
  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/20240119215941.GA1322079%40nathanxps13  

M src/backend/replication/logical/launcher.c
M src/backend/utils/activity/pgstat_shmem.c

Revise MERGE documentation

commit   : 6979ea2638a51c40acf6d04b816550b2c35b3e55    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 18:19:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 18:19:03 +0100    

Click here for diff

Add a note about the additional privileges required after the fix in  
4989ce72644b (wording per Tom Lane); also change marked-up mentions of  
"target_table_name" to be simply "the target table" or the like.  Also,  
note that "join_condition" is scouted for requisite privileges.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

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

slru.c: Reduce scope of variables in 'for' blocks

commit   : 5f79cb7629a4ce6321f509694ebf475a931608b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 16:49:50 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 16:49:50 +0100    

Click here for diff

Pretty boring.  

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

Group more closely cache updates for backends in sequence.c

commit   : 6e951bf98e2e0230ed95db2fafc244536bd7502f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 17:03:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 17:03:18 +0900    

Click here for diff

Information of sequences is cached for each backend for currval() and  
nextval(), and the update of some cached information was mixed in the  
middle of computations based on the other properties of a sequence, for  
the increment value in nextval() and the cached state when altering a  
sequence.  
  
Grouping them makes the code easier to follow and to refactor in the  
future, when splitting the computation and the SeqTable change parts.  
Note that the cached data is untouched between the areas where these  
cache updates are moved.  
  
Issue noticed while doing some refactoring of the sequence code.  
  
Author: Michael Paquier  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c

Introduce sequence_*() access functions

commit   : 449e798c77ed9a03f8bb04e5d324d4e3cfbbae8e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 16:04:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 16:04:59 +0900    

Click here for diff

Similarly to tables and indexes, these functions are able to open  
relations with a sequence relkind, which is useful to make a distinction  
with the other relation kinds.  Previously, commands/sequence.c used a  
mix of table_{close,open}() and relation_{close,open}() routines when  
manipulating sequence relations, so this clarifies the code.  
  
A direct effect of this change is to align the error messages produced  
when attempting DDLs for sequences on relations with an unexpected  
relkind, like a table or an index with ALTER SEQUENCE, providing an  
extra error detail about the relkind of the relation used in the DDL  
query.  
  
Author: Michael Paquier  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/Makefile
M src/backend/access/meson.build
A src/backend/access/sequence/Makefile
A src/backend/access/sequence/meson.build
A src/backend/access/sequence/sequence.c
M src/backend/commands/sequence.c
A src/include/access/sequence.h
M src/test/regress/expected/sequence.out

Fix incorrect format placeholder

commit   : 025f0a6f9113efe89bb65b9efe0cb96a5d7c7ad1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2024 07:16:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2024 07:16:31 +0100    

Click here for diff

Not only did the format placeholder not match the variable, the  
variable also didn't match the function it was getting its value from.  

M src/backend/backup/basebackup_incremental.c

Promote assertion about !ReindexIsProcessingIndex to runtime error.

commit   : f5a465f1a07474f380b54073a518602b342a188b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 16:15:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 16:15:07 -0500    

Click here for diff

When this assertion was installed (in commit d2f60a3ab), I thought  
it was only for catching server logic errors that caused accesses to  
catalogs that were undergoing index rebuilds.  However, it will also  
fire in case of a user-defined index expression that attempts to  
access its own table.  We occasionally see reports of people trying  
to do that, and typically getting unintelligible low-level errors  
as a result.  We can provide a more on-point message by making this  
a regular runtime check.  
  
While at it, adjust the similar error check in  
systable_beginscan_ordered to use the same message text.  That one  
is (probably) not reachable without a coding bug, but we might as  
well use a translatable message if we have one.  
  
Per bug #18363 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c

Doc: fix minor typos in two ECPG function descriptions.

commit   : 57b28c08305a7696375eae9a0a26532f8fb84d1b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 15:29:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 15:29:09 -0500    

Click here for diff

Noted by Aidar Imamov.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml

Improve documentation and GUC description for transaction_timeout

commit   : 28e858c0f951a5f86f43ba9b8922c64bba96d2e1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:30:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:30:17 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

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

Remove flaky isolation tests for timeouts

commit   : a661bf7b0f56dd8bc298309de9937081ef485370    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:00:03 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:00:03 +0200    

Click here for diff

51efe38cb92f introduced bunch of tests for idle_in_transaction_session_timeout,  
transaction_timeout and statement_timeout. These tests were too flaky on some  
slow buildfarm machines, so we plan to replace them with TAP tests using  
injection points. This commit removes flaky tests.  
  
Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com  
Author: Andrey Borodin  

M src/test/isolation/expected/timeouts.out
M src/test/isolation/specs/timeouts.spec

Multiple revisions to the GROUP BY reordering tests

commit   : 874d817baa160ca7e68bee6ccc9fc1848c56e750    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 01:49:06 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 01:49:06 +0200    

Click here for diff

Discussion: https://postgr.es/m/CAMbWs4-NKLa%2BSs%2BX%3DWR6h0x%3DT07YBJoAz70ZGHzc-2zcHUHb0A%40mail.gmail.com  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov, Alexander Korotkov  

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

Replace lateral references to removed rels in subqueries

commit   : 466979ef031afff000f3f92b812b946cf3a416c1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 00:34:52 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 00:34:52 +0200    

Click here for diff

This commit introduces a new field 'sublevels_up' in ReplaceVarnoContext,  
and enhances replace_varno_walker() to:  
  1) recurse into subselects with sublevels_up increased, and  
  2) perform the replacement only when varlevelsup is equal to sublevels_up.  
  
This commit also fixes some outdated comments.  And besides adding relevant  
test cases, it makes some unification over existing SJE test cases.  
  
Discussion: https://postgr.es/m/CAMbWs4-%3DPO6Mm9gNnySbx0VHyXjgnnYYwbN9dth%3DTLQweZ-M%2Bg%40mail.gmail.com  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov, Alexander Korotkov  

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

Avoid dangling-pointer problem with partitionwise joins under GEQO.

commit   : a6b2a51e16d7ae7b1982c9d8dfa61a637a832209    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2024 15:21:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2024 15:21:53 -0500    

Click here for diff

build_child_join_sjinfo creates a derived SpecialJoinInfo in  
the short-lived GEQO context, but afterwards the semi_rhs_exprs  
from that may be used in a UniquePath for a child base relation.  
This breaks the expectation that all base-relation-level structures  
are in the planning-lifespan context, leading to use of a dangling  
pointer with probable ensuing crash later on in create_unique_plan.  
To fix, copy the expression trees when making a UniquePath.  
  
Per bug #18360 from Alexander Lakhin.  This has been broken since  
partitionwise joins were added, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix compiler warning on typedef redeclaration

commit   : d360e3cc60e37d6d41ee78acf7bd5cb313b978c1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 17:39:27 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 17:39:27 +0200    

Click here for diff

    bulk_write.c:78:3: error: redefinition of typedef 'BulkWriteState' is a C11 feature [-Werror,-Wtypedef-redefinition]  
    } BulkWriteState;  
      ^  
    ../../../../src/include/storage/bulk_write.h:20:31: note: previous definition is here  
    typedef struct BulkWriteState BulkWriteState;  
                                  ^  
    1 error generated.  
  
Per buildfarm animals 'sifaka' and 'longfin'.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Introduce a new smgr bulk loading facility.

commit   : 8af256524893987a3e534c6578dd60edfb782a77    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 16:10:51 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 16:10:51 +0200    

Click here for diff

The new facility makes it easier to optimize bulk loading, as the  
logic for buffering, WAL-logging, and syncing the relation only needs  
to be implemented once. It's also less error-prone: We have had a  
number of bugs in how a relation is fsync'd - or not - at the end of a  
bulk loading operation. By centralizing that logic to one place, we  
only need to write it correctly once.  
  
The new facility is faster for small relations: Instead of of calling  
smgrimmedsync(), we register the fsync to happen at next checkpoint,  
which avoids the fsync latency. That can make a big difference if you  
are e.g. restoring a schema-only dump with lots of relations.  
  
It is also slightly more efficient with large relations, as the WAL  
logging is performed multiple pages at a time. That avoids some WAL  
header overhead. The sorted GiST index build did that already, this  
moves the buffering to the new facility.  
  
The changes to pageinspect GiST test needs an explanation: Before this  
patch, the sorted GiST index build set the LSN on every page to the  
special GistBuildLSN value, not the LSN of the WAL record, even though  
they were WAL-logged. There was no particular need for it, it just  
happened naturally when we wrote out the pages before WAL-logging  
them. Now we WAL-log the pages first, like in B-tree build, so the  
pages are stamped with the record's real LSN. When the build is not  
WAL-logged, we still use GistBuildLSN. To make the test output  
predictable, use an unlogged index.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/30e8f366-58b3-b239-c521-422122dd5150%40iki.fi  

M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/sql/gist.sql
M src/backend/access/gist/gistbuild.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/catalog/storage.c
M src/backend/storage/smgr/Makefile
A src/backend/storage/smgr/bulk_write.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/meson.build
M src/backend/storage/smgr/smgr.c
A src/include/storage/bulk_write.h
M src/include/storage/md.h
M src/include/storage/smgr.h
M src/tools/pgindent/typedefs.list

Fix mistake in SQL features list

commit   : e612384fc78d35c3d3a8b3d27cef5181dca8430b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2024 14:40:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2024 14:40:25 +0100    

Click here for diff

Fix for c9f57541d97: Feature F302-02 was renamed to F305, but that  
commit failed to delete the old line.  
  
Reported-by: Satoru Koizumi (小泉 悟) <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/170866661469.645.14101429540172934386%40wrigleys.postgresql.org  

M src/backend/catalog/sql_features.txt

Fix BF failure in commit 93db6cbda0.

commit   : d13ff82319ccaacb04d77b77a010ea7a1717564f    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 18:26:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 18:26:40 +0530    

Click here for diff

The code to match the required LOG in the test was not robust enough to  
match it. It was using a very specific format to search the required  
message which doesn't work when one uses log_error_verbosity = verbose.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/CAA4eK1KcQSk7wzC7Zfrth9OhrjW2HvxL4tKgU42qqH7p6jn+FA@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Make GetSlotInvalidationCause() return RS_INVAL_NONE on unexpected input

commit   : efa70c15c742511195e2ee6f0aef94d0797daf80    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 19:59:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 19:59:58 +0900    

Click here for diff

943f7ae1c869 has changed GetSlotInvalidationCause() so as it would  
return the last element of SlotInvalidationCauses[] when an incorrect  
conflict reason name is given by a caller, but this should return  
RS_INVAL_NONE in such cases, even if such a state should never be  
reached in practice.  
  
Per gripe from Peter Smith.  
  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CAHut+PtsrSWxczpGkSaSVtJo+BXrvJ3Hwp5gES14bbL-G+HL7A@mail.gmail.com  

M src/backend/replication/slot.c

Add a new slot sync worker to synchronize logical slots.

commit   : 93db6cbda037f1be9544932bd9a785dabf3ff712    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 15:25:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 15:25:15 +0530    

Click here for diff

By enabling slot synchronization, all the failover logical replication  
slots on the primary (assuming configurations are appropriate) are  
automatically created on the physical standbys and are synced  
periodically. The slot sync worker on the standby server pings the primary  
server at regular intervals to get the necessary failover logical slots  
information and create/update the slots locally. The slots that no longer  
require synchronization are automatically dropped by the worker.  
  
The nap time of the worker is tuned according to the activity on the  
primary. The slot sync worker waits for some time before the next  
synchronization, with the duration varying based on whether any slots were  
updated during the last cycle.  
  
A new parameter sync_replication_slots enables or disables this new  
process.  
  
On promotion, the slot sync worker is shut down by the startup process to  
drop any temporary slots acquired by the slot sync worker and to prevent  
the worker from trying to fetch the failover slots.  
  
A functionality to allow logical walsenders to wait for the physical will  
be done in a subsequent commit.  
  
Author: Shveta Malik, Hou Zhijie based on design inputs by Masahiko Sawada and Amit Kapila  
Reviewed-by: Masahiko Sawada, Bertrand Drouvot, Peter Smith, Dilip Kumar, Ajin Cherian, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/transam/xlogrecovery.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/miscadmin.h
M src/include/replication/slotsync.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl

pgindent fix

commit   : 3d47b75546d1ef70145f58e162a96f7e0c649389    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:59:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:59:15 +0100    

Click here for diff

for commit 489072ab7a  

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

Fix the intermittent buildfarm failures in 031_column_list.

commit   : b6df0798a5e2480d28cceee7df3f58650cf6fa7a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 12:06:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 12:06:44 +0530    

Click here for diff

The reason was that the ALTER SUBSCRIPTION .. SET PUBLICATION will lead to  
the restarting of apply worker and after the restart, the apply worker  
will use the existing slot and replication origin corresponding to the  
subscription. Now, it is possible that before restart the origin has not  
been updated and the WAL start location points to a location before where  
PUBLICATION exists which can lead to the error "publication ... does not  
exist".  
  
Fix it by recreating the subscription as a newly created subscription will  
start processing WAL from the recent WAL location and will see the  
required publication.  
  
This behavior has existed from the time logical replication was introduced  
but is exposed by this test and we have started a discussion for a better  
fix for this problem.  
  
As per Buildfarm  
  
Diagnosed-by: Amit Kapila  
Author: Vignesh C  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/031_column_list.pl

Remove custom Constraint node read/write implementations

commit   : fbc93b8b5f59cfb23c22a26a46ca7bcc826be442    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:07:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:07:12 +0100    

Click here for diff

This is part of an effort to reduce the number of special cases in the  
automatically generated node support functions.  
  
Allegedly, only certain fields of the Constraint node are valid based  
on contype.  But this has historically not been kept up to date in the  
read/write functions.  The Constraint node is only used for debugging  
DDL statements, so there are no strong requirements for its output,  
and there is no enforcement for its correctness.  (There was no read  
support before a6bc3301925.)  Commits e7a552f303c and abf46ad9c7b are  
examples of where omissions were fixed.  
  
This patch just removes the custom read/write implementations for the  
Constraint node type.  Now we just output all the fields, which is a  
bit more than before, but at least we don't have to maintain these  
functions anymore.  Also, we lose the string representation of the  
contype field, but for this marginal use case that seems tolerable.  
This patch also changes the documentation of the Constraint struct to  
put less emphasis on grouping fields by constraint type but rather  
document for each field how it's used.  
  
Reviewed-by: Paul Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Improve ERROR/LOG messages added by commits ddd5f4f54a and 7a424ece48.

commit   : 801792e528d6cb5eeb3a70f5ceb10b15bf92f0c7    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 11:17:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 11:17:00 +0530    

Click here for diff

Additionally, in slotsync.c, replace one StringInfoData variable usage  
with a constant string to avoid palloc/pfree. Also, replace the inclusion  
of "logical.h" with "slot.h" to prevent the exposure of unnecessary  
implementation details.  
  
Reported-by: Kyotaro Horiguchi, Masahiko Sawada  
Author: Shveta Malik based on suggestions by Robert Haas and Amit Kapila  
Reviewed-by: Kyotaro Horiguchi, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAD21AoCYXhDYOQDAS-rhGasC2T+tYbV=8Y18o94sB=5AxcW+yA@mail.gmail.com  

M src/backend/replication/logical/slotsync.c
M src/test/recovery/t/040_standby_failover_slots_sync.pl

Speed up uuid_out() by not relying on a StringInfo

commit   : 011d60c4352c5c48c0f1a185e8a12833c22a58db    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 10:02:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 10:02:55 +0900    

Click here for diff

Since the size of the string representation of an uuid is fixed, there  
is no benefit in using a StringInfo.  This commit simplifies uuid_oud()  
to not rely on a StringInfo, where avoiding the overhead of the string  
manipulation makes the function substantially faster.  
  
A COPY TO on a relation with one UUID attribute can show up to a 40%  
speedup when the bottleneck is the COPY computation with uuid_out()  
showing up at the top of the profiles (numbered measure here, Laurenz  
has mentioned something closer to 20% faster runtimes), for example when  
the data is fully in shared buffers or the OS cache.  
  
Author: Laurenz Albe  
Reviewed-by: Andres Freund, Michael Paquier  
Description: https://postgr.es/m/[email protected]  

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

Add lookup table for replication slot conflict reasons

commit   : 943f7ae1c8693cf3ea59d103aaf9590ea062fb9c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 08:40:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 08:40:40 +0900    

Click here for diff

This commit switches the handling of the conflict cause strings for  
replication slots to use a table rather than being explicitly listed,  
using a C99-designated initializer syntax for the array elements.  This  
makes the whole more readable while easing future maintenance with less  
areas to update when adding a new conflict reason.  
  
This is similar to 74a730631065, but the scale of the change is smaller  
as there are less conflict causes than LWLock builtin tranche names.  
  
Author: Bharath Rupireddy  
Reviewed-by: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CALj2ACUxSLA91QGFrJsWNKs58KXb1C03mbuwKmzqqmoAKLwJaw@mail.gmail.com  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h

Remove superfluous 'pgprocno' field from PGPROC

commit   : 28f3915b73f75bd1b50ba070f56b34241fe53fd1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Feb 2024 01:21:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Feb 2024 01:21:34 +0200    

Click here for diff

It was always just the index of the PGPROC entry from the beginning of  
the proc array. Introduce a macro to compute it from the pointer  
instead.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/clog.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h
M src/include/storage/proc.h

MERGE ... DO NOTHING: require SELECT privileges

commit   : 4989ce72644b9d636b9b23c7a1719a405e62670b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Feb 2024 17:18:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Feb 2024 17:18:52 +0100    

Click here for diff

Verify that a user running MERGE with a DO NOTHING clause has  
privileges to read the table, even if no columns are referenced.  Such  
privileges were already required if the ON clause or any of the WHEN  
conditions referenced any column at all, so there's no functional change  
in practice.  
  
This change fixes an assertion failure in the case where no column is  
referenced by the command and the WHEN clauses are all DO NOTHING.  
  
Backpatch to 15, where MERGE was introduced.  
  
Reported-by: Alena Rybakina <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_merge.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Fix typo

commit   : ed345c2728b3ebc160d8335464765679a08031b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2024 10:54:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2024 10:54:34 +0100    

Click here for diff

M src/backend/tcop/postgres.c

commit   : 690805ca75463a5511ddd5fa02d73928393e6c96    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 21 Feb 2024 09:08:28 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 21 Feb 2024 09:08:28 +0100    

Click here for diff

Commit a2c84990bea7 accidentally used the link for pg_hba_file_rules  
when linking to pg_ident_file_mappings.  Backpatch to v16 where this  
was introduced.  
  
Author: Erik Wienhold <[email protected]>  
Discussion: https://postgr.es/m/qt5hvgvfi4qzlgml2dfssaut2t2x5nwf7b5l63fklr7fpxwm6g@hle3mtglpm4y  
Backpatch-through: v16  

M doc/src/sgml/func.sgml

Add option force_initdb to PostgreSQL::Test::Cluster:init()

commit   : ff9e1e764fcce9a34467d614611a34d4d2a91b50    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Feb 2024 13:28:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Feb 2024 13:28:51 +0900    

Click here for diff

This option is useful to bypass the default behavior of init() which  
would create the data folder of a new cluster by copying it from a  
template previously initdb'd, if any.  Copying the data folder is much  
cheaper than running initdb, but some tests may want to force that.  For  
example, one scenario of pg_combinebackup updated in this commit needs a  
different system ID for two nodes.  
  
Previously, this could only be achieved by unsetting  
$ENV{'INITDB_TEMPLATE'}, which could become a problem in complex node  
setups by making tests less efficient.  
  
Author: Amul Sul  
Reviewed-by: Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_combinebackup/t/005_integrity.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Remove extra check_stack_depth() from dropconstraint_internal()

commit   : 75bcba6cbd2a6f62752d7917d9a3c0a52f8605c9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 21 Feb 2024 02:46:56 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 21 Feb 2024 02:46:56 +0200    

Click here for diff

The second check was added by d57b7cc33 without taking into account there  
is already a check since b0f7dd915.  
  
Reported-by: Ashutosh Bapat, Alexander Lakhin  
Discussion: https://postgr.es/m/CAExHW5sBZWDjeBUFs_ehEDM%2BuhWxTiBkPbLiat7ZjWkb-DWQWw%40mail.gmail.com  

M src/backend/commands/tablecmds.c

Doc: improve explanation of type interval, especially extract().

commit   : fcd210d496dad7d9f68c9399113368ccf2f009b9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2024 14:35:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2024 14:35:12 -0500    

Click here for diff

The explanation of interval's behavior in datatype.sgml wasn't wrong  
exactly, but it was unclear, partly because it buried the lede about  
there being three internal fields.  Rearrange and wordsmith for more  
clarity.  
  
The discussion of extract() claimed that input of type date was  
handled by casting, but actually there's been a separate SQL function  
taking date for a very long time.  Also, it was mostly silent about  
how interval inputs are handled, but there are several field types  
for which it seems useful to be specific.  
  
Improve discussion of justify_days()/justify_hours() too.  
  
In passing, remove vertical space in some groups of examples,  
as there was little consistency about whether to have such space  
or not.  (I only did this within the datetime functions section;  
there are some related inconsistencies elsewhere.)  
  
Per discussion of bug #18348 from Michael Bondarenko.  There  
may be some code changes coming out of that discussion too,  
but we likely won't back-patch them.  This docs-only patch  
seems useful to back-patch, though I only carried it back to  
v13 because it didn't apply easily in v12.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml

Replace relids in lateral subquery parse tree during SJE

commit   : 489072ab7a9e37987e1d1008a90b0a3644455ecd    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 20 Feb 2024 14:10:10 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 20 Feb 2024 14:10:10 +0200    

Click here for diff

Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/56ee4520-e9d1-d519-54fe-c8bff880ce9b%40gmail.com  
Author: Alexander Korotkov, Andrei Lepikhov  

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

Revert "Improve compression and storage support with inheritance"

commit   : 74563f6b90216180fc13649725179fc119dddeb5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2024 11:10:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2024 11:10:59 +0100    

Click here for diff

This reverts commit 0413a556990ba628a3de8a0b58be020fd9a14ed0.  
  
pg_dump cannot currently dump all the structures that are allowed by  
this patch.  This needs more work in pg_dump and more test coverage.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_type.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/pg_type.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/compression.out
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/compression.sql
M src/test/regress/sql/create_table_like.sql
M src/test/regress/sql/inherit.sql

Minor corrections for partition pruning

commit   : d2ca9a50b5b99ef29aa65b68b5e6ddb253fbb04a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 18:34:21 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 18:34:21 +1300    

Click here for diff

When the partition pruning code finds an OpExpr with an operator that  
does not belong to the partition key's opfamily, the code checks to see  
if the negator of the operator is the opfamily's BTEqualStrategyNumber  
operator so that partition pruning can support that operator and invert  
the matching partitions.  Doing this only works for LIST partitioned  
tables.  
  
Here we fix a minor correctness issue where when we discover we're not  
pruning for a LIST partitioned table, we return PARTCLAUSE_NOMATCH.  
PARTCLAUSE_NOMATCH is only meant to be used when the clause may match  
another partitioned key column.  For this case, the clause is not going  
to be any more useful to another partitioned key as the partition strategy  
is not going to change from one key to the next.  
  
Noticed while working 4c2369ac5.  No backpatch because returning  
PARTCLAUSE_NOMATCH instead of PARTCLAUSE_UNSUPPORTED mostly just causes  
wasted effort checking subsequent partition keys against a clause that  
will never be used for pruning.  
  
In passing, correct a comment for get_matching_range_bounds() which  
mentions that an 'opstrategy' of 0 is supported.  It's not, so fix the  
comment.  This was pointed out by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/CAApHDvqriy8mPOFJ_Bd66YGXJ4+XULpv-4YdB+ePdCQFztyisA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c

Fix race leading to incorrect conflict cause in InvalidatePossiblyObsoleteSlot()

commit   : 818fefd8fd4412d45eb542155cb2833a2b864acc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 13:43:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 13:43:51 +0900    

Click here for diff

The invalidation of an active slot is done in two steps:  
- Termination of the backend holding it, if any.  
- Report that the slot is obsolete, with a conflict cause depending on  
the slot's data.  
  
This can be racy because between these two steps the slot mutex would be  
released while doing system calls, which means that the effective_xmin  
and effective_catalog_xmin could advance during that time, detecting a  
conflict cause different than the one originally wanted before the  
process owning a slot is terminated.  
  
Holding the mutex longer is not an option, so this commit changes the  
code to record the LSNs stored in the slot during the termination of the  
process owning the slot.  
  
Bonus thanks to Alexander Lakhin for the various tests and the analysis.  
  
Author: Bertrand Drouvot  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/backend/replication/slot.c

doc: Use system-username instead of system-user

commit   : 01ec4d89b91ed4c0cad57b188b530b9e7980ccb5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 11:59:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 11:59:03 +0900    

Click here for diff

This inconsistency has been introduced in efb6f4a4f9b6.  
  
Reported-by: Julien Rouhaud  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Fix incorrect pruning of NULL partition for boolean IS NOT clauses

commit   : 4c2369ac5d0a108df4d65a2886657efa010d67ca    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 12:49:37 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 12:49:37 +1300    

Click here for diff

Partition pruning wrongly assumed that, for a table partitioned on a  
boolean column, a clause in the form "boolcol IS NOT false" and "boolcol  
IS NOT true" could be inverted to correspondingly become "boolcol IS true"  
and "boolcol IS false".  These are not equivalent as the NOT version  
matches the opposite boolean value *and* NULLs.  This incorrect assumption  
meant that partition pruning pruned away partitions that could contain  
NULL values.  
  
Here we fix this by correctly not pruning partitions which could store  
NULLs.  
  
To be affected by this, the table must be partitioned by a NULLable boolean  
column and queries would have to contain "boolcol IS NOT false" or "boolcol  
IS NOT true".  This could result in queries filtering out NULL values  
with a LIST partitioned table and "ERROR:  invalid strategy number 0"  
for RANGE and HASH partitioned tables.  
  
Reported-by: Alexander Lakhin  
Bug: #18344  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix test race between primary XLOG_RUNNING_XACTS and standby logical slot.

commit   : 0e162810df7657bac24ba4657460a87104523fc6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:28 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:28 -0800    

Click here for diff

Before the previous commit, the test could hang until  
LOG_SNAPSHOT_INTERVAL_MS (15s), until checkpoint_timeout (300s), or  
indefinitely.  An indefinite hang was awfully improbable.  It entailed  
the test reaching checkpoint_timeout before the  
DecodingContextFindStartpoint() of a CREATE SUBSCRIPTION, yet after the  
preceding WAL record.  Back-patch to v16, which introduced the test.  
  
Bertrand Drouvot, reported by Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Bound waits in 035_standby_logical_decoding.pl.

commit   : 4791f87f34bd3a055db34519d6f878afeedd2548    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:07 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:07 -0800    

Click here for diff

One IPC::Run::start() used an IPC::Run::timer() without checking for  
expiration.  The other used no timeout or timer.  Back-patch to v16,  
which introduced the test.  
  
Reviewed by Bertrand Drouvot.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix typo in SECURITY LABEL synopsis.

commit   : 7f2718532401cfcf5ad2d5d6e7feb15a91b6aa03    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2024 14:17:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2024 14:17:11 -0500    

Click here for diff

One case missed its trailing "|".  
  
Reported by Tim Needham.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/security_label.sgml

Get rid of pg_class usage in SJE regression tests

commit   : e1b7fde418f2c0ba4ab0d9fbfa801ef62d96397b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 19 Feb 2024 14:11:50 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 19 Feb 2024 14:11:50 +0200    

Click here for diff

Usage of pg_class led to instability, see the buildfarm failure.  
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2024-02-15%2021%3A58%3A04  
  
Reported-by: Andrei Lepikhov  
Discussion: https://postgr.es/m/[email protected]  

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

ci: Add test coverage of different pg_upgrade modes

commit   : 21a71648d39fe386acf8928ae59f41c6cccb47cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Feb 2024 09:21:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Feb 2024 09:21:49 +0100    

Click here for diff

Run freebsd with --link and macos with --clone, to get some coverage  
of the non-default modes.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M .cirrus.tasks.yml

commit   : f17529b710977c6ae89a1bc141cd1fb587953cc3    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Feb 2024 10:36:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Feb 2024 10:36:05 +0530    

Click here for diff

The test was failing when executed in --link mode and the reason was that  
we were using the old cluster from a previously successful upgrade test.  
Re-arrange the tests so that the successful test case is at the end.  
  
Reported-by: Justin Pryzby, Peter Eisentraut  
Author: Kuroda Hayato  
Reviewed-by: Vignesh C, Amit Kapila  
Discussion: https://postgr.es/m/ZcvZipRoi_kopIpb@pryzbyj2023  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/004_subscription.pl

ecpg: Fix zero-termination of string generated by intoasc()

commit   : e77a1c58e338a1aebf00e3ae82d282f8bd32fe17    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 11:38:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 11:38:18 +0900    

Click here for diff

intoasc(), a wrapper for PGTYPESinterval_to_asc that converts an  
interval to its textual representation, used a plain memcpy() when  
copying its result.  This could miss a zero-termination in the result  
string, leading to an incorrect result.  
  
The routines in informix.c do not provide the length of their result  
buffer, which would allow a replacement of strcpy() to safer strlcpy()  
calls, but this requires an ABI breakage and that cannot happen in  
back-branches.  
  
Author: Oleg Tselebrovskiy  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/test/compat_informix/.gitignore
M src/interfaces/ecpg/test/compat_informix/Makefile
A src/interfaces/ecpg/test/compat_informix/intoasc.pgc
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.c
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout

ecpg: Fix error handling on OOMs when parsing timestamps

commit   : 0a9118ccc0eb2e6a31201b2443a2eb1078e34894    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 09:05:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 09:05:51 +0900    

Click here for diff

pgtypes_alloc() can return NULL when failing an allocation, which is  
something that PGTYPEStimestamp_defmt_asc() has forgotten about when  
translating a timestamp for 'D', 'r', 'R' and 'T' as these require a  
temporary allocation.  
  
This is unlikely going to be a problem in practice, so no backpatch is  
done.  
  
Author: Oleg Tselebrovskiy  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Remove remaining references to timeouts-long

commit   : a6c21887a9f0251fa2331ea3ad0dd20b31c4d11d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 23:58:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 23:58:44 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

M src/test/isolation/Makefile

Use new overflow-safe integer comparison functions.

commit   : 3b42bdb47169c617cb79123c407a19d16458b49a    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 14:05:36 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 14:05:36 -0600    

Click here for diff

Commit 6b80394781 introduced integer comparison functions designed  
to be as efficient as possible while avoiding overflow.  This  
commit makes use of these functions in many of the in-tree qsort()  
comparators to help ensure transitivity.  Many of these comparator  
functions should also see a small performance boost.  
  
Author: Mats Kindahl  
Reviewed-by: Andres Freund, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/walsummary.c
M src/backend/catalog/heap.c
M src/backend/nodes/list.c
M src/backend/nodes/tidbitmap.c
M src/backend/parser/parse_agg.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/syncrep.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/xid.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/psql/crosstabview.c
M src/include/access/gin_private.h

Introduce overflow-safe integer comparison functions.

commit   : 6b80394781c8de17fe7cae6996476088af3c319f    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 13:37:02 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 13:37:02 -0600    

Click here for diff

This commit adds integer comparison functions that are designed to  
be as efficient as possible while avoiding overflow.  A follow-up  
commit will make use of these functions in many of the in-tree  
qsort() comparators.  The new functions are not better in all cases  
(e.g., when the comparator function is inlined), so it is important  
to consider the context before using them.  
  
Author: Mats Kindahl  
Reviewed-by: Tom Lane, Heikki Linnakangas, Andres Freund, Thomas Munro, Andrey Borodin, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M src/include/common/int.h
M src/include/lib/sort_template.h

Pass correct count to WALRead().

commit   : 73f0a1326608ac3a7d390706fdeec59fe4dc42c0    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 11:09:11 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 11:09:11 -0800    

Click here for diff

Previously, some callers requested XLOG_BLCKSZ bytes  
unconditionally. While this did not cause a problem, because the extra  
bytes are ignored, it's confusing and makes it harder to add safety  
checks. Additionally, the comment about zero padding was incorrect.  
  
With this commit, all callers request the number of bytes they  
actually need.  
  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CALj2ACWBRFac2TingD3PE3w2EBHXUHY3=AEEZPJmqhpEOBGExg@mail.gmail.com  

M src/backend/access/transam/xlogutils.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/walsender.c

Add assert to WALReadFromBuffers().

commit   : 9ecbf54075a91ed155cc779fcc1870de0fff5fef    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 10:35:42 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 10:35:42 -0800    

Click here for diff

Per suggestion from Andres.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Replace calls to pg_qsort() with the qsort() macro.

commit   : 5497daf3aa2ae6ec9d5097f25c40627f8c801de8    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 11:37:50 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 11:37:50 -0600    

Click here for diff

Calls to this function might give the impression that pg_qsort()  
is somehow different than qsort(), when in fact there is a qsort()  
macro in port.h that expands all in-tree uses to pg_qsort().  
  
Reviewed-by: Mats Kindahl  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/cache/syscache.c
M src/include/port.h

Add missing check_stack_depth() to some recursive functions

commit   : d57b7cc3338e9d9aa1d7c5da1b25a17c5a72dcce    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 16:02:00 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 16:02:00 +0200    

Click here for diff

Reported-by: Egor Chindyaskin, Alexander Lakhin  
Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/jsonpath_exec.c

Remove timeouts-long.out

commit   : eb49e1bdd90b0f0434c01e6e00dedcd9466b5a6e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 15:57:37 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 15:57:37 +0200    

Click here for diff

bf82f43790 removes timeouts-long.spec, but forgets to remove timeouts-long.out.  
  
Reported-by: Alexander Lakhin  

D src/test/isolation/expected/timeouts-long.out

Improve compression and storage support with inheritance

commit   : 0413a556990ba628a3de8a0b58be020fd9a14ed0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:51:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:51:35 +0100    

Click here for diff

A child table can specify a compression or storage method different  
from its parents.  This was previously an error.  (But this was  
inconsistently enforced because for example the settings could be  
changed later using ALTER TABLE.)  This now also allows an explicit  
override if multiple parents have different compression or storage  
settings, which was previously an error that could not be overridden.  
  
The compression and storage properties remains unchanged in a child  
inheriting from parent(s) after its creation, i.e., when using ALTER  
TABLE ...  INHERIT.  (This is not changed.)  
  
Before this change, the error detail would mention the first pair of  
conflicting parent compression or storage methods.  But with this  
change it waits till the child specification is considered by which  
time we may have encountered many such conflicting pairs.  Hence the  
error detail after this change does not include the conflicting  
compression/storage methods.  Those can be obtained from parent  
definitions if necessary.  The code to maintain list of all  
conflicting methods or even the first conflicting pair does not seem  
worth the convenience it offers.  This change is inline with what we  
do with conflicting default values.  
  
Before this commit, the specified storage method could be stored in  
ColumnDef::storage (CREATE TABLE ... LIKE) or ColumnDef::storage_name  
(CREATE TABLE ...).  This caused the MergeChildAttribute() and  
MergeInheritedAttribute() to ignore a storage method specified in the  
child definition since it looked only at ColumnDef::storage.  This  
commit removes ColumnDef::storage and instead uses  
ColumnDef::storage_name to save any storage method specification. This  
is similar to how compression method specification is handled.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_type.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/pg_type.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/compression.out
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/compression.sql
M src/test/regress/sql/create_table_like.sql
M src/test/regress/sql/inherit.sql

Remove non-existing file from .gitattributes

commit   : e85732dac0e9933cf1ec4f9df1d8ed9c221c17da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:39:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:39:09 +0100    

Click here for diff

The file was removed by ac25173cdbc.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQQGzbroAXi%2BYicp3HvcCo4%3Dg84kaOgjuvQ5MW9F0ubOGg%40mail.gmail.com  

M .gitattributes

Disable autovacuum on primary in 040_standby_failover_slots_sync test.

commit   : b7bdade6a42f49021d41955d6534f334e827775c    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 14:42:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 14:42:50 +0530    

Click here for diff

Disable autovacuum to avoid generating xid during stats update as  
otherwise the new XID could then be replicated to standby at some random  
point making slots at primary lag behind standby during slot sync.  
  
As per buildfarm  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAA4eK1Jun8SGCoc6JEktxY_+L7GmoJWrdsx-KCEP=GL-SsWggQ@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Fix the incorrect format specifier used in commit 7a424ece48.

commit   : b987be39c3c790821e462a64151b890dd3bcdd98    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 11:34:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 11:34:11 +0530    

Click here for diff

Author: Hou Zhijie  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB5716CB015BAD807B29BC55BE944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Change the LOG level in 040_standby_failover_slots_sync.pl to DEBUG2.

commit   : d9e225f275b7d27e6d2b196f5c528f9ad8a39abf    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 10:13:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 10:13:51 +0530    

Click here for diff

Temporarily change the log level of 040_standby_failover_slots_sync.pl to  
DEBUG2. This is to get more information about BF failures. We will reset  
it back to default once the tests are stabilized.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB571633C23B2A4CAC5FB0371A944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Add more LOG and DEBUG messages for slot synchronization.

commit   : 7a424ece4828fa107f36e1c77985eabdbe69e50b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 09:02:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 09:02:54 +0530    

Click here for diff

This provides more information about remote slots during synchronization  
which helps in debugging bugs and BF failures due to test case issues. We  
might later want to change the LOG message added by this patch to DEBUG1.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB571633C23B2A4CAC5FB0371A944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Attempt to stabilize flapping regression test

commit   : 1fe66680c09b6cc1ed20236c84f0913a7b786bbc    
  
author   : David Rowley <[email protected]>    
date     : Fri, 16 Feb 2024 15:01:29 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 16 Feb 2024 15:01:29 +1300    

Click here for diff

Per buildfarm animal mylodon, the plan for this test was sometimes  
swapping the join order for tenk1 and tenk2.  Given that add_path() has  
no code that would cause this fluctuation when given paths with consistent  
costs, this indicates that the costs must be fluctuating in some runs.  
The only proven reason I've seen where that could happen was slight  
variations in pg_class.relpages for some tables.  This was demonstrated to  
be true by f03a9ca43 and related discussion.  Manually adjusting tenk2's  
pg_class.relpages by subtracting just 1 page does cause the plan to change  
for this test.  
  
Here we've not gone to the same lengths to prove that's what's going on  
in this case.  Proving that does not seem worth the time.  Let's just  
shrink one side of the join so the additional cost of the swapped join  
order is sufficiently different that if the relpages estimate is off a few  
pages that the planner still shouldn't swap the join order.  
  
Reported-by: Thomas Munro  
Author: Andy Fan, David Rowley  
Discussion: https://postgr.es/m/CA+hUKGLqC-NobKYfjxNM3Gexv9OJ-Fhvy9bugUcXsZjTqH7W=Q@mail.gmail.com  

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

Followup fixes for transaction_timeout

commit   : bf82f43790a675dd1b9522a7799357e61e7aa635    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 03:36:38 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 03:36:38 +0200    

Click here for diff

Don't deal with transaction timeout in PostgresMain().  Instead, release  
transaction timeout activated by StartTransaction() in  
CommitTransaction()/AbortTransaction()/PrepareTransaction().  Deal with both  
enabling and disabling transaction timeout in assign_transaction_timeout().  
  
Also, remove potentially flaky timeouts-long isolation test, which has no  
guarantees to pass on slow/busy machines.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20240215230856.pc6k57tqxt7fhldm%40awork3.anarazel.de  

M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/timeouts-long.spec

Introduce transaction_timeout

commit   : 51efe38cb92f4b15b68811bcce9ab878fbc71ea5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 23:34:11 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 23:34:11 +0200    

Click here for diff

This commit adds timeout that is expected to be used as a prevention  
of long-running queries. Any session within the transaction will be  
terminated after spanning longer than this timeout.  
  
However, this timeout is not applied to prepared transactions.  
Only transactions with user connections are affected.  
  
Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com  
Author: Andrey Borodin <[email protected]>  
Author: Japin Li <[email protected]>  
Author: Junwang Zhao <[email protected]>  
Reviewed-by: Nikolay Samokhvalov <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: bt23nguyent <[email protected]>  
Reviewed-by: Yuhang Qiu <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/errcodes.txt
M src/backend/utils/init/globals.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_source.c
M src/include/miscadmin.h
M src/include/storage/proc.h
M src/include/utils/guc_hooks.h
M src/include/utils/timeout.h
M src/test/isolation/Makefile
A src/test/isolation/expected/timeouts-long.out
M src/test/isolation/expected/timeouts.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/timeouts-long.spec
M src/test/isolation/specs/timeouts.spec

Doc: improve a couple of comments in postgresql.conf.sample.

commit   : 5c9f2f9398b46a283dcdf4366aaeb06eb04aa76a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2024 16:45:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2024 16:45:03 -0500    

Click here for diff

Clarify comments associated with max_parallel_workers and  
related settings.  
  
Per bug #18343 from Christopher Kline.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : 9f133763961e280d8ba692bcad0b061b861e9138    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 12:05:52 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 12:05:52 +0200    

Click here for diff

For ANY-SUBLINK, we adopted a two-stage pull-up approach to handle  
different types of scenarios. In the first stage, the sublink is pulled up  
as a subquery. Because of this, when writing this code, we did not have  
the ability to perform lateral joins, and therefore, we were unable to  
pull up Var with varlevelsup=1. Now that we have the ability to use  
lateral joins, we can eliminate this limitation.  
  
Author: Andy Fan <[email protected]>  
Author: Tom Lane <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
Reviewed-by: Alena Rybakina <[email protected]>  
Reviewed-by: Andrey Lepikhov <[email protected]>  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/subselect.sql

Allow passing extra options to initdb for tests

commit   : 995d400ceca3e552f84fe19f150fb03327bdc0c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Feb 2024 09:52:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Feb 2024 09:52:08 +0100    

Click here for diff

Setting the environment variable PG_TEST_INITDB_EXTRA_OPTS passes  
extra options to initdb run by pg_regress or  
PostgreSQL::Test::Cluster's init.  
  
This can be useful for a wide variety of uses, like running all tests  
with checksums enabled, or with JIT enabled, or with different GUC  
settings, or with different locale settings.  (Not all tests are going  
to pass with arbitrary options, but it is useful to run this against  
specific test suites.)  
  
Reviewed-by: Ian Lawrence Barwick <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d4d2ad9f-1c1d-47a1-bb4d-c10a747d4f15%40eisentraut.org  

M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/pg_regress.c

Another try to fix BF failure introduced in commit ddd5f4f54a.

commit   : 9bc1eee988c31e66a27e007d41020664df490214    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 15 Feb 2024 10:37:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 15 Feb 2024 10:37:28 +0530    

Click here for diff

Before attempting to sync the slot on standby by  
pg_sync_replication_slots(), ensure that on the primary restart_lsn for  
the slot has moved to a recent WAL position, by re-creating the  
subscription and the logical slot.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/CAA4eK1+d5Lne8vCAn0un4SP9x-ZBr2-xfxg01uSfeBTSCKFZoQ@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Simplify PathKey checking code

commit   : 0c444a70f2a79d4d7ef6f1af057909839e5b2097    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 18:01:28 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 18:01:28 +1300    

Click here for diff

pathkeys_useful_for_ordering() contained some needless checks to return  
0 when either root->query_pathkeys or pathkeys lists were empty.  This is  
already handled by pathkeys_count_contained_in(), so let's have it do the  
work instead of having redundant checks.  
  
Similarly, in pathkeys_useful_for_grouping(), checking pathkeys is an  
empty list just before looping over it isn't required.  Technically,  
neither is the list empty check for group_pathkeys, but I felt a bit  
more work would have to be done to get the equivalent behavior if we'd  
left it up to the foreach loop to call list_member_ptr().  
  
This was noticed by Andy while he was reviewing a patch to improve the  
UNION planner.  Since that patch adds another function similar to  
pathkeys_useful_for_ordering() and since I wasn't planning to copy these  
redundant checks over to the new function, let's adjust the existing  
code so that both functions will be consistent.  
  
Author: Andy Fan  
Discussion: https://postgr.es/m/[email protected]  

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

Clarify the 'rows' parameter in create_append_path

commit   : 87027cb55bf7b33416880f7f5f5e67f4202d5881    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 13:13:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 13:13:31 +1300    

Click here for diff

This is extracted from a larger patch to improve the UNION planner.  
While working on that, I found myself having to check what the 'rows'  
parameter is for.  It's not obvious that passing a negative number is the  
way to have the rows estimate calculated and to find that out you need  
to read code in create_append_path() and in cost_append().  
  
Discussion: https://postgr.es/m/CAApHDvpb_63XQodmxKUF8vb9M7CxyUyT4sWvEgqeQU-GB7QFoQ@mail.gmail.com  

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

Remove obsolete check in SIGTERM handler for the startup process.

commit   : 8fd0498de2005b4136aaf6fcd056ca4b18e37724    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 17:09:31 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 17:09:31 -0600    

Click here for diff

Thanks to commit 3b00fdba9f, this check in the SIGTERM handler for  
the startup process is now obsolete and can be removed.  Instead of  
leaving around the dead function write_stderr_signal_safe(), I've  
opted to just remove it for now.  
  
This partially reverts commit 97550c0711.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M src/backend/postmaster/startup.c
M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Centralize logic for restoring errno in signal handlers.

commit   : 28e46325091dfac5c6ab9ea1e047a8d09dbd16e7    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 16:34:18 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 16:34:18 -0600    

Click here for diff

Presently, we rely on each individual signal handler to save the  
initial value of errno and then restore it before returning if  
needed.  This is easily forgotten and, if missed, often goes  
undetected for a long time.  
  
In commit 3b00fdba9f, we introduced a wrapper signal handler  
function that checks whether MyProcPid matches getpid().  This  
commit moves the aforementioned errno restoration code from the  
individual signal handlers to the new wrapper handler so that we no  
longer need to worry about missing it.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M doc/src/sgml/sources.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/timeout.c
M src/fe_utils/cancel.c
M src/port/pqsignal.c

Check that MyProcPid == getpid() in backend signal handlers.

commit   : 3b00fdba9f20b641d5d3c2b781cd435b23540e61    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 14:52:14 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 14:52:14 -0600    

Click here for diff

In commit 97550c0711, we added a similar check to the SIGTERM  
handler for the startup process.  This commit adds this check to  
backend signal handlers installed with pqsignal().  This is done by  
using a wrapper function that performs the check before calling the  
actual handler.  
  
The hope is that this will offer more general protection against  
child processes of Postgres backends inadvertently modifying shared  
memory due to inherited signal handlers.  Another potential  
follow-up improvement is to use this wrapper handler function to  
restore errno instead of relying on each individual handler  
function to do so.  
  
This commit makes the changes in commit 97550c0711 obsolete but  
leaves reverting it for a follow-up commit.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M src/port/pqsignal.c

Allow pg_monitor to execute pg_current_logfile().

commit   : 8d8afd48d3f298bc4d8ab2b115cc39550132bde7    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 11:48:29 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 11:48:29 -0600    

Click here for diff

We allow roles with privileges of pg_monitor to execute functions  
like pg_ls_logdir(), so it seems natural that such roles would also  
be able to execute this function.  
  
Bumps catversion.  
  
Co-authored-by: Pavlo Golub  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAK7ymcLmEYWyQkiCZ64WC-HCzXAB0omM%3DYpj9B3rXe8vUAFMqw%40mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Fix multiranges to behave more like dependent types.

commit   : 3e8235ba4f9cc3375b061fb5d3f3575434539b5f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2024 11:30:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2024 11:30:39 -0500    

Click here for diff

For most purposes, multiranges act like dependent objects of the  
associated range type: you can't create them separately or drop them  
separately.  This is like the way that autogenerated array types  
behave.  However, a couple of points were overlooked: array types  
automatically track the ownership of their base type, and array types  
do not have their own permissions but use those of the base type,  
while multiranges didn't emulate those behaviors.  This is fairly  
broken, mainly because pg_dump doesn't think it needs to worry about  
multiranges as separate objects, and thus it fails to dump/restore  
ownership or permissions of multiranges.  
  
There's no apparent value in letting a multirange diverge from  
its parent's ownership or permissions, so let's make them act like  
arrays in these respects.  However, we continue to let multiranges  
be renamed or moved to a different schema independently of their  
parent, since that doesn't break anything.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_type.c
M src/backend/commands/typecmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/dependency.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

Fix BF introduced in commit ddd5f4f54a.

commit   : bd8fc1677b88ed80e4e00e0e46401ec537952482    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 16:16:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 16:16:08 +0530    

Click here for diff

The failure is that the remote slot is not synchronized after the same  
slot on standby gets invalidated. The reason was that remote_slot's  
restart_lsn was lagged behind the standby's oldest WAL segment. The test  
didn't ensure that remote_slot's LSN was advanced to the latest position  
before we tried to sync the slots via new the function  
pg_sync_replication_slots().  
  
Discussion: https://postgr.es/m/CAA4eK1JLBi3HzenB6do3_hd78kN0UDD1mz-vumWE52XHHEq5Bw@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

commit   : b8f9e7772595bf8527ded33884d5ed9f16e0653d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Feb 2024 11:05:10 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Feb 2024 11:05:10 +0100    

Click here for diff

The pgcrypto docs contained a set of links for useful reading and  
technical references. These sets of links were however not actively  
curated and had stale content and dead links. Rather than investing  
time into maintining these, this removes them altogether since there  
are lots of resources online which are actively maintained.  
  
Backpatch to all supported versions since these links have been in  
the docs for a long time.  
  
Reported-by: Hanefi Onaldi <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/pgcrypto.sgml

Add a slot synchronization function.

commit   : ddd5f4f54a026db6a6692876d0d44aef902ab686    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 09:45:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 09:45:36 +0530    

Click here for diff

This commit introduces a new SQL function pg_sync_replication_slots()  
which is used to synchronize the logical replication slots from the  
primary server to the physical standby so that logical replication can be  
resumed after a failover or planned switchover.  
  
A new 'synced' flag is introduced in pg_replication_slots view, indicating  
whether the slot has been synchronized from the primary server. On a  
standby, synced slots cannot be dropped or consumed, and any attempt to  
perform logical decoding on them will result in an error.  
  
The logical replication slots on the primary can be synchronized to the  
hot standby by using the 'failover' parameter of  
pg-create-logical-replication-slot(), or by using the 'failover' option of  
CREATE SUBSCRIPTION during slot creation, and then calling  
pg_sync_replication_slots() on standby. For the synchronization to work,  
it is mandatory to have a physical replication slot between the primary  
and the standby aka 'primary_slot_name' should be configured on the  
standby, and 'hot_standby_feedback' must be enabled on the standby. It is  
also necessary to specify a valid 'dbname' in the 'primary_conninfo'.  
  
If a logical slot is invalidated on the primary, then that slot on the  
standby is also invalidated.  
  
If a logical slot on the primary is valid but is invalidated on the  
standby, then that slot is dropped but will be recreated on the standby in  
the next pg_sync_replication_slots() call provided the slot still exists  
on the primary server. It is okay to recreate such slots as long as these  
are not consumable on standby (which is the case currently). This  
situation may occur due to the following reasons:  
- The 'max_slot_wal_keep_size' on the standby is insufficient to retain  
WAL records from the restart_lsn of the slot.  
- 'primary_slot_name' is temporarily reset to null and the physical slot  
is removed.  
  
The slot synchronization status on the standby can be monitored using the  
'synced' column of pg_replication_slots view.  
  
A functionality to automatically synchronize slots by a background worker  
and allow logical walsenders to wait for the physical will be done in  
subsequent commits.  
  
Author: Hou Zhijie, Shveta Malik, Ajin Cherian based on an earlier version by Peter Eisentraut  
Reviewed-by: Masahiko Sawada, Bertrand Drouvot, Peter Smith, Dilip Kumar, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/permissions.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/permissions.sql
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/meson.build
A src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
A src/include/replication/slotsync.h
M src/include/replication/walsender.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Revert "Refactor CopyReadAttributes{CSV,Text}() to use a callback in COPY FROM"

commit   : 06bd311bce24083c76d9741ae89c98750aaf4b41    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 10:07:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 10:07:22 +0900    

Click here for diff

This reverts commit 95fb5b49024, for reasons similar to what led to  
1aa8324b81fa.  In this case, the callback was called once per row, which  
is less worse than the previous callback introduced for COPY TO called  
once per argument for each row, still the patch set discussed to plug in  
custom routines to the COPY paths would be able to know which subroutine  
to use depending on its CopyFromState, so this led to a suboptimal  
approach at the end.  
  
For now, this part is reverted to consider better which approach to use.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copyfrom_internal.h

pgcrypto: Fix incorrect argument vs PG_GETARG*() mappings

commit   : d0071f922808981e2371351c46da5bb3c49554b2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 08:59:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 08:59:05 +0900    

Click here for diff

The following functions use a mix of bytea and text arguments, but their  
C internals always used PG_GETARG_BYTEA_PP(), creating an incorrect mix  
with the argument types expected by encrypt_internal():  
- pgp_sym_encrypt_bytea(bytea,text[,text])  
- pgp_sym_encrypt(text,text[,text])  
- pgp_sym_decrypt_bytea(bytea,text[,text])  
- pgp_sym_decrypt(bytea,text[,text])  
- pgp_pub_encrypt_bytea(bytea,bytea[,text])  
- pgp_pub_encrypt(text,bytea[,text])  
- pgp_pub_decrypt_bytea(bytea, bytea[,text[,text]])  
- pgp_pub_decrypt(bytea,bytea[,text[,text]])  
  
This commit fixes the inconsistencies between the PG_GETARG*() macros  
and the argument types of each function.  
  
Both BYTEA_PP() and TEXT_PP() rely on PG_DETOAST_DATUM_PACKED(), that  
returns an unaligned pointer, so this was not leading to an actual  
problem as far as I know, but let's be consistent.  
  
Author: Shihao Zhong  
Discussion: https://postgr.es/m/CAGRkXqRfiWT--DzVPx_UGpNHTt0YT5Jo8eV2CtT56jNP=QpXSQ@mail.gmail.com  

M contrib/pgcrypto/pgp-pgsql.c

Improve comment about query_id_enabled in queryjumblefuncs.c

commit   : f854dae888ab69db92153369644951dfb5b3d034    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 07:20:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 07:20:15 +0900    

Click here for diff

The comment was inexact because query_id_enabled will not be switched to  
"true" even if compute_query_id is "on", unless a module requests for  
it.  
  
While on it, this adds a comment to mention that IsQueryIdEnabled()  
should be used to check if query ID computation is enabled or not.  
  
Author: Yugo Nagata  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/queryjumblefuncs.c

Catch overflow when rounding intervals in AdjustIntervalForTypmod.

commit   : 5ebc9c90173f32cffe373a80835f157b9ebfa3bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 15:58:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 15:58:40 -0500    

Click here for diff

Previously, an interval microseconds field close to INT64_MAX or  
INT64_MIN could overflow, producing a result with not even the  
correct sign, while being rounded to match a precision specification.  
  
This seems worth fixing, but not worth back-patching, in part  
because the ereturn() notation doesn't exist very far back.  
  
Report and patch by Joseph Koshakow (some cosmetic mods by me)  
  
Discussion: https://postgr.es/m/CAAvxfHfpuLgqJYzkUcher466Z1LpmE+5Sm+zc8L6zKCOQ+6TDQ@mail.gmail.com  

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

Fix 'mmap' DSM implementation with allocations larger than 4 GB

commit   : fbf9a7ac4d300bbadbffe11c58cb54fcbe15601f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Feb 2024 21:23:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Feb 2024 21:23:41 +0200    

Click here for diff

Fixes bug #18341. Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Use a safer outfuncs/readfuncs representation for BitStrings.

commit   : 0736a8ef6f0e108e3972750a58a4e42ba070b029    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 12:18:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 12:18:25 -0500    

Click here for diff

For a long time, our outfuncs.c code has supposed that the string  
contents of a BitString node could just be printed literally with  
no concern for quoting/escaping.  Now, that's okay if the string  
literal contains only valid binary or hex digits ... but our lexer  
doesn't check that, preferring to let bitin() be the sole authority  
on what's valid.  So we could have raw parse trees that contain  
incorrect BitString literals, and that can result in failures when  
WRITE_READ_PARSE_PLAN_TREES debugging is enabled.  
  
Fix by using outToken() to print the string field, and debackslash()  
to read it.  This results in a change in the emitted representation  
only in cases that would have failed before, and don't represent valid  
SQL in the first place.  Between that and the fact that we don't store  
raw parse trees in the catalogs, I judge this safe to apply without a  
catversion bump.  
  
Per bug #18340 from Alexander Lakhin.  Back-patch to v16; before that,  
we lacked readfuncs support for BitString nodes, so that the problem  
was only cosmetic.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/test/regress/expected/bit.out
M src/test/regress/sql/bit.sql

Skip .DS_Store files in server side utils

commit   : c1fc502f595bc843a603bddd267b249272de485f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 13 Feb 2024 13:47:12 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 13 Feb 2024 13:47:12 +0100    

Click here for diff

The macOS Finder application creates .DS_Store files in directories  
when opened,  which creates problems for serverside utilities which  
expect all files to be PostgreSQL specific files.  Skip these files  
when encountered in pg_checksums, pg_rewind and pg_basebackup.  
  
This was extracted from a larger patchset for skipping hidden files  
and system files, where the concencus was to just skip these. Since  
this is equally likely to happen in every version, backpatch to all  
supported versions.  
  
Reported-by: Mark Guertin <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Tobias Bussmann <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M src/backend/backup/basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/003_extrafiles.pl

Use correct format placeholder for timeline IDs

commit   : e4b88c5fa343ba03e299aa643f0c44120793ddfd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2024 06:54:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2024 06:54:58 +0100    

Click here for diff

Should be %u rather than %d.  

M src/backend/postmaster/walsummarizer.c

Doc: Improve upgrade for streaming replication section.

commit   : 703c7a3c54547bfee84bdab77cf435a2becfb1dd    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 13 Feb 2024 09:45:01 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 13 Feb 2024 09:45:01 +0530    

Click here for diff

Currently the documentation of upgrade for streaming replication section  
says that logical replication slots will be copied, but the logical  
replication slots are copied only if the old primary is version 17.0 or  
later.  
  
Author: Shubham Khanna  
Discussion: https://postgr.es/m/CAHv8RjJHCw0jpUo9PZxjcguzGt3j2W1_NH=QuREoN0nYiVdVeA@mail.gmail.com  

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

Read WAL directly from WAL buffers.

commit   : 91f2cae7a4e664e9c0472b364c7db29d755ab151    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 12 Feb 2024 10:36:18 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 12 Feb 2024 10:36:18 -0800    

Click here for diff

If available, read directly from WAL buffers, avoiding the need to go  
through the filesystem. Only for physical replication for now, but can  
be expanded to other callers.  
  
In preparation for replicating unflushed WAL data.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXKKK%3DwbiG5_t6dGao5GoecMwRkhr7GjVBM_jg54%2BNa%3DQ%40mail.gmail.com  
Reviewed-by: Andres Freund, Alvaro Herrera, Nathan Bossart, Dilip Kumar, Nitin Jadhav, Melih Mutlu, Kyotaro Horiguchi  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h

Remove "#ifdef WIN32" guards from src/port/win32*.c

commit   : 09eb633e1baa3b7cd7929f3cc77f9c46f63c20b1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 11:57:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 11:57:45 +0200    

Click here for diff

These files are only compiled on Windows, and most of them didn't have  
"#ifdef WIN32" guards. Remove them from the few that did, for  
consistency.  
  
Author: Tristan Partin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/port/win32common.c
M src/port/win32fseek.c
M src/port/win32stat.c

Remove unnecessary smgropen() calls

commit   : 9f35e42e7d59fb8716020a42c7b586f0d70a5101    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 10:59:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 10:59:45 +0200    

Click here for diff

Now that RelationCreateStorage() returns the SmgrRelation (since  
commit 5c1560606dc), use that.  
  
Author: Japin Li  
Discussion: https://www.postgresql.org/message-id/ME3P282MB316600FA62F6605477F26F6AB6742@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/tablecmds.c

Fix some typos in event trigger docs

commit   : 5fce30e77fe133e1404167c13caaf7e0d1369295    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:51 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:51 +0200    

Click here for diff

Discussion: https://postgr.es/m/CALj2ACWFUW4jX9EW7CLxbzSS%2Bb7b0Z%3DxKYrqzj2Rstc9MCEx7g%40mail.gmail.com  
Author: Bharath Rupireddy  

M doc/src/sgml/event-trigger.sgml

Use heap_inplace_update() to unset pg_database.dathasloginevt

commit   : 8be93177c46b0f6a29a7376229b7ee002066d5f8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:44 +0200    

Click here for diff

Doing this instead of regular updates serves two purposes. First, that avoids  
possible waiting on the row-level lock.  Second, that avoids dealing with  
TOAST.  
  
It's known that changes made by heap_inplace_update() may be lost due to  
concurrent normal updates.  However, we are OK with that.  The subsequent  
connections will still have a chance to set "dathasloginevt" to false.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/e2a0248e-5f32-af0c-9832-a90d303c2c61%40gmail.com  

M src/backend/commands/event_trigger.c

commit   : 428e2de1b895079bbf50a128f8b3824679f4bb65    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 23:42:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 23:42:40 +0100    

Click here for diff

D src/tools/ci/windows_build_config.pl

Fix gai_strerror() thread-safety on Windows.

commit   : 65f438471b769f6b9706a386028f81df065d0a25    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 12 Feb 2024 10:47:57 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 12 Feb 2024 10:47:57 +1300    

Click here for diff

Commit 5579388d removed code that supplied a fallback implementation of  
getaddrinfo(), which was dead code on modern systems.  One tiny piece of  
the removed code was still doing something useful on Windows, though:  
that OS's own gai_strerror()/gai_strerrorA() function returns a pointer  
to a static buffer that it overwrites each time, so it's not  
thread-safe.  In rare circumstances, a multi-threaded client program  
could get an incorrect or corrupted error message.  
  
Restore the replacement gai_strerror() function, though now that it's  
only for Windows we can put it into a win32-specific file and cut it  
down to the errors that Windows documents.  The error messages here are  
taken from FreeBSD, because Windows' own messages seemed too verbose.  
  
Back-patch to 16.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKz%2BF9d2PTiXwfYV7qJw%2BWg2jzACgSDgPizUw7UG%3Di58A%40mail.gmail.com  

M configure
M configure.ac
M src/include/port/win32/sys/socket.h
M src/port/meson.build
A src/port/win32gai_strerror.c

Use extensible buffers to assemble command lines

commit   : e70abd67c3e6155fe8e853c4e29255578d9cf48d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 09:08:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 09:08:35 +0100    

Click here for diff

This makes use of StringInfo to assemble command lines, instead of  
using fixed-size buffers and the (remote) possibility of "command too  
long" errors.  Also makes the code a bit simpler.  
  
This covers the test driver programs pg_regress and  
pg_isolation_regress.  
  
Similar to the changes done for pg_rewind in a33e17f210.  
  
Discussion: https://www.postgresql.org/message-id/2be4fee5-738f-4749-b9f8-b452032c7ade%40eisentraut.org  

M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress_main.c

Disallow jsonpath methods involving TZ in immutable functions

commit   : 469745468668917434dbef48eddad4f961880b3d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 10 Feb 2024 12:12:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 10 Feb 2024 12:12:39 -0500    

Click here for diff

Timezones are not immutable and so neither is any function that relies on  
them. In commit 66ea94e8, we introduced a few methods which do casting  
from one time to another and thus may involve the current timezone.  To  
preserve the immutability of jsonpath functions currently marked  
immutable, disallow these methods from being called from non-TZ aware  
functions.  
  
Jeevan Chalke, per a report from Jian He.  

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

Remove race condition in pg_get_expr().

commit   : ce571434ae7027462565706236a0c6fbdf603734    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 12:29:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 12:29:41 -0500    

Click here for diff

Since its introduction, pg_get_expr() has intended to silently  
return NULL if called with an invalid relation OID, as can happen  
when scanning the catalogs concurrently with relation drops.  
However, there is a race condition: we check validity of the OID  
at the start, but it could get dropped just afterward, leading to  
failures.  This is the cause of some intermittent instability we're  
seeing in a proposed new test case, and presumably it's a hazard in  
the field as well.  
  
We can fix this by AccessShareLock-ing the target relation for the  
duration of pg_get_expr().  Since we don't require any permissions  
on the target relation, this is semantically a bit undesirable.  But  
it turns out that the set_relation_column_names() subroutine already  
takes a transient AccessShareLock on that relation, and has done since  
commit 2ffa740be in 2012.  Given the lack of complaints about that, it  
seems like there should be no harm in holding the lock a bit longer.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid concurrent calls to bindtextdomain().

commit   : a584d03ced5fe302256160b4d8961d4ea9b3cc52    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:21:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:21:08 -0500    

Click here for diff

We previously supposed that it was okay for different threads to  
call bindtextdomain() concurrently (cf. commit 1f655fdc3).  
It now emerges that there's at least one gettext implementation  
in which that triggers an abort() crash, so let's stop doing that.  
Add mutexes guarding libpq's and ecpglib's calls, which are the  
only ones that need worry about multithreaded callers.  
  
Note: in libpq, we could perhaps have piggybacked on  
default_threadlock() to avoid defining a new mutex variable.  
I judge that not terribly safe though, since libpq_gettext could  
be called from code that is holding the default mutex.  If that  
were the first such call in the process, it'd fail.  An extra  
mutex is cheap insurance against unforeseen interactions.  
  
Per bug #18312 from Christian Maurer.  Back-patch to all  
supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up Windows-specific mutex code in libpq and ecpglib.

commit   : 0028b55bc8e2fc80816094620d116e2cbbd8e5f3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:11:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:11:39 -0500    

Click here for diff

Fix pthread-win32.h and pthread-win32.c to provide a more complete  
emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER  
and make sure that pthread_mutex_lock() can operate on a mutex  
object that's been initialized that way.  Then we don't need the  
duplicative platform-specific logic in default_threadlock() and  
pgtls_init(), which we'd otherwise need yet a third copy of for  
an upcoming bug fix.  
  
Also, since default_threadlock() supposes that pthread_mutex_lock()  
cannot fail, try to ensure that that's actually true, by getting  
rid of the malloc call that was formerly involved in initializing  
an emulated mutex.  We can define an extra state for the spinlock  
field instead.  
  
Also, replace the similar code in ecpglib/misc.c with this version.  
While ecpglib's version at least had a POSIX-compliant API, it  
also had the potential of failing during mutex init (but here,  
because of CreateMutex failure rather than malloc failure).  Since  
all of misc.c's callers ignore failures, it seems like a wise idea  
to avoid failures here too.  
  
A further improvement in this area could be to unify libpq's and  
ecpglib's implementations into a src/port/pthread-win32.c file.  
But that doesn't seem like a bug fix, so I'll desist for now.  
  
In preparation for the aforementioned bug fix, back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg-pthread-win32.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/pthread-win32.c
M src/port/pthread-win32.h

Refactor pipe_read_line to return the full line

commit   : 5c7038d70bb9c4d28a80b0a2051f73fafab5af3f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 9 Feb 2024 15:03:16 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 9 Feb 2024 15:03:16 +0100    

Click here for diff

Commit 5b2f4afffe6 refactored find_other_exec() and in the process  
created pipe_read_line() into a static routine for reading a single  
line of output, aimed at reading version numbers.  Commit a7e8ece41  
later exposed it externally in order to read a postgresql.conf GUC  
using "postgres -C ..".  Further, f06b1c598 also made use of it for  
reading a version string much like find_other_exec().  The internal  
variable remained "pgver", even when used for other purposes.  
  
Since the function requires passing a buffer and its size, and at  
most size - 1 bytes will be read via fgets(), there is a truncation  
risk when using this for reading GUCs (like how pg_rewind does,  
though the risk in this case is marginal).  
  
To keep this as generic functionality for reading a line from a pipe,  
this refactors pipe_read_line() into returning an allocated buffer  
containing all of the line to remove the risk of silent truncation.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/exec.c
M src/common/exec.c
M src/include/port.h

Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkeys()

commit   : c01f6ef46c8f0ab3faa54e8f040da6e9ddc7fe5b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 9 Feb 2024 12:56:26 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 9 Feb 2024 12:56:26 +0200    

Click here for diff

group_keys_reorder_by_pathkeys() function searched for matching pathkeys  
within root->group_pathkeys.  That could lead to picking an aggregate pathkey  
and using its pathkey->pk_eclass->ec_sortref as an argument of  
get_sortgroupref_clause_noerr().  Given that ec_sortref of an aggregate pathkey  
references aggregate targetlist not query targetlist, this leads to incorrect  
query optimization.  
  
Fix this by looking for matching pathkeys only within the first  
num_groupby_pathkeys pathkeys.  
  
Reported-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwY3Ek%3DcLThgd8FdaSc5JRDVt0FaV00gMcWra%2BTAR4gGUw%40mail.gmail.com  
Author: Andrei Lepikhov, Alexander Korotkov  

M src/backend/optimizer/path/pathkeys.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Fix propagation of persistence to sequences in ALTER TABLE / ADD COLUMN

commit   : 6743c5ae64e3c957ef8bd4f8a0daa2ba9959b0b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Feb 2024 07:57:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Feb 2024 07:57:31 +0100    

Click here for diff

Fix for 344d62fb9a9: That commit introduced unlogged sequences and  
made it so that identity/serial sequences automatically get the  
persistence level of their owning table.  But this works only for  
CREATE TABLE and not for ALTER TABLE / ADD COLUMN.  The latter would  
always create the sequence as logged (default), independent of the  
persistence setting of the table.  This is fixed here.  
  
Note: It is allowed to change the persistence of identity sequences  
directly using ALTER SEQUENCE.  So mistakes in existing databases can  
be fixed manually.  
  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/c4b6e2ed-bcdf-4ea7-965f-e49761094827%40eisentraut.org  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

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

commit   : 3c44746fdb5d5603f6bc4645c78bca6c702fc920    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:06:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:06:32 +0900    

Click here for diff

M .git-blame-ignore-revs

Fix indentation of copyto.c

commit   : 49e7c6f78ed608c5d5454080ae19c0e7f1b09a04    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:05:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:05:01 +0900    

Click here for diff

Issue introduced by b619852086ed.  
  
Per buildfarm member koel.  

M src/backend/commands/copyto.c

Improve COPY TO performance when server and client encodings match

commit   : b619852086ed2b5df76631f5678f60d3bebd3745    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 09:30:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 09:30:53 +0900    

Click here for diff

This commit fixes an oversight introduced in c61a2f58418e, where COPY TO  
would attempt to do encoding conversions even if the encodings of the  
client and the server matched for multi-byte encodings.  All conversions  
go through pg_any_to_server() that makes the conversion a no-op when the  
encodings of the client and the server match, even for multi-byte  
encodings.  
  
The logic was fine, but setting CopyToStateData->need_transcoding would  
cause strlen() to be called for nothing for each attribute of all the  
rows copied, and that was showing high in some profiles (more attributes  
make that easier to reach).  This change improves the runtime of some  
worst-case COPY TO queries by 15%~ (number present at least here).  
  
This is a performance improvement, so no backpatch is done out of  
caution as this is not a regression.  
  
Reported-by: Andres Freund  
Analyzed-by: Andres Freund  
Author: Michael Paquier  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Apply pg_dump test cleanups to test_pg_dump as well

commit   : a89fa007142ea3a02fd26f9ad980e11cae718e60    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 21:19:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 21:19:03 +0100    

Click here for diff

Apply the changes from 41a284411e0 to the test_pg_dump module as well.  
Here, we just apply the new test consistency checks, but we don't need  
to fix any existing tests.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/modules/test_pg_dump/t/001_base.pl

Fix gcc >= 10 warning

commit   : d859fdb36fcdf7cf01fcda0c9ea87865e13ddc1f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 21:59:28 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 21:59:28 +0200    

Click here for diff

Reported-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVQoFXxFm2kCmhHcdM7DjA84_bOjoM8HVAKHbE%2BKrZ1uA%40mail.gmail.com  

M src/backend/commands/dbcommands.c

doc: Remove superfluous bracket in synopsis

commit   : fdfb92c0307c95eba10854196628d88e6708901e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Feb 2024 12:19:34 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Feb 2024 12:19:34 +0100    

Click here for diff

Commit 9c08aea6a30 accidentally added one too many end brackets  
in the synopsis for CREATE DATABASE .. strategy = strat. Fix by  
removing. Backpatch to v15 where it was introduced.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v15  

M doc/src/sgml/ref/create_database.sgml

Fix wrong logic in TransactionIdInRecentPast()

commit   : 165d921c9a883814a35e8161fc692793e9c945a4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 12:45:26 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 12:45:26 +0200    

Click here for diff

The TransactionIdInRecentPast() should return false for all the transactions  
older than TransamVariables->oldestClogXid.  However, the function contains  
a bug in comparison FullTransactionId to TransactionID allowing full  
transactions between nextXid - 2^32 and oldestClogXid - 2^31.  
  
This commit fixes TransactionIdInRecentPast() by turning the oldestClogXid into  
FullTransactionId first, then performing the comparison.  
  
Backpatch to all supported versions.  
  
Reported-by: Egor Chindyaskin  
Bug: 18212  
Discussion: https://postgr.es/m/18212-547307f8adf57262%40postgresql.org  
Author: Karina Litskevich  
Reviewed-by: Kyotaro Horiguchi  
Backpatch-through: 12  

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

Fix documentation build with older docbook-xsl

commit   : 5869aef9a15d5dc0b4de3d63d1ae360a6f34afb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 11:37:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 11:37:11 +0100    

Click here for diff

Commit b0f0a9432d0 backpatched some code from upstream DocBook XSL to  
our customization layer.  It turned out that this failed to work with  
anything but the latest DocBook XSL upstream version (1.79.*), because  
the backpatched code references an XSLT parameter (autolink.index.see)  
that is not defined in earlier versions (because the feature it is  
used for did not exist yet).  
  
There is no way in XSLT to test whether a parameter is declared before  
the stylesheet processor tries and fails to access it.  So the  
possibilities to fix this would be to either remove the code that uses  
the parameter (and thus give up on the feature it is used for) or  
declare the parameter in our customization layer.  The latter seems  
easier, and with a few more lines of code we can backport the entire  
autolink.index.see feature, so let's do that.  (If we didn't, then  
with older stylesheets the parameter will appear as on, but it won't  
actually do anything, because of the way the stylesheets are laid out,  
so it's less confusing to just make it work.)  
  
With this, the documentation build should work again with docbook-xsl  
versions 1.77.*, 1.78.*, and 1.79.* (which already worked before).  
Version 1.76.1 already didn't work before all this, so was not  
considered here.  
  
Reported-by: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Update comment

commit   : 254361cf1aec4570a7022160f20fa505a876ed0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 10:18:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 10:18:50 +0100    

Click here for diff

The documentation output format htmlhelp is no longer supported, but a  
comment still mentioned it.  

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

Fix meson installation of xid_wraparound test.

commit   : 1aa67a5ea6870d42410cc2a3a0f9dcf6bd6bc1f5    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 8 Feb 2024 17:03:59 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 8 Feb 2024 17:03:59 +0900    

Click here for diff

Fix for e255b646a, to prevent installation of xid_wraparound test  
module during main install.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/84cd416a-0e37-4019-8380-1c8a3cdd8c5c%40eisentraut.org  

M src/test/modules/xid_wraparound/meson.build

Fix warnings in cpluspluscheck

commit   : 25799850867292efecf34da73db4ea1ad1aad573    
  
author   : John Naylor <[email protected]>    
date     : Thu, 8 Feb 2024 10:04:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 8 Feb 2024 10:04:57 +0700    

Click here for diff

Various int variables were compared to macros that are of type size_t,  
which caused -Wsign-compare warnings in cpluspluscheck.  Change those  
to size_t, which also better describes their purpose.  
  
Per report from Peter Eisentraut  
  
Discussion: https://postgr.es/m/486847dc-6de5-464a-938e-bac98ec2438b%40eisentraut.org  

M src/include/common/hashfn_unstable.h

Rename static function to avoid conflicting names

commit   : a4012a697e806708172ce23be14c6ffebdf8e460    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 7 Feb 2024 22:16:21 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 7 Feb 2024 22:16:21 +0100    

Click here for diff

Commit a4fd3aa719e moved setup_cancel_handler out of psql and  
exporeted it as a global function.  While pg_dump isn't using  
the header it's exported in,  having a conflicting name still  
risks causing confusion when grepping the code for callsites,  
so rename the static function in pg_dump to avoid this.  
  
Author: Yugo Nagata <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/parallel.c

Remove Start* macros in postmaster.c.

commit   : 1e285a5e137ed033d45c63364d90565a3c013b3f    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 7 Feb 2024 12:50:48 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 7 Feb 2024 12:50:48 -0600    

Click here for diff

These macros are just shorthands for calling StartChildProcess()  
with the appropriate process type, and they arguably make the code  
harder to understand.  
  
Suggested-by: Andres Freund  
Author: Reid Thompson  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/e88934c02a5c66f5e8caab2025f85da6b9026d0b.camel%40crunchydata.com  

M src/backend/postmaster/postmaster.c

Update PQparameterStatus and ParameterStatus docs

commit   : a39f1a365a3b99149ba0038ef7e39d6bff2560c9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Feb 2024 19:25:07 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Feb 2024 19:25:07 +0100    

Click here for diff

Cover scram_iterations, which was added in commit b577743000cd.  While  
at it, turn the list into a <simplelist> with 2 columns, which is much  
nicer to read.  
  
In master, remove mentions of antediluvian versions before which some  
parameters were not reported.  
  
Noticed while investigating a question by Maiquel Grassi.  
  
Backpatch to 16.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml

Adjust reltarget assignment for UPPERREL_PARTIAL_DISTINCT rel

commit   : 902900b308fb38543b95526b1f384bf3cce2f514    
  
author   : David Rowley <[email protected]>    
date     : Wed, 7 Feb 2024 21:22:34 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 7 Feb 2024 21:22:34 +1300    

Click here for diff

A comment in grouping_planner() claimed that the PlannerInfo  
upper_targets array was not used in core code.  However, the code that  
generated the paths for the UPPERREL_PARTIAL_DISTINCT rel made that  
comment untrue.  
  
Here we adjust the create_distinct_paths() function signature to pass  
down the PathTarget the same as is done for create_grouping_paths(),  
thus making the aforementioned comment true again.  
  
In passing adjust the order of the upper_targets[] assignments.  These  
seem to be following the reverse enum order apart from  
UPPERREL_PARTIAL_DISTINCT.  
  
Also, update the header comment for generate_gather_paths() to mention  
the function is also used to create gather paths for partial distinct  
paths.  
  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAMbWs48u9VoVOouJsys1qOaC9WVGVmBa+wT1dx8KvxF5GPzezA@mail.gmail.com  

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

Set LSN for wbuf in _hash_freeovflpage() iff wbuf is modified.

commit   : aa5edbe379d645e980f927b01379bdad9bc6c295    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 11:10:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 11:10:12 +0530    

Click here for diff

Commit 861f86beea used REGBUF_NO_CHANGE at one of the places in the hash  
index to register the clean buffers but forgot to avoid setting LSN in  
that case.  
  
Reported-by: Michael Paquier  
Author: Kuroda Hayato  
Reviewed-by: Amit Kapila, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hashovfl.c

Clean-ups for 776621a5e4 and 7329240437.

commit   : 22f7e61a63306873211e26c7bac9c68631309aef    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 10:04:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 10:04:04 +0530    

Click here for diff

Following are a few clean-ups related to failover option support in slots:  
1. Improve the documentation in create_subscription.sgml.  
2. Remove the spurious blank line in subscriptioncmds.c.  
3. Remove the NOTICE for alter_replication_slot in subscriptioncmds.c as  
we would sometimes print it even when nothing has changed. One can find  
the change by enabling log_replication_commands on the publisher.  
4. Optimize ReplicationSlotAlter() function to prevent disk flushing when  
the slot's data remains unchanged.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB57164904651FB588A518E98894472@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/slot.c

Simplify signature of CopyAttributeOutCSV() in copyto.c

commit   : b9d6038d7048ddb837aa1d286fb8f5ca0e9b3a83    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 12:28:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 12:28:55 +0900    

Click here for diff

This has come up in 2889fd23be56, reverted later on, and is still useful  
on its own to reduce a bit the differences between the code paths  
dedicated to CSV and text.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Revert "Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY TO"

commit   : 1aa8324b81fa4979ffdc6ccf81d560eac9446948    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 08:04:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 08:04:26 +0900    

Click here for diff

This reverts commit 2889fd23be56, following a discussion with Andres  
Freund as this callback, being called once per attribute when sending a  
relation's row, can involve a lot of indirect function calls (more  
attributes to deal with means more impact).  The effects of a dispatch  
at this level would become more visible when improving the per-row code  
execution of COPY TO, impacting future potential performance  
improvements.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Change initial use of pg_atomic_write_u64 to init

commit   : e4b27b53552c19c50b3ca00b697a1f745c247d0d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 12:08:39 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 12:08:39 +0100    

Click here for diff

This only matters when using atomics emulation with semaphores.  
  
Per buildfarm member rorqual.  

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

Use atomic access for SlruShared->latest_page_number

commit   : d172b717c6f436738cc8383a4e9f611ae227fd93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 10:54:10 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 10:54:10 +0100    

Click here for diff

The new concurrency model proposed for slru.c to improve performance  
does not include any single lock that would coordinate processes  
doing concurrent reads/writes on SlruShared->latest_page_number.  
We can instead use atomic reads and writes for that variable.  
  
Author: Dilip Kumar <[email protected]>  
Reviewed-by: Andrey M. Borodin <[email protected]>  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/include/access/slru.h

Further cosmetic review of hashfn_unstable.h

commit   : b83033c3cff556d520281aaec399e47b4f11edbe    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Feb 2024 13:09:03 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Feb 2024 13:09:03 +0700    

Click here for diff

In follow-up to e97b672c8,  
* Flesh out comments explaining the incremental interface  
* Clarify detection of zero bytes when hashing aligned C strings  
  
The latter was suggested and reviewed by Jeff Davis  
  
Discussion: https://postgr.es/m/48e8f8bbe0be9c789f98776c7438244ab7a7cc63.camel%40j-davis.com  

M src/include/common/hashfn_unstable.h

Simplify initialization of incremental hash state

commit   : 9ed3ee5001b6a2d4cb0166eb8f12a457f30aaca4    
  
author   : John Naylor <[email protected]>    
date     : Sun, 21 Jan 2024 19:19:14 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 21 Jan 2024 19:19:14 +0700    

Click here for diff

The standalone functions fasthash{32,64} use length for two purposes:  
how many bytes to hash, and how to perturb the internal seed.  
  
Developers using the incremental interface may not know the length  
ahead of time (e.g. for C strings). In this case, it's advised to  
pass length to the finalizer, but initialization still needed some  
length up front, in the form of a placeholder macro.  
  
Separate the concerns by having the standalone functions perturb the  
internal seed themselves from their own length parameter, allowing  
to remove "len" from fasthash_init(), as well as the placeholder macro.  
  
Discussion: https://postgr.es/m/CANWCAZbTUk2LOyhsFo33gjLyLAHZ7ucXCi5K9u%3D%2BPtnTShDKtw%40mail.gmail.com  

M src/backend/catalog/namespace.c
M src/include/common/hashfn_unstable.h

doc: Spell I/O consistently

commit   : 1f61680327c962d5bafdbf6a04ad9bb0f7232f92    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Feb 2024 13:29:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Feb 2024 13:29:22 +0900    

Click here for diff

The pg_stat_io and pg_stat_copy_progress view docs spelled "I/O" as "IO"  
or even "io" in some places when not referring to literal names or  
string values.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Fix meson installation of new generated files

commit   : 1ae5ace7558ea949d2f94af2fd5eb145d5558659    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Feb 2024 15:45:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Feb 2024 15:45:29 +0100    

Click here for diff

Fix for 9b1a6f50b9: We want to install catalog/syscache_ids.h but not  
catalog/syscache_info.h.  The meson code has this backwards.  The  
makefiles are ok.  
  
Reported-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAJ7c6TMDGmAiozDjJQ3%3DP3cd-1BidC_GpitcAuU0aqq-r1eSoQ%40mail.gmail.com  

M src/include/catalog/meson.build

Fix assertion if index is dropped during REFRESH CONCURRENTLY

commit   : b96115acb8a0e08a46877c2b8ef2a7b5560b371b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:30 +0200    

Click here for diff

When assertions are disabled, the built SQL statement is invalid and  
you get a "syntax error". So this isn't a serious problem, but let's  
avoid the assertion failure.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Noah Misch  

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

Run REFRESH MATERIALIZED VIEW CONCURRENTLY in right security context

commit   : 5a9167c3971211d6fe65ecdd83025625e4af0b8b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:23 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:23 +0200    

Click here for diff

The internal commands in REFRESH MATERIALIZED VIEW CONCURRENTLY are  
correctly executed in SECURITY_RESTRICTED_OPERATION mode, except for  
creating the temporary "diff" table, because you cannot create  
temporary tables in SRO mode. But creating the temporary "diff" table  
is a pretty complex CTAS command that selects from another temporary  
table created earlier in the command. If you can cajole that CTAS  
command to execute code defined by the table owner, the table owner  
can run code with the privileges of the user running the REFRESH  
command.  
  
The proof-of-concept reported to the security team relied on CREATE  
RULE to convert the internally-built temp table to a view. That's not  
possible since commit b23cd185fd, and I was not able to find a  
different way to turn the SELECT on the temp table into code  
execution, so as far as I know this is only exploitable in v15 and  
below. That's a fiddly assumption though, so apply this patch to  
master and all stable versions.  
  
Thanks to Pedro Gallegos for the report.  
  
Security: CVE-2023-5869  
Reviewed-by: Noah Misch  

M src/backend/commands/matview.c

Enhance libpqrcv APIs to support slot synchronization.

commit   : dafbfed9efbe3d166f25df7e564bad716e9f8bfc    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 10:45:34 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 10:45:34 +0530    

Click here for diff

This patch provides support for regular (non-replication) connections in  
libpqrcv_connect(). This can be used to execute SQL statements on the  
primary server without starting a walsender.  
  
A new API libpqrcv_get_dbname_from_conninfo() is also added to extract the  
database name from the given connection-info.  
  
Note that this patch doesn't change any existing functionality but later  
patches implementing the slot synchronization will use this functionality  
to connect to the primary server to fetch required slot information.  
  
Author: Shveta Malik, Hou Zhijie, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Improve the comments in 004_subscription.pl.

commit   : a17aa50d67bad4ee39a94988c679d2c2fed0e934    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 08:51:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 08:51:33 +0530    

Click here for diff

It was not clear whether the subscriptions in the upgraded instance were  
the ones that retained the previous subscription's properties.  
  
Author: Peter Smith  
Reviewed-by: Vignesh C, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHut+Pu1usLPHRySPTacY1K_Q-ddSRXNFhmj_2u1NfqBC1ytng@mail.gmail.com  

M src/bin/pg_upgrade/t/004_subscription.pl

Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY TO

commit   : 2889fd23be565155c8cd96a8c5a07ac971261515    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 11:12:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 11:12:37 +0900    

Click here for diff

These routines are used by the text and CSV formats to send an output  
representation of a string, applying quotes if required.  This is  
similar to 95fb5b49024a, reducing the number of "if" branches that need  
to be checked on a per-row basis when sending representation of fields  
in text or CSV mode.  
  
While on it, this simplifies the signature of CopyAttributeOutCSV() as  
it is possible to know that an attribute is alone on a line thanks to  
CopyToState.  Headers should not use quotes, even if forced at query  
level.  
  
Extracted from a larger patch by the same author.  
  
Author: Sutou Kouhei  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Refactor CopyReadAttributes{CSV,Text}() to use a callback in COPY FROM

commit   : 95fb5b49024aa51310f91aba669aaf0bb3227932    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 09:46:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 09:46:02 +0900    

Click here for diff

CopyReadAttributes{CSV,Text}() are used to parse lines for text and CSV  
format.  This reduces the number of "if" branches that need to be  
checked when parsing fields in CSV and text mode when dealing with a  
COPY FROM, something that can become more noticeable with more  
attributes and more lines to process.  
  
Extracted from a larger patch by the same author.  
  
Author: Sutou Kouhei  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copyfrom_internal.h

libpq: Change some static functions to extern

commit   : 774bcffe4a9853a24e61d758637c0aad2871f1fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:35:16 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:35:16 +0100    

Click here for diff

This is in preparation of a follow up commit that starts using these  
functions from fe-cancel.c.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

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

libpq: Add pqReleaseConnHosts function

commit   : 53747f722228d2cd4d7054c4d509b27dc89306ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:19:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:19:20 +0100    

Click here for diff

In a follow up commit we'll need to free this connhost field in a  
function defined in fe-cancel.c, so here we extract the logic to a  
dedicated extern function.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

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

pg_basebackup: Fix check for MINIMUM_VERSION_FOR_WAL_SUMMARIES

commit   : c717525035d36e10d27ca045887bbfcc57e98e9e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 4 Feb 2024 10:51:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 4 Feb 2024 10:51:53 +0900    

Click here for diff

MINIMUM_VERSION_FOR_WAL_SUMMARIES is used to check if the directory  
pg_wal/summaries/ should be created in a base backup, but its condition  
was reversed: pg_wal/summaries/ would be created when taking base  
backups from backends of v16 and older versions, but it should be  
created in base backups taken from backends of v17 and newer versions.  
  
Author: Artur Zakirov  
Reviewed-by: Yugo Nagata, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/CAKNkYnzkkQ0gb_ZmLTY0r2-qV1q6imXgcCWxdA6UoA6yJkujGg@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Improve documentation for COPY ... ON_ERROR ...

commit   : 40bbc8cf0a753f08f0c26e6c2f8c959f3b9ef8c0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 3 Feb 2024 01:49:51 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 3 Feb 2024 01:49:51 +0200    

Click here for diff

Discussion: https://postgr.es/m/20240126112829.d420b28859fbe84379fdb7ad%40sraoss.co.jp  
Author: Yugo Nagata  
Reviewed-by: Masahiko Sawada, David G. Johnston, Atsushi Torikoshi  

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

Fix typo in comments

commit   : 18dd9d2ed978547ecc4c9195e2f5d3b80cc79bde    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 3 Feb 2024 00:18:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 3 Feb 2024 00:18:21 +0200    

Click here for diff

Backpatch-through: v16  

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

Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access().

commit   : e4e63cd9863480698ef97009f132c9854cce8407    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2024 15:34:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2024 15:34:29 -0500    

Click here for diff

Previously you got ERRCODE_INTERNAL_ERROR, which seems inappropriate,  
especially given that we're trying to avoid emitting that in reachable  
cases.  
  
Alexander Kuzmenkov  
  
Discussion: https://postgr.es/m/CALzhyqzgQph0BY8-hFRRGdHhF8CoqmmDHW9S=hMZ-HMzLxRqDQ@mail.gmail.com  

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

Fix bug in bulk extending temp relation after failure

commit   : d212957254de85aad934e2601e5a07661db268fb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Feb 2024 21:12:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Feb 2024 21:12:30 +0200    

Click here for diff

A ResourceOwnerEnlarge() call was missing. That led to an error:  
  
ERROR:  ResourceOwnerRemember called but array was full  
  
and an assertion failure, if you tried to extend a temp relation again  
after a failure. Alexander's test case used running out of disk space  
to trigger the original failure.  
  
This bug was introduced in the large ResourceOwner rewrite commit  
b8bff07daa. Before that, the UnpinLocalBuffer() call guaranteed that  
the subsequent PinLocalBuffer() will succeed, but after the rewrite,  
releasing an old resource doesn't guarantee that there is space for a  
new one.  
  
Add a comment explaining why the UnpinBuffer + PinBuffer calls in  
BufferAlloc(), with no ResourceOwnerEnlarge() in between, are safe.  
  
Reported-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/buffer/localbuf.c
M src/backend/utils/resowner/resowner.c

Allow Gather Merge in more cases for parallel DISTINCT

commit   : 7e0ade0ffe0a76b1926a4af39ecdf799c96ef1ba    
  
author   : David Rowley <[email protected]>    
date     : Sat, 3 Feb 2024 00:20:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 3 Feb 2024 00:20:18 +1300    

Click here for diff

Here we adjust the partial path generation for parallel DISTINCT queries  
to add Sort nodes on top of any unsorted partial distinct paths.  
  
This increases the likelihood of the planner pushing a Sort below a Gather  
Merge which enables the final phase of the parallel distinct to be  
implemented using a Unique node in more cases.  
  
Sorting the partial distinct paths is particularly useful when the  
DISTINCT query has an ORDER BY and LIMIT clause as this can allow cheaper  
plans by having the workers Hash Aggregate then Sort before feeding the  
results into the Gather Merge.  The non-parallel portion of the plan then  
becomes very cheap as it leaves only Unique and Limit to do in the leader  
process.  
  
Author: Richard Guo  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAMbWs48u9VoVOouJsys1qOaC9WVGVmBa+wT1dx8KvxF5GPzezA@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_distinct.out

Sync PG_VERSION file in CREATE DATABASE.

commit   : 0b6517a3b79ae02fb95731d8b1dc70b10cf7b532    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    

Click here for diff

An OS crash could leave PG_VERSION empty or missing.  The same symptom  
appeared in a backup by block device snapshot, taken after the next  
checkpoint and before the OS flushes the PG_VERSION blocks.  Device  
snapshots are not a documented backup method, however.  Back-patch to  
v15, where commit 9c08aea6a3090a396be334cc58c511edab05776a introduced  
STRATEGY=WAL_LOG and made it the default.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c
M src/backend/utils/activity/wait_event_names.txt

Handle interleavings between CREATE DATABASE steps and base backup.

commit   : df220714e50f2e924c57f4a8d9f578cf6c92a73f    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    

Click here for diff

Restoring a base backup taken in the middle of CreateDirAndVersionFile()  
or write_relmap_file() would lose the function's effects.  The symptom  
was absence of the database directory, PG_VERSION file, or  
pg_filenode.map.  If missing the directory, recovery would fail.  Either  
missing file would not fail recovery but would render the new database  
unusable.  Fix CreateDirAndVersionFile() with the transam/README "action  
first and then write a WAL entry" strategy.  That has a side benefit of  
moving filesystem mutations out of a critical section, reducing the ways  
to PANIC.  Fix the write_relmap_file() call with a lock acquisition, so  
it interacts with checkpoints like non-CREATE DATABASE calls do.  
Back-patch to v15, where commit 9c08aea6a3090a396be334cc58c511edab05776a  
introduced STRATEGY=WAL_LOG and made it the default.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c
M src/backend/utils/cache/relmapper.c

Update time zone data files to tzdata release 2024a.

commit   : 272a7c3034925162deb4395bf925bcf60dc2d061    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Feb 2024 15:57:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Feb 2024 15:57:53 -0500    

Click here for diff

DST law changes in Ittoqqortoormiit, Greenland (America/Scoresbysund),  
Kazakhstan (Asia/Almaty and Asia/Qostanay) and Palestine; as well as  
updates for the Antarctic stations Casey and Vostok.  
  
Historical corrections for Vietnam, Toronto, and Miquelon.  

M src/timezone/data/tzdata.zi

Avoid package qualification of $windows_os

commit   : 2e7061431b8b52163012164bd5464d2363f903c7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Feb 2024 15:17:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Feb 2024 15:17:41 -0500    

Click here for diff

Further fallout from commit 6ee26c6a4b. To keep code in sync and avoid  
issues on older releases with different package names, simply use the  
unqualified name like many other places in our code.  

M src/bin/pg_rewind/t/003_extrafiles.pl

Continue my quest to make 002_blocks.pl pass reliably.

commit   : 19a829a3270fb083b3d6ae967cd3b3c02a170a38    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2024 11:46:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2024 11:46:30 -0500    

Click here for diff

The latest buildfarm failures show that after the insert, we don't  
actually wait long enough for WAL summarization to catch up, apparently  
because the on disk state gets updated before the in-memory state, and  
so by checking the on disk state to see whether we're caught up and then  
the in-memory state to see where exactly how far we've progressed, we  
can, if unlucky, derive an older value of summarized_lsn, messing up  
the rest of the test.  
  
Attempt to fix this by using pg_available_wal_summaries() everywhere in  
the test and pg_get_wal_summarizer_state() nowhere.  
  
Per buildfarm.  

M src/bin/pg_walsummary/t/002_blocks.pl

doc: improve role option documentation

commit   : 21912e3c0262e2cfe64856e028799d6927862563    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2024 06:11:53 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2024 06:11:53 -0500    

Click here for diff

Role option management was changed in Postgres 16.  This patch improves  
the docs around these changes, including CREATE ROLE's INHERIT option,  
inheritance handling, and grant's ability to change role options.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: David G. Johnston  
  
Backpatch-through: 16  

M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/user-manag.sgml

doc: remove incorrect grammar for ALTER EVENT TRIGGER

commit   : 16a80e8912bb98c1a7763f6f6a29e23f43783f9d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 10:45:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 10:45:37 +0100    

Click here for diff

The Parameters subsection had an extra TRIGGER in the grammar  
for DISABLE/ENABLE which is incorrect.  Backpatch down to all  
supported versions since it's been like this all along.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/ref/alter_event_trigger.sgml

doc: Fix incorrect openssl option

commit   : 0293f8579c4d2e9219faa06e5cb8c8d31cf06fbc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 09:36:34 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 09:36:34 +0100    

Click here for diff

The openssl command for displaying the DN of a client certificate was  
using --subject and not the single-dash option -subject. While recent  
versions of openssl handles double dash options,  earlier does not so  
fix by using just -subject  (which is per the openssl documentation).  
  
Backpatch to v14 where this was introduced.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v14  

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

Fix stats_fetch_consistency with stats for fixed-numbered objects

commit   : 235c09efbb306d6263e904e484abdf44866beb5e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 1 Feb 2024 17:12:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 1 Feb 2024 17:12:50 +0900    

Click here for diff

This impacts the statistics retrieved in transactions for the following  
views when updating the value of stats_fetch_consistency, leading to  
behaviors contrary to what is documented since 605994651b6a as an update  
of this parameter should discard all statistics snapshot data:  
- pg_stat_archiver  
- pg_stat_bgwriter  
- pg_stat_checkpointer  
- pg_stat_io  
- pg_stat_slru  
- pg_stat_wal  
  
For example, updating stats_fetch_consistency from "snapshot" to "cache"  
in a transaction did not re-fetch any fresh data, using data cached from  
the time when "snapshot" was in use.  
  
Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Fix copy&paste typo in comment

commit   : 402388946fb3ac54f0fd5944d7e177ef7737eab2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 23:11:53 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 23:11:53 +0100    

Click here for diff

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

Exclude Threadsanitizer instrumentation in exit check

commit   : 936f56988741f17cce8731cfa6150fad96e571e9    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Jan 2024 22:54:45 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Jan 2024 22:54:45 +0100    

Click here for diff

When building libpq there is a check to ensure that we're not  
linking against code that calls exit(). This check is using a  
heuristic grep with exclusions for known false positives. The  
Threadsanitizer library instrumentation for function exits is  
named such that it triggers the check, so add an exclusion.  
  
This fix is only applied to the Makefile since the meson build  
files don't yet have this check.  Adding the check to meson is  
outside the scope of this patch though.  
  
Reported-by: Roman Lozko <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAEhC_BmNGKgj2wKArH2EAU11BsaHYgLnrRFJGRm5Vs8WJzyiQA@mail.gmail.com  

M src/interfaces/libpq/Makefile

Fix costing bug in MergeAppend

commit   : 9d1a5354f58cf61d9be6733d5ad0b36936af5af3    
  
author   : David Rowley <[email protected]>    
date     : Thu, 1 Feb 2024 09:48:26 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 1 Feb 2024 09:48:26 +1300    

Click here for diff

When building a MergeAppendPath which has child paths that are not  
sorted correctly for the MergeAppend's sort order, we apply the cost of  
sorting those paths to the MergeAppendPath costs.  
  
Here we fix a bug where the number of tuples specified that needed to be  
sorted was effectively pg_class.reltuples rather than the number of  
expected row in the subpath.  This effectively penalizes MergeAppend  
plans any time any filter is present on the MergeAppend subpath as the  
sort cost added is to sort all tuples in the table rather than just the  
ones expected the path to return.  
  
This did not affect UNION ALL type queries as the RelOptInfo tuples is  
set from the subquery's path rows.  It does affect MergeAppends uses for  
inheritance and partitioned tables.  
  
This is a long-standing bug introduced when MergeAppend was first added  
in 11cad29c9.  No backpatch as this could result in plan changes.  
  
Author: Alexander Kuzmenkov  
Reviewed-by: Ashutosh Bapat, Aleksander Alekseev, David Rowley  
Discussion: https://postgr.es/m/CALzhyqyhoXQDR-Usd_0HeWk%3DuqNLzoVeT8KhRoo%3DpV_KzgO3QQ%40mail.gmail.com  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Clean pg_walsummary's tmp_check directory.

commit   : 9589b038d3203cd5ba708fb4f5c23182c88ad0b3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Jan 2024 11:50:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Jan 2024 11:50:35 -0500    

Click here for diff

Oversight similar to ba08c10fc.  

M src/bin/pg_walsummary/Makefile

In 002_blocks.pl, try to prevent a HOT update.

commit   : b6ee30ec0866619eafc10cf43c4714ed1b89fec6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 11:35:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 11:35:41 -0500    

Click here for diff

Make the new tuple larger than the old one so that it, hopefully, won't  
manage to squeeze into leftover freespace on the same page. The test  
is trying to verify that the UPDATE touches 2 pages, but if a HOT  
update happens, then it doesn't.  
  
Per buildfarm.  

M src/bin/pg_walsummary/t/002_blocks.pl

commit   : f0106b6d2dc28660d9ecba3de77cee14de921c94    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 16:29:22 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 16:29:22 +0100    

Click here for diff

M src/bin/pg_walsummary/Makefile
M src/bin/pg_walsummary/meson.build
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/pg_walsummary/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl

Revise pg_walsummary's 002_blocks test to avoid spurious failures.

commit   : ea18eb7d625573dc369df619f7ff3b9e60e47531    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 10:12:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 10:12:53 -0500    

Click here for diff

Analysis of buildfarm results showed that the code that was intended  
to wait for the inserts performed by this test to complete did not  
actually do so. Try to make that logic more robust.  
  
Improve error checking elsewhere in the script, too, so that we  
don't miss things like poll_query_until failing.  
  
Along the way, fix a bit of pgindent damage introduced by commit  
5ddf9973477729cf161b4ad0a1efd52f4fea9c88, which aimed to help us  
debug the failures that this commit is trying to fix. It's making  
the buildfarm sad.  
  
Discussion: http://postgr.es/m/CA+TgmobWFb8NqyfC31YnKAbZiXf9tLuwmyuvx=iYMXMniPQ4nw@mail.gmail.com  

M src/backend/backup/walsummary.c
M src/bin/pg_walsummary/t/002_blocks.pl

doc: Document more that relations share a namespace

commit   : d0283387d358e5e0a64a439b7fe906399b59fdd9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jan 2024 11:53:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jan 2024 11:53:56 +0100    

Click here for diff

This was already documented in the CREATE INDEX reference, but not in  
the introductory "Data Definition" chapter.  Also, document that the  
index that implements a constraint has the same name as the  
constraint.  
  
Author: Laurenz Albe <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFG682tYcP9aH_F-jrqq5End8MHZR77zcp1%3DDUrEsSu1Q%40mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_table.sgml

Give SMgrRelation pointers a well-defined lifetime.

commit   : 21d9c3ee4ef74e2229341d39811c97f85071c90a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 12:31:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 12:31:02 +0200    

Click here for diff

After calling smgropen(), it was not clear how long you could continue  
to use the result, because various code paths including cache  
invalidation could call smgrclose(), which freed the memory.  
  
Guarantee that the object won't be destroyed until the end of the  
current transaction, or in recovery, the commit/abort record that  
destroys the underlying storage.  
  
smgrclose() is now just an alias for smgrrelease(). It closes files  
and forgets all state except the rlocator, but keeps the SMgrRelation  
object valid.  
  
A new smgrdestroy() function is used by rare places that know there  
should be no other references to the SMgrRelation.  
  
The short version:  
  
 * smgrclose() is now just an alias for smgrrelease(). It releases  
   resources, but doesn't destroy until EOX  
 * smgrdestroy() now frees memory, and should rarely be used.  
  
Existing code should be unaffected, but it is now possible for code that  
has an SMgrRelation object to use it repeatedly during a transaction as  
long as the storage hasn't been physically dropped.  Such code would  
normally hold a lock on the relation.  
  
This also replaces the "ownership" mechanism of SMgrRelations with a  
pin counter.  An SMgrRelation can now be "pinned", which prevents it  
from being destroyed at end of transaction.  There can be multiple pins  
on the same SMgrRelation.  In practice, the pin mechanism is only used  
by the relcache, so there cannot be more than one pin on the same  
SMgrRelation.  Except with swap_relation_files XXX  
  
Author: Thomas Munro, Heikki Linnakangas  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA@mail.gmail.com  

M src/backend/access/transam/xlogutils.c
M src/backend/commands/cluster.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/include/storage/smgr.h
M src/include/utils/rel.h
M src/include/utils/relcache.h

Remove some obsolete smgrcloseall() calls.

commit   : 6a8ffe812d194ba6f4f26791b6388a4837d17d6c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 11:40:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 11:40:29 +0200    

Click here for diff

Before the advent of PROCSIGNAL_BARRIER_SMGRRELEASE, we didn't have a  
comprehensive way to deal with Windows file handles that get in the way  
of unlinking directories.  We had smgrcloseall() calls in a few places  
to try to mitigate.  
  
It's still a good idea for bgwriter and checkpointer to do that once per  
checkpoint so they don't accumulate unbounded SMgrRelation objects, but  
there is no longer any reason to close them at other random places such  
as the error path, and the explanation as given in the comments is now  
obsolete.  
  
Author: Thomas Munro  
Reviewed-by: Heikki Linnakangas, Robert Haas  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA@mail.gmail.com  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c

Add .gitignore to src/test/modules/gin/

commit   : 0fda3921380798897b6faca5e4fdcdc22f950f12    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:12:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:12:22 +0900    

Click here for diff

This has been forgotten in 6a1ea02c491d.  

A src/test/modules/gin/.gitignore

Add tests for int4_bool() in int.c

commit   : 5f19412e4eae6468361f24fd20e05fb433da5538    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:02:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:02:28 +0900    

Click here for diff

This cast was previously not covered at all by the regression tests.  
  
Author: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  

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

Consider the "LIMIT 1" optimization with parallel DISTINCT

commit   : b588cad688823b1e996ce05af4d88a954c005a3a    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 17:22:02 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 17:22:02 +1300    

Click here for diff

Similar to what was done in 5543677ec for non-parallel DISTINCT, apply  
the same optimization when the distinct_pathkeys are empty for the  
partial paths too.  
  
This can be faster than the non-parallel version when the first row  
matching the WHERE clause of the query takes a while to find.  Parallel  
workers could speed that process up considerably.  
  
Author: Richard Guo  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAMbWs49JC0qvfUbzs-TVzgMpSSBiMJ_6sN=BaA9iohBgYkr=LA@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_distinct.out
M src/test/regress/sql/select_distinct.sql

Fix various issues with ALTER TEXT SEARCH CONFIGURATION

commit   : 3e91dba8b079c02dc5204108c7e797b402c75779    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 13:15:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 13:15:21 +0900    

Click here for diff

This commit addresses a set of issues when changing token type mappings  
in a text search configuration when using duplicated token names:  
- ADD MAPPING would fail on insertion because of a constraint failure  
after inserting the same mapping.  
- ALTER MAPPING with an "overridden" configuration failed with "tuple  
already updated by self" when the token mappings are removed.  
- DROP MAPPING failed with "tuple already updated by self", like  
previously, but in a different code path.  
  
The code is refactored so the token names (with their numbers) are  
handled as a List with unique members rather than an array with numbers,  
ensuring that no duplicates mess up with the catalog inserts, updates  
and deletes.  The list is generated by getTokenTypes(), with the same  
error handling as previously while duplicated tokens are discarded from  
the list used to work on the catalogs.  
  
Regression tests are expanded to cover much more ground for the cases  
fixed by this commit, as there was no coverage for the code touched in  
this commit.  A bit more is done regarding the fact that a token name  
not supported by a configuration's parser should result in an error even  
if IF EXISTS is used in a DROP MAPPING clause.  This is implied in the  
code but there was no coverage for that, and it was very easy to miss.  
  
These issues exist since at least their introduction in core with  
140d4ebcb46e, so backpatch all the way down.  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/commands/tsearchcmds.c
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql
M src/tools/pgindent/typedefs.list

Fix 003_extrafiles.pl test for the Windows

commit   : 6ee26c6a4bafabbd22a85f575d2446fd5ec6ad0d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 30 Jan 2024 17:09:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 30 Jan 2024 17:09:44 -0500    

Click here for diff

File::Find converts backslashes to slashes in the newer Perl versions.  
See: https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d  
  
So, do the same conversion for Windows before comparing paths. To  
support all Perl versions, always convert them on Windows regardless of  
the Perl's version.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
  
Backpatch to all live branches  

M src/bin/pg_rewind/t/003_extrafiles.pl

Simplify partial path generation in GROUP BY/ORDER BY

commit   : 8ee9c250875157d42f7ed53508e239d23ce514fb    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 10:10:59 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 10:10:59 +1300    

Click here for diff

Here we consolidate the generation of partial sort and partial incremental  
sort paths in a similar way to what was done in 4a29eabd1.  Since the cost  
penalty for incremental sort was removed by that commit, there's no  
point in creating a sort path on the cheapest partial path if an  
incremental sort could be done instead.  
  
This has the added benefit of reducing the amount of code required to  
build these paths.  
  
Author: Richard Guo  
Reviewed-by: Etsuro Fujita, Shubham Khanna, David Rowley  
Discussion: https://postgr.es/m/CAMbWs49PaKxBZU9cN7k3DKB7id+YfGfOfS9H_Fo5tkqPMt=fDg@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Split use of SerialSLRULock, creating SerialControlLock

commit   : 7b745d85b80d4492c4df8d9769592c7aad1f63d2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jan 2024 18:11:17 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jan 2024 18:11:17 +0100    

Click here for diff

predicate.c has been using SerialSLRULock (the control lock for its SLRU  
structure) to coordinate access to SerialControlData, another of its  
numerous shared memory structures; this is unnecessary and confuses  
further SLRU scalability work.  Create a separate LWLock to cover  
SerialControlData.  
  
Extracted from a larger patch from the same author, and some additional  
changes by Álvaro.  
  
Author: Dilip Kumar <[email protected]>  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/wait_event_names.txt

Add a failover option to subscriptions.

commit   : 776621a5e4796fa214b6b29a7ca134f6c138572a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 30 Jan 2024 16:31:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 30 Jan 2024 16:31:09 +0530    

Click here for diff

This commit introduces a new subscription option named 'failover', which  
provides users with the ability to set the failover property of the  
replication slot on the publisher when creating or altering a  
subscription.  
  
This uses the replication commands introduced by commit 7329240437 to  
enable the failover option for a logical replication slot.  
  
If the failover option is set to true, the associated replication slots  
(i.e. the main slot and the table sync slots) in the upstream database are  
enabled to be synchronized to the standbys. Note that the capability to  
sync the replication slots will be added in subsequent commits.  
  
Thanks to Masahiko Sawada for the design inputs.  
  
Author: Shveta Malik, Hou Zhijie, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/recovery/meson.build
A src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

pgcrypto: Fix check for buffer size

commit   : b527ebc1d37aa82b771dc9c76111bed1bce35a05    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Jan 2024 11:15:46 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Jan 2024 11:15:46 +0100    

Click here for diff

The code copying the PGP block into the temp buffer failed to  
account for the extra 2 bytes in the buffer which are needed  
for the prefix. If the block was oversized, subsequent checks  
of the prefix would have exceeded the buffer size.  Since the  
block sizes are hardcoded in the list of supported ciphers it  
can be verified that there is no live bug here. Backpatch all  
the way for consistency though, as this bug is old.  
  
Author: Mikhail Gribkov <[email protected]>  
Discussion: https://postgr.es/m/CAMEv5_uWvcMCMdRFDsJLz2Q8g16HEa9xWyfrkr+FYMMFJhawOw@mail.gmail.com  
Backpatch-through: v12  

M contrib/pgcrypto/pgp-decrypt.c

Fix incorrect format placeholders for Oid

commit   : 4c48c0fe561c2b07831c2a296da637401cb953c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2024 09:11:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2024 09:11:41 +0100    

Click here for diff

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

Delay build of Memoize hash table until executor run

commit   : 57f59396bb51953bb7b957780c7f1b7f67602125    
  
author   : David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 12:37:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 12:37:03 +1300    

Click here for diff

Previously this hash table was built during executor startup.  This  
could cause long delays in EXPLAIN (without ANALYZE) when the planner  
opts to use a large Memoize hash table.  
  
No backpatch for now due to lack of complaints.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvoJktJ5XL=Kjh2a2TFr64R-7eQZV-+jcJrUwoES2GLiWg@mail.gmail.com  

M src/backend/executor/nodeMemoize.c

Doc: mention foreign keys can reference unique indexes

commit   : c85977d8fef7b18f69e0be72923ddb8dcc8165b5    
  
author   : David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 10:15:17 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 10:15:17 +1300    

Click here for diff

We seem to have only documented a foreign key can reference the columns of  
a primary key or unique constraint.  Here we adjust the documentation  
to mention columns in a non-partial unique index can be mentioned too.  
  
The header comment for transformFkeyCheckAttrs() also didn't mention  
unique indexes, so fix that too.  In passing make that header comment  
reflect reality in the various other aspects where it deviated from it.  
  
Bug: 18295  
Reported-by: Gilles PARC  
Author: Laurenz Albe, David Rowley  
Discussion: https://www.postgresql.org/message-id/18295-0ed0fac5c9f7b17b%40postgresql.org  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c

Move is_valid_ascii() to ascii.h.

commit   : 97287bdfae41b8ea16b27dccb63771fcc196a55a    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 29 Jan 2024 12:08:57 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 29 Jan 2024 12:08:57 -0600    

Click here for diff

This function requires simd.h, which is a rather large dependency  
for a widely-used header file like pg_wchar.h.  Furthermore, there  
is a report of a third-party tool that is struggling to use  
pg_wchar.h due to its dependence on simd.h (presumably because  
simd.h uses several intrinsics).  Moving the function to the much  
less popular ascii.h resolves these issues for now.  
  
This commit is back-patched for the benefit of the aforementioned  
third-party tool.  The simd.h dependency was only added in v16,  
but we've opted to back-patch to v15 so that is_valid_ascii() lives  
in the same file for all versions where it exists.  This could  
break existing third-party code that uses the function, but we  
couldn't find any examples of such code.  It should be possible to  
fix any code that this commit breaks by including ascii.h in the  
file that uses is_valid_ascii().  
  
Author: Jubilee Young  
Reviewed-by: Tom Lane, John Naylor, Andres Freund, Eric Ridge  
Discussion: https://postgr.es/m/CAPNHn3oKJJxMsYq%2BqLYzVJOFrUcOr4OF1EC-KtFT-qh8nOOOtQ%40mail.gmail.com  
Backpatch-through: 15  

M src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/include/utils/ascii.h

Fix incompatibilities with libxml2 >= 2.12.0.

commit   : 400928b83bd254d20f0790d467f221bb52707e6e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2024 12:06:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2024 12:06:07 -0500    

Click here for diff

libxml2 changed the required signature of error handler callbacks  
to make the passed xmlError struct "const".  This is causing build  
failures on buildfarm member caiman, and no doubt will start showing  
up in the field quite soon.  Add a version check to adjust the  
declaration of xml_errorHandler() according to LIBXML_VERSION.  
  
2.12.x also produces deprecation warnings for contrib/xml2/xpath.c's  
assignment to xmlLoadExtDtdDefaultValue.  I see no good reason for  
that to still be there, seeing that we disabled external DTDs (at a  
lower level) years ago for security reasons.  Let's just remove it.  
  
Back-patch to all supported branches, since they might all get built  
with newer libxml2 once it gets a bit more popular.  (The back  
branches produce another deprecation warning about xpath.c's use of  
xmlSubstituteEntitiesDefault().  We ought to consider whether to  
back-patch all or part of commit 65c5864d7 to silence that.  It's  
less urgent though, since it won't break the buildfarm.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M src/backend/utils/adt/xml.c

Add EXPLAIN (MEMORY) to report planner memory consumption

commit   : 5de890e3610d5a12cdaea36413d967cf5c544e20    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 17:53:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 17:53:03 +0100    

Click here for diff

This adds a new "Memory:" line under the "Planning:" group (which  
currently only has "Buffers:") when the MEMORY option is specified.  
  
In order to make the reporting reasonably accurate, we create a separate  
memory context for planner activities, to be used only when this option  
is given.  The total amount of memory allocated by that context is  
reported as "allocated"; we subtract memory in the context's freelists  
from that and report that result as "used".  We use  
MemoryContextStatsInternal() to obtain the quantities.  
  
The code structure to show buffer usage during planning was not in  
amazing shape, so I (Álvaro) modified the patch a bit to clean that up  
in passing.  
  
Author: Ashutosh Bapat  
Reviewed-by: David Rowley, Andrey Lepikhov, Jian He, Andy Fan  
Discussion: https://www.postgresql.org/message-id/CAExHW5sZA=5LJ_ZPpRO-w09ck8z9p7eaYAqq3Ks9GDfhrxeWBw@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/utils/mmgr/mcxt.c
M src/include/commands/explain.h
M src/include/utils/memutils.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Fix locking when fixing an incomplete split of a GIN internal page

commit   : 6a1ea02c491d16474a6214603dce40b5b122d4d1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jan 2024 13:46:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jan 2024 13:46:22 +0200    

Click here for diff

ginFinishSplit() expects the caller to hold an exclusive lock on the  
buffer, but when finishing an earlier "leftover" incomplete split of  
an internal page, the caller held a shared lock. That caused an  
assertion failure in MarkBufferDirty(). Without assertions, it could  
lead to corruption if two backends tried to complete the split at the  
same time.  
  
On master, add a test case using the new injection point facility.  
  
Report and analysis by Fei Changhong. Backpatch the fix to all  
supported versions.  
  
Reviewed-by: Fei Changhong, Michael Paquier  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gin/ginbtree.c
M src/test/modules/Makefile
A src/test/modules/gin/Makefile
A src/test/modules/gin/expected/gin_incomplete_splits.out
A src/test/modules/gin/meson.build
A src/test/modules/gin/sql/gin_incomplete_splits.sql
M src/test/modules/meson.build

commit   : 6d4565a05f3fb9b7a439e7ecfc2be68bf4dabf48    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 10:53:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 10:53:34 +0100    

Click here for diff

In follow up commits we'll add more functions related to query  
cancellations.  This groups those all together instead of mixing them  
with the other functions in fe-connect.c.  
  
The formerly static parse_int_param() function had to be exported to  
other libpq users, so it's been renamed pqParseIntParam() and moved to a  
more reasonable place within fe-connect.c (rather than randomly between  
various keepalive-related routines).  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/interfaces/libpq/Makefile
A src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build

Doc: Fix incorrect reference to conflicting column in pg_replication_slots.

commit   : cf765ff824b8fef31f3c6b5489d2f9985909f6a9    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 12:13:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 12:13:39 +0530    

Click here for diff

Commit 007693f2a3 changes the existing 'conflicting' field to  
'conflict_reason' in pg_replication_slots but missed updating one of its  
existing references.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB571690299199ACA80F602D97947E2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Remove make function vpathsearch

commit   : 54fac0e50502765f66a9fad1ca8169b1cb75498e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2024 07:22:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2024 07:22:43 +0100    

Click here for diff

This function served to support having prebuilt files in the source  
tree for vpath builds.  This is no longer possible (since  
721856ff24b); all built files are now always in the build tree.  The  
invocations of this function are no longer required.  

M doc/src/sgml/Makefile
M src/Makefile.global.in
M src/backend/catalog/Makefile

Fix comments in ReplicationSlotAcquire().

commit   : a9a47fb6d99785d5d272b408d251dca28b0879e3    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 10:12:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 10:12:58 +0530    

Click here for diff

They were incorrectly referring to a slot parameter in  
ReplicationSlotAcquire() which is not passed to the API.  
  
Author: Wang Wei  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS3PR01MB6275E3CE4DC15FF8B8B80D3A9E7A2@OS3PR01MB6275.jpnprd01.prod.outlook.com  

M src/backend/replication/slot.c

Allow setting failover property in the replication command.

commit   : 73292404370c9900a96e2bebdc7144f7010339cf    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 09:10:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 09:10:00 +0530    

Click here for diff

This commit implements a new replication command called  
ALTER_REPLICATION_SLOT and a corresponding walreceiver API function named  
walrcv_alter_slot. Additionally, the CREATE_REPLICATION_SLOT command has  
been extended to support the failover option.  
  
These new additions allow the modification of the failover property of a  
replication slot on the publisher. A subsequent commit will make use of  
these commands in subscription commands and will add the tests as well to  
cover the functionality added/changed by this commit.  
  
Author: Hou Zhijie, Shveta Malik  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda, Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/nodes/replnodes.h
M src/include/replication/slot.h
M src/include/replication/walreceiver.h
M src/tools/pgindent/typedefs.list

Remove ReorderBufferTupleBuf structure.

commit   : 08e6344fd6423210b339e92c069bb979ba4e7cd6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 29 Jan 2024 10:37:16 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 29 Jan 2024 10:37:16 +0900    

Click here for diff

Since commit a4ccc1cef, the 'node' and 'alloc_tuple_size' fields of  
the ReorderBufferTupleBuf structure are no longer used. This leaves  
only the 'tuple' field in the structure. Since keeping a single-field  
structure makes little sense, the ReorderBufferTupleBuf is removed  
entirely. The code is refactored accordingly.  
  
No back-patching since these are ABI changes in an exposed structure  
and functions, and there would be some risk of breaking extensions.  
  
Author: Aleksander Alekseev  
Reviewed-by: Amit Kapila, Masahiko Sawada, Reid Thompson  
Discussion: https://postgr.es/m/CAD21AoCvnuxiXXfRecp7g9+CeC35POQfhuQeJFr7_9u_Q5jc_Q@mail.gmail.com  

M contrib/test_decoding/test_decoding.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list

Fix DROP ROLE when specifying duplicated roles

commit   : 50b797dc99ec3bf97ea5d0955a3b42d356c1522d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Jan 2024 08:05:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Jan 2024 08:05:59 +0900    

Click here for diff

This commit fixes failures with "tuple already updated by self" when  
listing twice the same role and in a DROP ROLE query.  
  
This is an oversight in 6566133c5f52, that has introduced a two-phase  
logic in DropRole() where dependencies of all the roles to drop are  
removed in a first phase, with the roles themselves removed from  
pg_authid in a second phase.  
  
The code is simplified to not rely on a List of ObjectAddress built in  
the first phase used to remove the pg_authid entries in the second  
phase, switching to a list of OIDs.  Duplicated OIDs can be simply  
avoided in the first phase thanks to that.  Using ObjectAddress was not  
necessary for the roles as they are not used for anything specific to  
dependency.c, building all the ObjectAddress in the List with  
AuthIdRelationId as class ID.  
  
In 15 and older versions, where a single phase is used, DROP ROLE with  
duplicated role names would fail on "role \"blah\" does not exist" for  
the second entry after the CCI() done by the first deletion.  This is  
not really incorrect, but it does not seem worth changing based on a  
lack of complaints.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Tender Wang  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Attempt to fix newly added Memoize regression test

commit   : a3a836fb5e51183eae624d43225279306c2285b8    
  
author   : David Rowley <[email protected]>    
date     : Sat, 27 Jan 2024 11:17:35 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 27 Jan 2024 11:17:35 +1300    

Click here for diff

Both drongo and fairywren seem not to like a new regression test added  
by 2cca95e17.  These machines show a different number of actual rows in  
the EXPLAIN ANALYZE output.  Since the number of actual rows is divided by  
the number of loops, I suspect this might be due to some platform  
dependant rounding behavior as the total row count is 5 and the number of  
loops is 2.  drongo and fairywren seem to be calculating that 5.0 / 2.0 is  
3, whereas most other machines think the answer is 2.  
  
Here we tweak the test query's WHERE clause so it's 4.0 / 2.0 instead.  
There shouldn't be too much wiggle room for platform dependant-behavior to  
be a factor with those numbers.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/1035225.1706301718%40sss.pgh.pa.us  

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

Compare varnullingrels too in assign_param_for_var().

commit   : 5e444a2526cc6f4052ce0004e1df69135c47338a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 15:54:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 15:54:17 -0500    

Click here for diff

Oversight in 2489d76c4.  Preliminary analysis suggests that the  
problem may be unreachable --- but if we did have instances of  
the same column with different varnullingrels, we'd surely need  
to treat them as different Params.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Detect Julian-date overflow in timestamp[tz]_pl_interval.

commit   : 25cd2d64021ae081cbcef1592e0ee04ddda2e975    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 13:39:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 13:39:37 -0500    

Click here for diff

We perform addition of the days field of an interval via  
arithmetic on the Julian-date representation of the timestamp's date.  
This step is subject to int32 overflow, and we also should not let  
the Julian date become very negative, for fear of weird results from  
j2date.  (In the timestamptz case, allow a Julian date of -1 to pass,  
since it might convert back to zero after timezone rotation.)  
  
The additions of the months and microseconds fields could also  
overflow, of course.  However, I believe we need no additional  
checks there; the existing range checks should catch such cases.  
The difficulty here is that j2date's magic modular arithmetic could  
produce something that looks like it's in-range.  
  
Per bug #18313 from Christian Maurer.  This has been wrong for  
a long time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Temporary patch to help debug pg_walsummary test failures.

commit   : 5ddf9973477729cf161b4ad0a1efd52f4fea9c88    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 13:25:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 13:25:19 -0500    

Click here for diff

The tests in 002_blocks.pl are failing in the buildfarm from time to  
time, but we don't know how to reproduce the failure elsewhere. The  
most obvious explanation seems to be the unexpected disappearance of a  
WAL summary file, so bump up the logging level in  
RemoveWalSummaryIfOlderThan to try to help us spot such problems, and  
print the cutoff time in addition to the removed filename. Also  
adjust 002_blocks.pl to dump out a directory listing of the relevant  
directory at various points.  
  
This patch should be reverted once we sort out what's happening here.  
  
Patch by me, reviewed by Nathan Bossart, who also reported the issue.  
  
Discussion: http://postgr.es/m/20240124170846.GA2643050@nathanxps13  

M src/backend/backup/walsummary.c
M src/bin/pg_walsummary/t/002_blocks.pl

Combine FSM updates for prune and no-prune cases.

commit   : 5eafacd2797dc0b04a0bde25fbf26bf79903e7c2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 11:40:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 11:40:16 -0500    

Click here for diff

lazy_scan_prune() and lazy_scan_noprune() update the freespace map  
with identical conditions; combine them. This consolidation is easier  
now that cb970240f13df2b63f0410f81f452179a2b78d6f moved visibility map  
updates into lazy_scan_prune().  
  
While combining the FSM updates, simplify the logic for calling  
lazy_scan_new_or_empty() and lazy_scan_noprune().  
  
Also update a few comemnts in this part of the code to make them,  
hopefully, clearer.  
  
Melanie Plageman and Robert Haas  
  
Discussion: https://postgr.es/m/CA%2BTgmoaLTvipm%3Dxx4rJLr07m908PCu%3DQH3uCjD1UOn8YaEuO2g%40mail.gmail.com  

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

Split some code out from MergeAttributes()

commit   : f7cf9494bad3aef1b2ba1cd84376a1e71797ac50    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 13:52:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 13:52:05 +0100    

Click here for diff

- Separate function to merge a child attribute into matching inherited  
  attribute: The logic to merge a child attribute into matching  
  inherited attribute in MergeAttribute() is only applicable to  
  regular inheritance child.  The code is isolated and coherent enough  
  that it can be separated into a function of its own.  
  
- Separate function to merge next parent attribute: Partitions inherit  
  from only a single parent.  The logic to merge an attribute from the  
  next parent into the corresponding attribute inherited from previous  
  parents in MergeAttribute() is only applicable to regular  
  inheritance children.  This code is isolated enough that it can be  
  separate into a function by itself.  
  
These separations makes MergeAttribute() more readable by making it  
easier to follow high level logic without getting entangled into  
details.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Make spelling of cancelled/cancellation consistent

commit   : 8c9da1441df18bd609f025778e8349873a3e9bbd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jan 2024 12:38:15 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jan 2024 12:38:15 +0100    

Click here for diff

This fixes places where words derived from cancel were not using their  
common en-US ugly^H^H^H^Hspelling.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Reported-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKG+Lrq+ty6yWXF5572qNQ8KwxGwG5n4fsEcCUap685nWvQ@mail.gmail.com  

M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/libpq.sgml
M src/backend/storage/lmgr/proc.c
M src/test/isolation/specs/detach-partition-concurrently-4.spec
M src/test/recovery/t/001_stream_rep.pl

MergeAttributes code deduplication

commit   : 64444ce071f6b04d3fc836f436fa08108a6d11e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 09:04:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 09:04:27 +0100    

Click here for diff

The code handling NOT NULL constraints is duplicated in blocks merging  
the attribute definition incrementally.  Deduplicate that code.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Reindex toast before its main relation in reindex_relation()

commit   : f2bf8fb04886e3ea82e7f7f86696ac78e06b7e60    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 17:39:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 17:39:58 +0900    

Click here for diff

This commit changes the order of reindex on a relation so as a toast  
relation is processed before its main relation.  
  
The original order, where a rebuild was first done for the indexes on  
the main table, could be a problem in the event of a corruption of a  
toast index, because, as scans of a toast index may be required to  
rebuild the indexes on the main relation, this could lead to failures  
with REINDEX TABLE without being able to fix anything.  
  
Rebuilding corrupted toast indexes before this change was possible but  
troublesome, as it was necessary to issue a REINDEX on the toast  
relation first, followed by a REINDEX on the main relation.  Changing  
the order of these operations should make things easier when rebuilding  
corrupted indexes, as toast indexes would be rebuilt before they are  
used for the indexes on the main relation.  
  
Per request from Richard Vesely.  
  
Author: Gurjeet Singh  
Reviewed-by: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c

De-dupicate Memoize cache keys

commit   : bc397e5cdb31c399392d693cbc5909341d21235a    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 20:51:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 20:51:36 +1300    

Click here for diff

It was possible when determining the cache keys for a Memoize path that  
if the same expr appeared twice in the parameterized path's ppi_clauses  
and/or in the Nested Loop's inner relation's lateral_vars.  If this  
happened the Memoize node's cache keys would contain duplicates.  This  
isn't a problem for correctness, all it means is that the cache lookups  
will be suboptimal due to having redundant work to do on every hash table  
lookup and insert.  
  
Here we adjust paraminfo_get_equal_hashops() to look for duplicates and  
ignore them when we find them.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/422277.1706207562%40sss.pgh.pa.us  

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

Fix comment in index.c

commit   : bd5760df38c0032bb94eb73df8a18ef74c4eff57    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 14:08:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 14:08:04 +0900    

Click here for diff

Extracted from a larger patch by the same author.  
  
Author: Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4WX=m5pQvKXvLFJoEH=hSd6O=iZSqxVqHKjFm+iL-AO=w@mail.gmail.com  

M src/backend/catalog/index.c

Improve NestLoopParam generation for lateral subqueries

commit   : 2cca95e175463a7af95164498b889b1ea118583d    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 16:18:58 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 16:18:58 +1300    

Click here for diff

It was possible in cases where we had a LATERAL joined subquery that  
when the same Var is mentioned in both the lateral references and in the  
outer Vars of the scan clauses that the given Var wouldn't be assigned  
to the same NestLoopParam.  
  
This could cause issues in Memoize as the cache key would reference the  
Var for the scan clauses but when the parameter for the lateral references  
changed some code in Memoize would see that some other parameter had  
changed that's not part of the cache key and end up purging the entire  
cache as a result, thinking the cache had become stale.  This could  
result in a Nested Loop -> Memoize plan being quite inefficient as, in  
the worst case, the cache purging could result in never getting a cache  
hit.  In no cases could this problem lead to incorrect query results.  
  
Here we switch the order of operations so that we create NestLoopParam  
for the lateral references first before doing replace_nestloop_params().  
replace_nestloop_params() will find and reuse the existing NestLoopParam  
in cases where the Var exists in both locations.  
  
Author: Richard Guo  
Reviewed-by: Tom Lane, David Rowley  
Discussion: https://postgr.es/m/CAMbWs48XHJEK1Q1CzAQ7L9sTANTs9W1cepXu8%3DKc0quUL%2Btg4Q%40mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Revert "Add support for parsing of large XML data (>= 10MB)"

commit   : f2743a7d70e7b2891277632121bb51e739743a47    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 10:15:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 10:15:32 +0900    

Click here for diff

This reverts commit 2197d06224a1, following a discussion over a Coverity  
report where issues like the "Billion laugh attack" could cause the  
backend to waste CPU and memory even if a client applied checks on the  
size of the data given in input, and libxml2 does not offer guarantees  
that input limits are respected under XML_PARSE_HUGE.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/utils/adt/xml.c

Update comment, generation mem contexts have a "keeper" block

commit   : 376c216138c75e161d39767650ea30536f23b482    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jan 2024 01:04:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jan 2024 01:04:58 +0200    

Click here for diff

The keeper block was introduced in commit 1b0d9aa4f7, but it forgot  
to update this comment.  

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

Support TZ and OF format codes in to_timestamp().

commit   : 8ba6fdf905d0f5aef70ced4504c6ad297bfe08ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 17:47:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 17:47:08 -0500    

Click here for diff

Formerly, these were only supported in to_char(), but there seems  
little reason for that restriction.  We should at least have enough  
support to permit round-tripping the output of to_char().  
  
In that spirit, TZ accepts either zone abbreviations or numeric  
(HH or HH:MM) offsets, which are the cases that to_char() can output.  
In an ideal world we'd make it take full zone names too, but  
that seems like it'd introduce an unreasonable amount of ambiguity,  
since the rules for POSIX-spec zone names are so lax.  
  
OF is a subset of this, accepting only HH or HH:MM.  
  
One small benefit of this improvement is that we can simplify  
jsonpath's executeDateTimeMethod function, which no longer needs  
to consider the HH and HH:MM cases separately.  Moreover, letting  
it accept zone abbreviations means it will accept "Z" to mean UTC,  
which is emitted by JSON.stringify() for example.  
  
Patch by me, reviewed by Aleksander Alekseev and Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/datetime.h
M src/test/regress/expected/horology.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/horology.sql
M src/test/regress/sql/jsonb_jsonpath.sql

Clean up a bug in sql/json items commit 66ea94e8e6

commit   : 06a66d87dbc7e06581af6765131ea250063fb4ac    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 16:21:57 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 16:21:57 -0500    

Click here for diff

Remove a buggy and unnecessary test, along with an unnecessary pstrdup()  
and a line of dead code.  
  
Per report, diagnosis and fix from Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: improve documentation for jsonpath behavior.

commit   : 7014c9a4bba2d1b67d60687afb5b2091c1d07f73    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 11:32:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 11:32:18 -0500    

Click here for diff

Clarify the behavior of jsonpath operators and functions by  
describing their two different modes of operation explicitly.  
In addition to the SQL-spec behavior, where a path returns  
a list of matching items, we have a "predicate check" form  
that always returns a single boolean result.  That was mentioned  
in only one place, but it seems better to annotate each operator  
and function as to which form(s) it takes.  Also improve the  
examples by converting them into actual executable SQL with  
results, and do a bunch of incidental wordsmithing.  
  
David Wheeler, reviewed by Erik Wienhold, Jian He, and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Implement various jsonpath methods

commit   : 66ea94e8e606529bb334515f388c62314956739e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 10:15:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 10:15:43 -0500    

Click here for diff

This commit implements ithe jsonpath .bigint(), .boolean(),  
.date(), .decimal([precision [, scale]]), .integer(), .number(),  
.string(), .time(), .time_tz(), .timestamp(), and .timestamp_tz()  
methods.  
  
.bigint() converts the given JSON string or a numeric value to  
the bigint type representation.  
  
.boolean() converts the given JSON string, numeric, or boolean  
value to the boolean type representation.  In the numeric case, only  
integers are allowed. We use the parse_bool() backend function  
to convert a string to a bool.  
  
.decimal([precision [, scale]]) converts the given JSON string  
or a numeric value to the numeric type representation.  If precision  
and scale are provided for .decimal(), then it is converted to the  
equivalent numeric typmod and applied to the numeric number.  
  
.integer() and .number() convert the given JSON string or a  
numeric value to the int4 and numeric type representation.  
  
.string() uses the datatype's output function to convert numeric  
and various date/time types to the string representation.  
  
The JSON string representing a valid date/time is converted to the  
specific date or time type representation using jsonpath .date(),  
.time(), .time_tz(), .timestamp(), .timestamp_tz() methods.  The  
changes use the infrastructure of the .datetime() method and perform  
the datatype conversion as appropriate.  Unlike the .datetime()  
method, none of these methods accept a format template and use ISO  
DateTime format instead.  However, except for .date(), the  
date/time related methods take an optional precision to adjust the  
fractional seconds.  
  
Jeevan Chalke, reviewed by Peter Eisentraut and Andrew Dunstan.  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql

Add a const decoration

commit   : 924d046dcf55887c98a1628675a30f4b0eebe556    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 13:34:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 13:34:49 +0100    

Click here for diff

Useful for a subsequent patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/parse_type.c
M src/include/parser/parse_type.h

Remove dummy_spinlock

commit   : 55627ba2d334ce98e1f5916354c46472d414bda6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:43:47 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:43:47 +0100    

Click here for diff

It's been unused since 1b468a131bd2 (2015).  

M src/backend/main/main.c
M src/backend/storage/lmgr/s_lock.c
M src/include/storage/s_lock.h

MergeAttributes: convert pg_attribute back to ColumnDef before comparing

commit   : 4d969b2f85e1fd00e860366f101fd3e3160aab41    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 10:54:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 10:54:35 +0100    

Click here for diff

MergeAttributes() has a loop to merge multiple inheritance parents  
into a column column definition.  The merged-so-far definition is  
stored in a ColumnDef node.  If we have to merge columns from multiple  
inheritance parents (if the name matches), then we have to check  
whether various column properties (type, collation, etc.) match.  The  
current code extracts the pg_attribute value of the  
currently-considered inheritance parent and compares it against the  
merged-so-far ColumnDef value.  If the currently considered column  
doesn't match any previously inherited column, we make a new ColumnDef  
node from the pg_attribute information and add it to the column list.  
  
This patch rearranges this so that we create the ColumnDef node first  
in either case.  Then the code that checks the column properties for  
compatibility compares ColumnDef against ColumnDef (instead of  
ColumnDef against pg_attribute).  This makes the code more symmetric  
and easier to follow.  Also, later in MergeAttributes(), there is a  
similar but separate loop that merges the new local column definition  
with the combination of the inheritance parents established in the  
first loop.  That comparison is already ColumnDef-vs-ColumnDef.  With  
this change, both of these can use similar-looking logic.  (A future  
project might be to extract these two sets of code into a common  
routine that encodes all the knowledge of whether two column  
definitions are compatible.  But this isn't currently straightforward  
because we want to give different error messages in the two cases.)  
Furthermore, by avoiding the use of Form_pg_attribute here, we make it  
easier to make changes in the pg_attribute layout without having to  
worry about the local needs of tablecmds.c.  
  
Because MergeAttributes() is hugely long, it's sometimes hard to know  
where in the function you are currently looking.  To help with that, I  
also renamed some variables to make it clearer where you are currently  
looking.  The first look is "prev" vs. "new", the second loop is "inh"  
vs. "new".  
  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Fix s_lock_test compile

commit   : 46778187f5373f6072b58d5e4c298b775333a37c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:13:38 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:13:38 +0100    

Click here for diff

This is a mostly unused tool, but I discovered while nosing around the  
Makefile that it hasn't been kept in line with other changes.  Fix it.  
  
Backpatching doesn't appear to be necessary.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/s_lock.c

Silence compiler warning introduced in 1edb3b491b

commit   : fba2112b1569fd001a9e54dfdd73fd3cb8f16140    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 25 Jan 2024 17:11:27 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 25 Jan 2024 17:11:27 +0900    

Click here for diff

Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs48qEoe9Du5tuUxrkGQ6VC9oy+tQOORQ6jpob14-E1Z+jg@mail.gmail.com  

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

Add more LOG messages when starting and ending recovery from a backup

commit   : 1d35f705e191581784e9df89bb69b7867ac9c342    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Jan 2024 17:07:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Jan 2024 17:07:56 +0900    

Click here for diff

Three LOG messages are added in the recovery code paths, providing  
information that can be useful to track corruption issues depending on  
the state of the cluster, telling that:  
- Recovery has started from a backup_label.  
- Recovery is restarting from a backup start LSN, without a  
backup_label.  
- Recovery has completed from a backup.  
  
Author: Andres Freund  
Reviewed-by: David Steele, Laurenz Albe, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Allow to enable failover property for replication slots via SQL API.

commit   : c393308b69d229b664391ac583b9e07418d411b6    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 25 Jan 2024 12:15:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 25 Jan 2024 12:15:46 +0530    

Click here for diff

This commit adds the failover property to the replication slot. The  
failover property indicates whether the slot will be synced to the standby  
servers, enabling the resumption of corresponding logical replication  
after failover. But note that this commit does not yet include the  
capability to sync the replication slot; the subsequent commits will add  
that capability.  
  
A new optional parameter 'failover' is added to the  
pg_create_logical_replication_slot() function. We will also enable to set  
'failover' option for slots via the subscription commands in the  
subsequent commits.  
  
The value of the 'failover' flag is displayed as part of  
pg_replication_slots view.  
  
Author: Hou Zhijie, Shveta Malik, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda, Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Fix comment on gist_stratnum_btree

commit   : 86232a49a4373013056e8d38118339b8e7675ea0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 07:25:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 07:25:10 +0100    

Click here for diff

We give results for <, <=, =, >=, and >, not just =. Because why not?  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/btree_gist.c

Remove redundant HandleWalWriterInterrupts().

commit   : a044e61f1b97ceb80a198c0ae22c07c35dda39eb    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Jan 2024 12:50:08 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Jan 2024 12:50:08 +0900    

Click here for diff

Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()  
became the same as HandleMainLoopInterrupts(). So this commit removes  
HandleWalWriterInterrupts() and makes walwriter use  
HandleMainLoopInterrupts() for improved code simplicity.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy, Nathan Bossart  
Discussion: https://postgr.es/m/CAHGQGwHUtwCsB4DnqFLiMiVzjcA=zmeCKf9_pgQM-yJopydatw@mail.gmail.com  

M src/backend/postmaster/walwriter.c

jit: Require at least LLVM 10.

commit   : 820b5af73dcc6a5d0db6a98a62a6b859e5d107b6    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 15:23:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 15:23:04 +1300    

Click here for diff

Remove support for older LLVM versions.  The default on common software  
distributions will be at least LLVM 10 when PostgreSQL 17 ships.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com  

M config/llvm.m4
M configure
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h
M src/include/pg_config.h.in

Add progress reporting of skipped tuples during COPY FROM.

commit   : 729439607ad210dbb446e31754e8627d7e3f7dda    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 25 Jan 2024 10:57:41 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 25 Jan 2024 10:57:41 +0900    

Click here for diff

9e2d870119 enabled the COPY command to skip malformed data, however  
there was no visibility into how many tuples were actually skipped  
during the COPY FROM.  
  
This commit adds a new "tuples_skipped" column to  
pg_stat_progress_copy view to report the number of tuples that were  
skipped because they contain malformed data.  
  
Bump catalog version.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/d12fd8c99adcae2744212cb23feff6ed%40oss.nttdata.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/copyfrom.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Track LLVM 18 changes.

commit   : d282e88e50521a457fa1b36e55f43bac02a3167f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 10:37:35 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 10:37:35 +1300    

Click here for diff

A function was given a newly standard name from C++20 in LLVM 16.  Then  
LLVM 18 added a deprecation warning for the old name, and it is about to  
ship, so it's time to adjust that.  
  
Back-patch to all supported releases.  
  
Discussion: https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dHs0bAWmEMZ3B+iYHWKC4-ZA@mail.gmail.com  

M src/backend/jit/llvm/llvmjit_inline.cpp

Rename index "abc" in aggregates.sql

commit   : b91f918708283c1dc3dba8ff301f7d4b63c32e66    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 24 Jan 2024 21:41:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 24 Jan 2024 21:41:17 +0200    

Click here for diff

In order to prevent name collision with table "abc" in namespace.sql.  
  
Reported-by: Nathan Bossart  
Discussion: https://postgr.es/m/20240124173735.GA2708416%40nathanxps13  

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

Add temporal PRIMARY KEY and UNIQUE constraints

commit   : 46a0cd4cefb4d9b462d8cc4df5e7ecdd190bea92    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Jan 2024 15:43:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Jan 2024 15:43:41 +0100    

Click here for diff

Add WITHOUT OVERLAPS clause to PRIMARY KEY and UNIQUE constraints.  
These are backed by GiST indexes instead of B-tree indexes, since they  
are essentially exclusion constraints with = for the scalar parts of  
the key and && for the temporal part.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/Makefile
A contrib/btree_gist/expected/without_overlaps.out
M contrib/btree_gist/meson.build
A contrib/btree_gist/sql/without_overlaps.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/gist/gistutil.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/access/gist.h
M src/include/catalog/catversion.h
M src/include/catalog/index.h
M src/include/catalog/pg_constraint.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
A src/test/regress/expected/without_overlaps.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/without_overlaps.sql

Improve notation of BuiltinTrancheNames

commit   : 74a73063106583b1f49274a2cd1df42e35107361    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jan 2024 15:01:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jan 2024 15:01:30 +0100    

Click here for diff

Use C99 designated initializer syntax for array elements, instead of  
writing the position in a comment.  This is less verbose and much more  
readable.  Akin to cc150596341e.  
  
One disadvantage is that the BuiltinTrancheNames array now has a hole of  
51 NULLs -- previously, the array elements were shifted 51 elements  
 downward to avoid this.  This can be fixed by merging the  
IndividualLWLockNames array into BuiltinTrancheNames, which would occupy  
those 51 pointers, but because it requires some arguably ugly Meson  
hackery, it's left for later.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgbench: Add \syncpipeline

commit   : 94edfe250c6a200d2067b0debfe00b4122e9b11e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 16:55:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 16:55:19 +0900    

Click here for diff

This change adds a new meta-command called \syncpipeline to pgbench,  
able to send a sync message without flushing using the new libpq  
function PQsendPipelineSync().  
  
This meta-command is available within a block made of \startpipeline and  
\endpipeline.  
  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAO6_XqpcNhW6LZHLF-2NpPzdTbyMm4-RVkr3+AP5cOKSm9hrWA@mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Refactor code used by jsonpath executor to fetch variables

commit   : faa2b953ba3be0fac9af614ac14e34cf3a0a2c46    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:36 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:36 +0900    

Click here for diff

Currently, getJsonPathVariable() directly extracts a named  
variable/key from the source Jsonb value.  This commit puts that  
logic into a callback function called by getJsonPathVariable().  
Other implementations of the callback may accept different forms  
of the source value(s), for example, a List of values passed from  
outside jsonpath_exec.c.  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

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

Adjust populate_record_field() to handle errors softly

commit   : 1edb3b491bee373bdfcbfc1c2707b5428c2023b9    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:28 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:28 +0900    

Click here for diff

This adds a Node *escontext parameter to it and a bunch of functions  
downstream to it, replacing any ereport()s in that path by either  
errsave() or ereturn() as appropriate.  This also adds code to those  
functions where necessary to return early upon encountering a soft  
error.  
  
The changes here are mainly intended to suppress errors in the  
functions of jsonfuncs.c.  Functions in any external modules, such as  
arrayfuncs.c, that those functions may in turn call are not changed  
here based on the assumption that the various checks in jsonfuncs.c  
functions should ensure that only values that are structurally valid  
get passed to the functions in those external modules.  An exception  
is made for domain_check() to allow handling domain constraint  
violation errors softly.  
  
For testing, this adds a function jsonb_populate_record_valid(),  
which returns true if jsonb_populate_record() would finish without  
causing an error for the provided JSON object, false otherwise.  Note  
that jsonb_populate_record() internally calls populate_record(),  
which in turn uses populate_record_field().  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/utils/builtins.h
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Add soft error handling to some expression nodes

commit   : aaaf9449ec6be62cb0d30ed3588dc384f56274bf    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:22 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:22 +0900    

Click here for diff

This adjusts the code for CoerceViaIO and CoerceToDomain expression  
nodes to handle errors softly.  
  
For CoerceViaIo, this adds a new ExprEvalStep opcode  
EEOP_IOCOERCE_SAFE, which is implemented in the new accompanying  
function ExecEvalCoerceViaIOSafe().  The only difference from  
EEOP_IOCOERCE's inline implementation is that the input function  
receives an ErrorSaveContext via the function's  
FunctionCallInfo.context, which it can use to handle errors softly.  
  
For CoerceToDomain, this simply entails replacing the ereport() in  
ExecEvalConstraintNotNull() and ExecEvalConstraintCheck() by  
errsave() passing it the ErrorSaveContext passed in the expression's  
ExprEvalStep.  
  
In both cases, the ErrorSaveContext to be used is passed by setting  
ExprState.escontext to point to it before calling ExecInitExprRec()  
on the expression tree whose errors are to be handled softly.  
  
Note that there's no functional change as of this commit as no call  
site of ExecInitExprRec() has been changed.  This is intended for  
implementing new SQL/JSON expression nodes in future commits.  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h

Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

commit   : bb812ab0917e153f11bf449d7cb996815c07e387    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 14:20:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 14:20:01 +0900    

Click here for diff

This command, when used to add a column on a parent table with a complex  
inheritance tree, tried to update multiple times the same tuple in  
pg_attribute for a child table when incrementing attinhcount, causing  
failures with "tuple already updated by self" because of a missing  
CommandCounterIncrement() between two updates.  
  
This exists for a rather long time, so backpatch all the way down.  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix crash in autoprewarm.

commit   : bcd5b4bcbefc8b99be3678cf9c6c990a0c28f68e    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 23 Jan 2024 14:20:14 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 23 Jan 2024 14:20:14 -0600    

Click here for diff

Commit abb0b4fc03 moved the shared state for autoprewarm to a  
dynamic shared memory (DSM) segment, but it left apw_detach_shmem()  
in the on_shmem_exit callback list for the autoprewarm leader  
process.  This is a problem because shmem_exit() detaches all the  
DSM segments prior to calling the on_shmem_exit callbacks, thus  
producing segfaults in the exit path for the autoprewarm leader  
process.  
  
To fix, move apw_detach_shmem() to the before_shmem_exit callback  
list.  This commit also adds a check to pg_prewarm's test that the  
server shut down normally.  It might be worth making this a common  
check for all shutdowns in TAP tests, but that is left as a future  
exercise.  
  
Reported-by: Andres Freund  
Reviewed-by: Andres Freund, Álvaro Herrera  
Discussion: https://postgr.es/m/20240122204117.swton324xcoodnyi%40awork3.anarazel.de  

M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/t/001_basic.pl

Support shared libraries on Android (using make)

commit   : 79b03dbb3304539c6599593397c6a6b63b6a6ad9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:37:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:37:49 +0100    

Click here for diff

While the rest of the make build system maps Android to Linux, Android  
uses unversioned shared libraries (like "libpq.so").  This patch makes  
it so.  (Meson already supported it.)  
  
Reported-by: Matthias Kuhn <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M src/Makefile.shlib

meson: Map host_system android to linux

commit   : f4447af5b1a644af89e065410cdb12fe776cac47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:07:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:07:05 +0100    

Click here for diff

This appears to be what is missing to support builds on Android (with  
meson).  
  
Author: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M meson.build

Fix makefiles for newly added files

commit   : 6eb6086faa3842c2a38a1ee2f97bf9a42ce27610    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 16:33:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 16:33:26 +0100    

Click here for diff

The new files added in 9b1a6f50b9 need to be mentioned in a few more  
places in the makefiles.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1rSAY2-002hIk-4y%40gemulon.postgresql.org  

M src/include/Makefile

doc: Add acronym and glossary term for Access Method

commit   : 68387f9bdc82a56bf56945da3883a993bc40e2a5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 23 Jan 2024 13:20:15 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 23 Jan 2024 13:20:15 +0100    

Click here for diff

AM was used throughout the documentation to denote Access Method, but  
the acronym was not described.  This adds an acronym entry as well as  
a glossary term which the acronym links to.  Each page which describe  
AMs have the first occurrence with <acronym> markup.  
  
Reported-by: [email protected]  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/tableam.sgml

meson: portname was set too early

commit   : 4b4b3467ee36d11b6bf791731532ab962b0379be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 12:15:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 12:15:21 +0100    

Click here for diff

portname is set to host_system, but host_system might still be changed  
later in the file.  As a consequence, platforms where host_system is  
changed later wouldn't find some of their platform-specific files  
(driven by portname), and the build would fail.  Move the assignment  
of portname further down after the last change of host_system (but  
before further overriding assignments to portname).  
  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M meson.build

Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

commit   : 21ef4d4d897563adb2f7920ad53b734950f1e0a4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jan 2024 10:38:07 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jan 2024 10:38:07 +0200    

Click here for diff

This reverts commit 728f86fec65537eade8d9e751961782ddb527934.  
  
The signal handling was a few bricks shy of a load in that commit,  
which made the walreceiver non-responsive to SIGTERM while it was  
waiting for the connection to be established. That prevented a standby  
from being promoted.  
  
Since it was non-essential refactoring, let's revert it to make v16  
work the same as earlier releases. I reverted it in 'master' too, to  
keep the branches in sync. The refactoring was a good idea as such,  
but it needs a bit more work. Once we have developed a complete patch  
with this issue fixed, let's re-apply that to 'master'.  
  
Reported-by: Kyotaro Horiguchi  
Backpatch-through: 16  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Generate syscache info from catalog files

commit   : 9b1a6f50b91dca6610932650c8c81a3c924259f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 07:13:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 07:13:38 +0100    

Click here for diff

Add a new genbki macros MAKE_SYSCACHE that specifies the syscache ID  
macro, the underlying index, and the number of buckets.  From that, we  
can generate the existing tables in syscache.h and syscache.c via  
genbki.pl.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/.gitignore
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/backend/utils/cache/syscache.c
M src/include/catalog/.gitignore
M src/include/catalog/genbki.h
M src/include/catalog/meson.build
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/utils/syscache.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Improve stability of recovery test 035_standby_logical_decoding

commit   : 46d8587b504170ca14f064890bc7ccbbd7523f81    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 14:46:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 14:46:01 +0900    

Click here for diff

This commit tweaks a couple of things in 035_standby_logical_decoding to  
hopefully stabilize it:  
- Autovacuum is now disabled, as it could hold a global xmin with a  
transaction.  
- Conflicts are generated with command sequences that removed rows (on  
catalogs, shared or non-shared, or just plain relations) followed by a  
VACUUM.  This was unstable because these did not check that the horizon  
moved between the SQL commands and the VACUUM.  The logic is refactored  
as follows, to ensure that VACUUM removes dead rows before testing for  
slot invalidation on a standby (idea suggested by Andres Freund):  
-- Grab the current horizon.  
-- Launch SQL commands removing rows.  
-- Check that the snapshot horizon has been updated.  
-- Launch VACUUM on the relation whose rows have been removed by the  
first step.  
  
Note that there are still some issues because of standby snapshot WAL  
records generated by the bgwriter, but this makes the test much more  
stable.  
  
Per reports from buildfarm members dikkop and skink, with analysis and  
tests from Alexander Lakhin.  
  
While on it, fix a couple of incorrect comments.  
  
Author: Bertrand Drouvot  
Reviewed-by: Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/OSZPR01MB6310ED3CEDB531BCEDBC6AF2FD479@OSZPR01MB6310.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Add better handling of redundant IS [NOT] NULL quals

commit   : b262ad440edecda0b1aba81d967ab560a83acb8a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 23 Jan 2024 18:09:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 23 Jan 2024 18:09:18 +1300    

Click here for diff

Until now PostgreSQL has not been very smart about optimizing away IS  
NOT NULL base quals on columns defined as NOT NULL.  The evaluation of  
these needless quals adds overhead.  Ordinarily, anyone who came  
complaining about that would likely just have been told to not include  
the qual in their query if it's not required.  However, a recent bug  
report indicates this might not always be possible.  
  
Bug 17540 highlighted that when we optimize Min/Max aggregates the IS NOT  
NULL qual that the planner adds to make the rewritten plan ignore NULLs  
can cause issues with poor index choice.  That particular case  
demonstrated that other quals, especially ones where no statistics are  
available to allow the planner a chance at estimating an approximate  
selectivity for can result in poor index choice due to cheap startup paths  
being prefered with LIMIT 1.  
  
Here we take generic approach to fixing this by having the planner check  
for NOT NULL columns and just have the planner remove these quals (when  
they're not needed) for all queries, not just when optimizing Min/Max  
aggregates.  
  
Additionally, here we also detect IS NULL quals on a NOT NULL column and  
transform that into a gating qual so that we don't have to perform the  
scan at all.  This also works for join relations when the Var is not  
nullable by any outer join.  
  
This also helps with the self-join removal work as it must replace  
strict join quals with IS NOT NULL quals to ensure equivalence with the  
original query.  
  
Author: David Rowley, Richard Guo, Andy Fan  
Reviewed-by: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAApHDvqg6XZDhYRPz0zgOcevSMo0d3vxA9DvHrZtKfqO30WTnw@mail.gmail.com  
Discussion: https://postgr.es/m/17540-7aa1855ad5ec18b4%40postgresql.org  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/planmain.h
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/join.out
A src/test/regress/expected/predicate.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/predicate.sql

ci: Enable injection points in builds

commit   : 183b6f73b04e41cd8468eab74ab191602c66617b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 12:01:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 12:01:18 +0900    

Click here for diff

--enable-injection-points and -Dinjection_points=true are now given to  
the commands triggered by the tasks where assertions are enabled,  
providing coverage for injection points or any test using them.  
  
Author: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.tasks.yml

Fix possible NULL pointer dereference in GetNamedDSMSegment().

commit   : 4372adfa24f2f5ddc587317d634b5389bd764106    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 22 Jan 2024 20:44:38 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 22 Jan 2024 20:44:38 -0600    

Click here for diff

GetNamedDSMSegment() doesn't check whether dsm_attach() returns  
NULL, which creates the possibility of a NULL pointer dereference  
soon after.  To fix, emit an ERROR if dsm_attach() returns NULL.  
This shouldn't happen, but it would be nice to avoid a segfault if  
it does.  In passing, tidy up the surrounding code.  
  
Reported-by: Tom Lane  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/3348869.1705854106%40sss.pgh.pa.us  

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

Fix ERROR message in injection_point.c

commit   : cdd863480c27b406ac14e94f1fe122b98ea562b4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 10:45:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 10:45:00 +0900    

Click here for diff

This commit fixes an error message that failed to show the correct  
function and library names when a function cannot be loaded.  
  
While on it, adjust the call to load_external_function() so as this  
ERROR can be reached, by making load_external_function() return NULL  
rather than fail if a function cannot be found for a given injection  
point.  
  
Thinkos in d86d20f0ba79.  

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

Fix two memcpy() bugs in the new injection point code

commit   : 0eb23285a2579591c09a591e5a52829f65665341    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Jan 2024 20:55:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Jan 2024 20:55:45 +0200    

Click here for diff

1. The memcpy()s in InjectionPointAttach() would copy garbage from  
beyond the end of input string to the buffer in shared memory. You  
won't usually notice, but if there is not enough valid mapped memory  
beyond the end of the string, the read of unmapped memory will  
segfault. This was flagged by the Cirrus CI build with address  
sanitizer enabled.  
  
2. The memcpy() in injection_point_cache_add() failed to copy the NULL  
terminator.  
  
Discussion: https://www.postgresql.org/message-id/0615a424-b726-4157-afa7-4245629f9512%40iki.fi  

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

Abort pgbench if script end is reached with an open pipeline

commit   : 49f7c6c44a5f6a7f7b39d140e490c9c627511893    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:48:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:48:30 +0100    

Click here for diff

When a pipeline is opened with \startpipeline and not closed, pgbench  
will either error on the next transaction with a "already in pipeline  
mode" error or successfully end if this was the last transaction --  
despite not sending anything that was piped in the pipeline.  
  
Make it an error to reach end of script is reached while there's an  
open pipeline.  
  
Backpatch to 14, where pgbench got support for pipelines.  
  
Author: Anthonin Bonnefoy <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Test EXPLAIN (FORMAT JSON) ... XMLTABLE

commit   : 752533d40fd50de0b09d4b956cc32c38f5df2f05    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:14:19 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:14:19 +0100    

Click here for diff

Also, add an alias to the XMLTABLE expression in an existing test.  This  
covers some code in explain.c that wasn't previously covered.  
  
I patched xml_2.out blindly :-(  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make documentation builds reproducible

commit   : b0f0a9432d0b6f53634a96715f2666f6d4ea25a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2024 10:41:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2024 10:41:33 +0100    

Click here for diff

Currently, the documentation builds are not fully reproducible (in the  
sense of https://reproducible-builds.org/).  A fix is available  
upstream (https://github.com/docbook/xslt10-stylesheets/issues/54) but  
not released.  This commit patches the upstream fix into our  
customization layer.  
  
This patch addresses both the HTML and the FO output.  The man output  
is already reproducible.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Re-disallow Memoize for parameterized nested loops with join filters

commit   : 2bcf0785cd1080b85f0d2ccd595b195970730491    
  
author   : David Rowley <[email protected]>    
date     : Mon, 22 Jan 2024 22:45:02 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 22 Jan 2024 22:45:02 +1300    

Click here for diff

This was previously fixed in 9e215378d but got broken again as a result  
of 2489d76c4.  It seems that commit causes ppi_clauses to contain  
duplicate clauses and it's no longer safe to check the list_length of  
that list to determine if there are join conditions other than what's  
mentioned in ppi_clauses.  
  
Here we adjust the check to count the distinct rinfo_serial mentioned in  
ppi_clauses.  We expect that extra->restrictlist won't have duplicate  
rinfo_serials.  
  
Reported-by: Amadeo Gallardo  
Author: Richard Guo  
Discussion: https://postgr.es/m/CADFREbW-BLJd7-a5J%2B5wjVumeFG1ByXiSOFzMtkmY_SDWckTxw%40mail.gmail.com  
Backpatch-through: 16, where 2489d76c4 was introduced.  

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

Fix some typos

commit   : b199eb89c67d737ced55721590f7fc8ff585e837    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:55:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:55:25 +0900    

Click here for diff

Author: Yongtao Huang  
Discussion: https://postgr.es/m/CAOe1Go1F99o5JsphtXdDC5bxm7AzetU8q3AxLh4AAVGKu1AzEQ@mail.gmail.com  

M src/backend/access/index/indexam.c
M src/backend/commands/explain.c
M src/backend/replication/logical/worker.c
M src/backend/utils/activity/wait_event.c
M src/test/modules/test_ginpostinglist/expected/test_ginpostinglist.out
M src/test/modules/test_ginpostinglist/sql/test_ginpostinglist.sql

Add test module injection_points

commit   : 49cd2b93d7dbceefdf9a71cc301d284a2dd234c3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:32:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:32:28 +0900    

Click here for diff

This provides basic coverage for injection points within a single  
process, while providing some callbacks that can be used for other  
tests.  There are plans to extend this module later with more  
advanced capabilities for tests.  
  
Author: Michael Paquier, with comment fixes from Ashutosh Bapat.  
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip  
Kumar, Amul Sul, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/injection_points/.gitignore
A src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/injection_points.out
A src/test/modules/injection_points/injection_points–1.0.sql
A src/test/modules/injection_points/injection_points.c
A src/test/modules/injection_points/injection_points.control
A src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/sql/injection_points.sql
M src/test/modules/meson.build

Add backend support for injection points

commit   : d86d20f0ba79451f19782dbb5fbf206746aaffd1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 10:15:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 10:15:50 +0900    

Click here for diff

Injection points are a new facility that makes possible for developers  
to run custom code in pre-defined code paths.  Its goal is to provide  
ways to design and run advanced tests, for cases like:  
- Race conditions, where processes need to do actions in a controlled  
ordered manner.  
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force  
recovery, etc.  
- Arbitrary sleeps.  
  
This implements some basics, and there are plans to extend it more in  
the future depending on what's required.  Hence, this commit adds a set  
of routines in the backend that allows developers to attach, detach and  
run injection points:  
- A code path calling an injection point can be declared with the macro  
INJECTION_POINT(name).  
- InjectionPointAttach() and InjectionPointDetach() to respectively  
attach and detach a callback to/from an injection point.  An injection  
point name is registered in a shmem hash table with a library name and a  
function name, which will be used to load the callback attached to an  
injection point when its code path is run.  
  
Injection point names are just strings, so as an injection point can be  
declared and run by out-of-core extensions and modules, with callbacks  
defined in external libraries.  
  
This facility is hidden behind a dedicated switch for ./configure and  
meson, disabled by default.  
  
Note that backends use a local cache to store callbacks already loaded,  
cleaning up their cache if a callback has found to be removed on a  
best-effort basis.  This could be refined further but any tests but what  
we have here was fine with the tests I've written while implementing  
these backend APIs.  
  
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.  
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip  
Kumar, Amul Sul, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/installation.sgml
M doc/src/sgml/xfunc.sgml
M meson.build
M meson_options.txt
M src/Makefile.global.in
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/meson.build
M src/include/pg_config.h.in
A src/include/utils/injection_point.h
M src/makefiles/meson.build
M src/tools/pgindent/typedefs.list

Fix table name collision in tests in 0452b461bc

commit   : c03d91d9be378975bcdbfa3e5d40e17288e6f13f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 23:26:41 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 23:26:41 +0200    

Click here for diff

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

Explore alternative orderings of group-by pathkeys during optimization.

commit   : 0452b461bc405e6d35d8a14c02813c15e28ae516    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:21:36 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:21:36 +0200    

Click here for diff

When evaluating a query with a multi-column GROUP BY clause, we can minimize  
sort operations or avoid them if we synchronize the order of GROUP BY clauses  
with the ORDER BY sort clause or sort order, which comes from the underlying  
query tree. Grouping does not imply any ordering, so we can compare  
the keys in arbitrary order, and a Hash Agg leverages this. But for Group Agg,  
we simply compared keys in the order specified in the query. This commit  
explores alternative ordering of the keys, trying to find a cheaper one.  
  
The ordering of group keys may interact with other parts of the query, some of  
which may not be known while planning the grouping. For example, there may be  
an explicit ORDER BY clause or some other ordering-dependent operation higher up  
in the query, and using the same ordering may allow using either incremental  
sort or even eliminating the sort entirely.  
  
The patch always keeps the ordering specified in the query, assuming the user  
might have additional insights.  
  
This introduces a new GUC enable_group_by_reordering so that the optimization  
may be disabled if needed.  
  
Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru  
Author: Andrei Lepikhov, Teodor Sigaev  
Reviewed-by: Tomas Vondra, Claudio Freire, Gavin Flower, Dmitry Dolgov  
Reviewed-by: Robert Haas, Pavel Borisov, David Rowley, Zhihong Yu  
Reviewed-by: Tom Lane, Alexander Korotkov, Richard Guo, Alena Rybakina  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.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/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/aggregates.sql
M src/tools/pgindent/typedefs.list

Generalize the common code of adding sort before processing of grouping

commit   : 7ab80ac1caf9f48064190802e1068ef89e2883c4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:19:47 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:19:47 +0200    

Click here for diff

Extract the repetitive code pattern into a new function make_ordered_path().  
  
Discussion: https://postgr.es/m/CAPpHfdtzaVa7S4onKy3YvttF2rrH5hQNHx9HtcSTLbpjx%2BMJ%2Bw%40mail.gmail.com  
Author: Andrei Lepikhov  

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

Add hint about not qualifying UPDATE...SET target with relation name.

commit   : 58447e31890ace0d552a4bf693744bef3a5335e6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 17:54:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 17:54:14 -0500    

Click here for diff

Target columns in UPDATE ... SET must not be qualified with the target  
table; we disallow this because it'd create ambiguity about which name  
is the column name in case of field-qualified names.  However, newbies  
have been seen to expect that they could qualify a target name just  
like other names.  The error message when they do is confusing:  
"column "foo" of relation "foo" does not exist".  To improve matters,  
issue a HINT if the invalid name is qualified and matches the  
relation's alias.  
  
James Coleman (editorialized a bit by me)  
  
Discussion: https://postgr.es/m/CAAaqYe8S2Qa060UV-YF5GoSd5PkEhLV94x-fEi3=TOtpaXCV+w@mail.gmail.com  

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

Add planner support functions for range operators <@ and @>.

commit   : 075df6b2080b13e0a5adc88737b7c24417a873c1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 13:57:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 13:57:54 -0500    

Click here for diff

These support functions will transform expressions with constant  
range values into direct comparisons on the range bound values,  
which are frequently better-optimizable.  The transformation is  
skipped however if it would require double evaluation of a  
volatile or expensive element expression.  
  
Along the way, add the range opfamily OID to range typcache entries,  
since load_rangetype_info has to compute that anyway and it seems  
silly to duplicate the work later.  
  
Kim Johan Andersson and Jian He, reviewed by Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/cache/typcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/typcache.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Teach autoprewarm to use the dynamic shared memory registry.

commit   : abb0b4fc03fcf5a0ca786bd88c357bf9213aa6e1    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:43:59 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:43:59 -0600    

Click here for diff

Besides showcasing the DSM registry, this prevents pg_prewarm from  
stealing from the main shared memory segment's extra buffer space  
when autoprewarm_start_worker() and autoprewarm_dump_now() are used  
without loading the module via shared_preload_libraries.  
  
Suggested-by: Michael Paquier  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M contrib/pg_prewarm/autoprewarm.c

Introduce the dynamic shared memory registry.

commit   : 8b2bcf3f287c79eaebf724cba57e5ff664b01e06    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:24:36 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:24:36 -0600    

Click here for diff

Presently, the most straightforward way for a shared library to use  
shared memory is to request it at server startup via a  
shmem_request_hook, which requires specifying the library in  
shared_preload_libraries.  Alternatively, the library can create a  
dynamic shared memory (DSM) segment, but absent a shared location  
to store the segment's handle, other backends cannot use it.  This  
commit introduces a registry for DSM segments so that these other  
backends can look up existing segments with a library-specified  
string.  This allows libraries to easily use shared memory without  
needing to request it at server startup.  
  
The registry is accessed via the new GetNamedDSMSegment() function.  
This function handles allocating the segment and initializing it  
via a provided callback.  If another backend already created and  
initialized the segment, it simply attaches the segment.  
GetNamedDSMSegment() locks the registry appropriately to ensure  
that only one backend initializes the segment and that all other  
backends just attach it.  
  
The registry itself is comprised of a dshash table that stores the  
DSM segment handles keyed by a library-specified string.  
  
Reviewed-by: Michael Paquier, Andrei Lepikhov, Nikita Malakhov, Robert Haas, Bharath Rupireddy, Zhang Mingli, Amul Sul  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/Makefile
A src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event_names.txt
A src/include/storage/dsm_registry.h
M src/include/storage/lwlock.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_dsm_registry/.gitignore
A src/test/modules/test_dsm_registry/Makefile
A src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
A src/test/modules/test_dsm_registry/meson.build
A src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
A src/test/modules/test_dsm_registry/test_dsm_registry–1.0.sql
A src/test/modules/test_dsm_registry/test_dsm_registry.c
A src/test/modules/test_dsm_registry/test_dsm_registry.control
M src/tools/pgindent/typedefs.list

doc: Reorganize section for shared memory and LWLocks.

commit   : 964152c476f25ada4c5832a014999ec2d2980358    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 11:18:32 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 11:18:32 -0600    

Click here for diff

Presently, this section meanders through a few different features,  
and the text itself is terse.  This commit attempts to improve  
matters by splitting the section into smaller sections and by  
expanding the text for clarity.  This is preparatory work for a  
follow-up commit that will introduce a way for libraries to use  
shared memory without needing to request it at startup time.  
  
Reviewed-by: Aleksander Alekseev, Bharath Rupireddy, Abhijit Menon-Sen  
Discussion: https://postgr.es/m/20240112041430.GA3557928%40nathanxps13  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M doc/src/sgml/xfunc.sgml

Fix name collision in c64086b79dba

commit   : 448a3331d9ab3094183cea59f601b6f2f7f7c48a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 18:13:33 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 18:13:33 +0200    

Click here for diff

Reported-by: Erik Rijkers, Tom Lane  
Discussion: https://postgr.es/m/E1rQqeS-002A0s-Qm%40gemulon.postgresql.org  

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

doc: Update compiler for FreeBSD specific instructions

commit   : b2a296b0cf731b5a26a784cefaed7f013ed3d6e7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Jan 2024 16:27:27 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Jan 2024 16:27:27 +0100    

Click here for diff

FreeBSD has since v13 switched to Clang from GCC, so update our  
instructions to cc instead of gcc to reflect that.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/CAJR80-xzR49jEkAC98Yo-wuSdFDV2=2H4j9Z2AukSVU=-UpynA@mail.gmail.com  

M doc/src/sgml/dfunc.sgml

Reorder actions in ProcArrayApplyRecoveryInfo()

commit   : c64086b79dbad19e4ee0af8d19e835111aa87bd5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 17:19:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 17:19:17 +0200    

Click here for diff

Since 5a1dfde8334b, 2PC filenames use FullTransactionId.  Thus, it needs to  
convert TransactionId to FullTransactionId in StandbyTransactionIdIsPrepared()  
using TransamVariables->nextXid.  However, ProcArrayApplyRecoveryInfo()  
first releases locks with usage StandbyTransactionIdIsPrepared(), then advances  
TransamVariables->nextXid.  This sequence of actions could cause errors.  
This commit makes ProcArrayApplyRecoveryInfo() advance  
TransamVariables->nextXid before releasing locks.  
  
Reported-by: Thomas Munro, Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGLj_ve1_pNAnxwYU9rDcv7GOhsYXJt7jMKSA%3D5-6ss-Cw%40mail.gmail.com  
Discussion: https://postgr.es/m/Zadp9f4E1MYvMJqe%40paquier.xyz  

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

Add stratnum GiST support function

commit   : 6db4598fcb82a87a683c4572707e522504830a2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2024 15:41:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2024 15:41:44 +0100    

Click here for diff

This is support function 12 for the GiST AM and translates  
"well-known" RT*StrategyNumber values into whatever strategy number is  
used by the opclass (since no particular numbers are actually  
required).  We will use this to support temporal PRIMARY  
KEY/UNIQUE/FOREIGN KEY/FOR PORTION OF functionality.  
  
This commit adds two implementations, one for internal GiST opclasses  
(just an identity function) and another for btree_gist opclasses.  It  
updates btree_gist from 1.7 to 1.8, adding the support function for  
all its opclasses.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.7–1.8.sql
M contrib/btree_gist/btree_gist.c
M contrib/btree_gist/btree_gist.control
A contrib/btree_gist/expected/stratnum.out
M contrib/btree_gist/meson.build
A contrib/btree_gist/sql/stratnum.sql
M doc/src/sgml/gist.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvalidate.c
M src/include/access/gist.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Rename COPY option from SAVE_ERROR_TO to ON_ERROR

commit   : b725b7eec431f7394d63abe621170efe3fcdcda4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 15:08:40 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 15:08:40 +0200    

Click here for diff

The option names now are "stop" (default) and "ignore".  The future options  
could be "file 'filename.log'" and "table 'tablename'".  
  
Discussion: https://postgr.es/m/20240117.164859.2242646601795501168.horikyota.ntt%40gmail.com  
Author: Jian He  
Reviewed-by: Atsushi Torikoshi  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list

Fixed misspelled byteswap function for big endian machines

commit   : dd0a0cfc81fecacf2aed41b9eb138f850e43aab6    
  
author   : John Naylor <[email protected]>    
date     : Fri, 19 Jan 2024 13:26:18 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 19 Jan 2024 13:26:18 +0700    

Click here for diff

Per members lora and mamba  

M src/include/common/hashfn_unstable.h

Add optimized C string hashing

commit   : 0aba2554409ee3251d7558567edd114d8ed36dcc    
  
author   : John Naylor <[email protected]>    
date     : Tue, 16 Jan 2024 16:32:48 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 16 Jan 2024 16:32:48 +0700    

Click here for diff

Given an already-initialized hash state and a NUL-terminated string,  
accumulate the hash of the string into the hash state and return the  
length for the caller to (optionally) save for the finalizer. This  
avoids a strlen call.  
  
If the string pointer is aligned, we can use a word-at-a-time  
algorithm for NUL lookahead. The aligned case is only used on 64-bit  
platforms, since it's not worth the extra complexity for 32-bit.  
  
Handling the tail of the string after finishing the word-wise loop  
was inspired by NetBSD's strlen(), but no code was taken since that  
is written in assembly language.  
  
As demonstration, use this in the search path cache. This brings the  
general case performance closer to the special case optimization done  
in commit a86c61c9ee. There are other places that could benefit, but  
that is left for future work.  
  
Jeff Davis and John Naylor  
Reviewed by Heikki Linnakangas, Jian He, Junwang Zhao  
  
Discussion: https://postgr.es/m/3820f030fd008ff14134b3e9ce5cc6dd623ed479.camel%40j-davis.com  
Discussion: https://postgr.es/m/b40292c99e623defe5eadedab1d438cf51a4107c.camel%40j-davis.com  

M src/backend/catalog/namespace.c
M src/include/common/hashfn_unstable.h

Add inline incremental hash functions for in-memory use

commit   : e97b672c88f6e5938a2b81021bd4b590b013976f    
  
author   : John Naylor <[email protected]>    
date     : Mon, 27 Nov 2023 17:03:38 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 27 Nov 2023 17:03:38 +0700    

Click here for diff

It can be useful for a hash function to expose separate initialization,  
accumulation, and finalization steps.  In particular, this is useful  
for building inline hash functions for simplehash.  Instead of trying  
to whack around hash_bytes while maintaining its current behavior on  
all platforms, we base this work on fasthash (MIT licensed) which  
is simple, faster than hash_bytes for inputs over 12 bytes long,  
and also passes the hash function testing suite SMHasher.  
  
The fasthash functions have been reimplemented using our added-on  
incremental interface to validate that this method will still give  
the same answer, provided we have the input length ahead of time.  
  
This functionality lives in a new header hashfn_unstable.h. The name  
implies we have the freedom to change things across versions that  
would be unacceptable for our other hash functions that are used for  
e.g. hash indexes and hash partitioning. As such, these should only  
be used for in-memory data structures like hash tables. There is also  
no guarantee of being independent of endianness or pointer size.  
  
As demonstration, use fasthash for pgstat_hash_hash_key.  Previously  
this called the 32-bit murmur finalizer on the three elements,  
then joined them with hash_combine(). The new function is simpler,  
faster and takes up less binary space. While the collision and bias  
behavior were almost certainly fine with the previous coding, now we  
have objective confidence of that.  
  
There are other places that could benefit from this, but that is left  
for future work.  
  
Reviewed by Jeff Davis, Heikki Linnakangas, Jian He, Junwang Zhao  
Credit to Andres Freund for the idea  
  
Discussion: https://postgr.es/m/20231122223432.lywt4yz2bn7tlp27%40awork3.anarazel.de  

A src/include/common/hashfn_unstable.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

psql: Add ignore_slash_options in bind's inactive branch

commit   : 04c0897d3bcafe4ca61967d5ab1b5669f3cbe80b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 14:18:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 14:18:20 +0900    

Click here for diff

All commands accepting arguments, handling them with OT_NORMAL, OT_SQLID  
or OT_SQLIDHACK, should call ignore_slash_options() in inactive branch  
to scan and discard extra arguments.  All the backslash commands that  
handle arguments do so, except \bind.  
  
This commit adds the missing ignore_slash_options to \bind's inactive  
branch.  This inconsistency is a logic bug, however the behavior happens  
to be unchanged as any extra arguments are discarded later in  
HandleSlashCmds(), so no backpatch is done.  
  
While on it, this adds \bind to the list of backslash commands where  
inactive \if branches are checked in the tests for psql.  
  
Reported-by: Jelte Fennema-Nio  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAGECzQR1+udGKz+FbHiCQ7CWDiF1fCGi2xYuvQUODdMAfJbaLA@mail.gmail.com  

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

Fix incorrect placeholder in walreceiver.c

commit   : 3ada0d2cae4d9d3e045c72e3ee0b37ccb6e13902    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 13:20:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 13:20:49 +0900    

Click here for diff

Author: Yongtao Huang  
Discussion: https://postgr.es/m/CAOe1Go3H7CgrSceO+HBhnoptk-mJhii-YT8D19CikKintjwumQ@mail.gmail.com  

M src/backend/replication/walreceiver.c

Improve some documentation about the bootstrap superuser.

commit   : d891dcc065a2b590102ec75121828fed97acf9ba    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 18 Jan 2024 21:39:51 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 18 Jan 2024 21:39:51 -0600    

Click here for diff

This commit adds some notes about the inability to remove superuser  
privileges from the bootstrap superuser.  This has been blocked  
since commit e530be2c5c, but it wasn't intended be a supported  
feature before that, either.  
  
In passing, change "bootstrap user" to "bootstrap superuser" in a  
couple places.  
  
Author: Yurii Rashkovskii  
Reviewed-by: Vignesh C, David G. Johnston  
Discussion: https://postgr.es/m/CA%2BRLCQzSx_eTC2Fch0EzeNHD3zFUcPvBYOoB%2BpPScFLch1DEQw%40mail.gmail.com  

M doc/src/sgml/glossary.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/commands/user.c

Fix buildfarm error from commit 5c31669058.

commit   : dd3ca8cbb0141f158545e9ecdd12c89279942e36    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jan 2024 14:59:59 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jan 2024 14:59:59 -0800    

Click here for diff

Skip test when not using unix domain sockets.  
  
Discussion: https://postgr.es/m/CALDaNm29-8OozsBWo9H6DN_Tb_3yA1QjRJput-KhaN8ncDJtJA@mail.gmail.com  
Backpatch-through: 16  

M src/test/subscription/t/027_nosuperuser.pl

Fix broken Bitmapset optimization in DiscreteKnapsack()

commit   : 4b310636439da432c473e0e85de661b3342bb745    
  
author   : David Rowley <[email protected]>    
date     : Fri, 19 Jan 2024 10:44:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 19 Jan 2024 10:44:36 +1300    

Click here for diff

Some code in DiscreteKnapsack() attempted to zero all words in a  
Bitmapset by performing bms_del_members() to delete all the members from  
itself before replacing those members with members from another set.  
When that code was written, this was a valid way to manipulate the set  
in such a way to save from palloc having to be called to allocate a new  
Bitmapset.  However, 00b41463c modified Bitmapsets so that an empty set is  
*always* represented as NULL and this breaks the optimization as the  
Bitmapset code will always pfree the memory when the set becomes empty.  
  
Since DiscreteKnapsack() has been coded to avoid as many unneeded  
allocations as possible, it seems risky to not fix this.  Here we add  
bms_replace_members() to effectively perform an in-place copy of another  
set, reusing the memory of the existing set, when possible.  
  
This got broken in v16, but no backpatch for now as there've been no  
complaints.  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvoTCBkBU2PJghNOFUiO0q=QP4WAWHi5sJP6_4=b2WodrA@mail.gmail.com  

M src/backend/lib/knapsack.c
M src/backend/nodes/bitmapset.c
M src/include/nodes/bitmapset.h

Fix plpgsql to allow new-style SQL CREATE FUNCTION as a SQL command.

commit   : 57b440ec115f57ff6e6a3f0df26063822e3123d2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2024 16:10:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2024 16:10:57 -0500    

Click here for diff

plpgsql fails on new-style CREATE FUNCTION/PROCEDURE commands within  
a routine or DO block, because make_execsql_stmt believes that a  
semicolon token always terminates a SQL command.  Now, that's actually  
been wrong since the day it was written, because CREATE RULE has long  
allowed multiple rule actions separated by semicolons.  But there are  
few enough people using multi-action rules that there was never an  
attempt to fix it.  New-style SQL functions, though, are popular.  
  
psql has this same problem of "does this semicolon really terminate  
the command?".  It deals with CREATE RULE by counting parenthesis  
nesting depth: a semicolon within parens doesn't end a command.  
Commits e717a9a18 and 029c5ac03 created a similar heuristic to count  
matching BEGIN/END pairs (but only within CREATEs, so as not to be  
fooled by plain BEGIN).  That's survived several releases now without  
trouble reports, so let's just absorb those heuristics into plpgsql.  
  
Per report from Samuel Dussault.  Back-patch to v14 where new-style  
SQL function syntax came in.  
  
Discussion: https://postgr.es/m/YT2PR01MB88552C3E9AD40A6C038774A781722@YT2PR01MB8855.CANPRD01.PROD.OUTLOOK.COM  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_gram.y
A src/pl/plpgsql/src/sql/plpgsql_misc.sql

Remove LVPagePruneState.

commit   : e313a611370410f4efe4e816767759870b69dfa6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 15:17:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 15:17:09 -0500    

Click here for diff

Commit cb970240f13df2b63f0410f81f452179a2b78d6f moved some code from  
lazy_scan_heap() to lazy_scan_prune(), and now some things that used to  
need to be passed back and forth are completely local to lazy_scan_prune().  
Hence, this struct is mostly obsolete.  The only thing that still  
needs to be passed back to the caller is has_lpdead_items, and that's  
also passed back by lazy_scan_noprune(), so do it the same way in both  
cases.  
  
Melanie Plageman, reviewed and slightly revised by me.  
  
Discussion: http://postgr.es/m/CAAKRu_aM=OL85AOr-80wBsCr=vLVzhnaavqkVPRkFBtD0zsuLQ@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/tools/pgindent/typedefs.list

Move VM update code from lazy_scan_heap() to lazy_scan_prune().

commit   : cb970240f13df2b63f0410f81f452179a2b78d6f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 14:44:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 14:44:57 -0500    

Click here for diff

Most of the output parameters of lazy_scan_prune() were being  
used to update the VM in lazy_scan_heap(). Moving that code into  
lazy_scan_prune() simplifies lazy_scan_heap() and requires less  
communication between the two.  
  
This change permits some further code simplification, but that  
is left for a separate commit.  
  
Melanie Plageman, reviewed by me.  
  
Discussion: http://postgr.es/m/CAAKRu_aM=OL85AOr-80wBsCr=vLVzhnaavqkVPRkFBtD0zsuLQ@mail.gmail.com  

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

Clarify language in incremental backup glossary entry.

commit   : 0a157a4d441586a0e590e2f8a3839114e01df4b7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:09:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:09:38 -0500    

Click here for diff

These changes were intended to be included in commit  
7b1dbf0a8d1d4e1e6d01a76dc45a3216e8a16d94, but I goofed.  

M doc/src/sgml/glossary.sgml

Optimize vacuuming of relations with no indexes.

commit   : c120550edb86b8e0d785063501c259e29aa80eb6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:03:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:03:42 -0500    

Click here for diff

If there are no indexes on a relation, items can be marked LP_UNUSED  
instead of LP_DEAD when pruning. This significantly reduces WAL  
volume, since we no longer need to emit one WAL record for pruning  
and a second to change the LP_DEAD line pointers thus created to  
LP_UNUSED.  
  
Melanie Plageman, reviewed by Andres Freund, Peter Geoghegan, and me  
  
Discussion: https://postgr.es/m/CAAKRu_bgvb_k0gKOXWzNKWHt560R0smrGe3E8zewKPs8fiMKkw%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

More documentation updates for incremental backup.

commit   : 7b1dbf0a8d1d4e1e6d01a76dc45a3216e8a16d94    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 09:25:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 09:25:28 -0500    

Click here for diff

Add new terms to glossary. Add a reference to walsummarizer  
to monitoring.sgml.  
  
Matthias van de Meent and Robert Haas  
  
Discussion: http://postgr.es/m/CAEze2WjhdVCqEe_qqEok3NA6DwUdOGSBjAxzmYdAqiaaH1uRcg@mail.gmail.com  

M doc/src/sgml/glossary.sgml
M doc/src/sgml/monitoring.sgml

Rework text in replication slots documentation

commit   : 27d04ed5310ad33dd3364322ae53ea685b28a8b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Jan 2024 11:30:53 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Jan 2024 11:30:53 +0100    

Click here for diff

This is cosmetic, so no backpatch.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Error message capitalisation

commit   : ed1e0a65127a61f7c9497aac6016324f250bc0e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 09:35:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 09:35:12 +0100    

Click here for diff

per style guidelines  
  
Author: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPtzstExQ4%3DvFH%2BWzZ4g4xEx2JA%3DqxussxOdxVEwJce6bw%40mail.gmail.com  

M contrib/pg_surgery/heap_surgery.c
M src/backend/commands/event_trigger.c
M src/backend/storage/file/fd.c
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix an issue in PostgreSQL::Test::Cluster:psql()

commit   : 686db12de3a01222de6bce56f40f4fb9259f7b37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 08:46:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 08:46:42 +0100    

Click here for diff

Due to the commit c5385929 which made all Perl warnings to fatal, use  
of PostgreSQL::Test::Cluster:psql() and safe_psql() with timeout  
started to fail with the following error:  
  
Use of uninitialized value $ret in bitwise and (&) at  
..src/test/perl/PostgreSQL/Test/Cluster.pm line 2015.  
  
Fix that by placing $ret conversion code in psql() in an if (defined  
$ret) block.  
  
With this change, the behavior of psql() becomes same as before, that  
is, the whole function returns undef on timeout, which is usefully  
different from returning 0.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org  

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

Improve handling of dropped partitioned indexes for REINDEX INDEX

commit   : 0ae3b466210316ebedbe123b64b46ac2dc1fc04f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 16:30:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 16:30:11 +0900    

Click here for diff

A REINDEX INDEX done on a partitioned index builds a list of the indexes  
to work on before processing its partitions in individual transactions.  
When combined with a DROP of the partitioned index, there was a window  
where it was possible to see some unexpected "could not open relation  
with OID", synonym of relation lookup error.  The code was robust enough  
to handle the case where the parent relation is missing, but not the  
case where an index would be gone missing.  
  
This is similar to 1d65416661bb.  
  
Support for REINDEX on partitioned relations has been introduced in  
a6642b3ae060, so backpatch down to 14.  
  
Author: Fei Changhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/catalog/index.c

Add try_index_open(), conditional variant of index_open()

commit   : 8013850c853db67ee753e5b730231cfad846b806    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 15:04:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 15:04:24 +0900    

Click here for diff

try_index_open() is able to open an index if its relkind fits, except  
that it would return NULL instead of generated an error if the relation  
does not exist.  This new routine will be used by an upcoming patch to  
make REINDEX on partitioned relations more robust when an index in a  
partition tree is dropped.  
  
Extracted from a larger patch by the same author.  
  
Author: Fei Changhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/access/index/indexam.c
M src/include/access/genam.h

seg: Add test "security" in meson.build

commit   : 2f35c14cfb3dadede883a7d8f458e5a15f13a97b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 10:12:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 10:12:44 +0900    

Click here for diff

Oversight in 681d9e4621aa where the test has been added.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M contrib/seg/meson.build

Remove the flaky check in event_trigger_login regression test

commit   : 4b885d01f9676f62d8b8156e45282c631181369f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 23:16:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 23:16:53 +0200    

Click here for diff

The query checks that pg_database.dathasloginevt is unset on connect when  
there are no event triggers.  However, unsetting this flag is implemented in  
a non-blocking way, so a concurrent autovacuum connection breaks this check.  
It doesn't seem we can do much with this, at least within a regression test.  
So, remove it.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/44807d19-81a6-3884-3e0f-22dd99aac3ed%40gmail.com  

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

Fix spelling in notice

commit   : 58fbbc9d683cc7a79a790fe9f17dd374c56445cc    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 22:59:09 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 22:59:09 +0200    

Click here for diff

Reported-by: Atsushi Torikoshi  
Discussion: https://postgr.es/m/762d7dd4d5aa9e5ecffec2ae6a255a28%40oss.nttdata.com  

M src/backend/commands/copyfrom.c

Fix incorrect comment on how BackendStatusArray is indexed

commit   : 2b53a462cff0074f5bf1675ad58ca95190c4bcd0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Jan 2024 15:44:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Jan 2024 15:44:10 +0200    

Click here for diff

The comment was copy-pasted from the call to ProcSignalInit() in  
AuxiliaryProcessMain(), which uses a similar scheme of having reserved  
slots for aux processes after MaxBackends slots for backends. However,  
ProcSignalInit() indexing starts from 1, whereas BackendStatusArray  
starts from 0. The code is correct, but the comment was wrong.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Backpatch-through: v14  

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

Close socket in case of errors in setting non-blocking

commit   : 7cfa154d15c4a98bea0cfe26b2c78094a094650f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Jan 2024 11:24:11 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Jan 2024 11:24:11 +0100    

Click here for diff

If configuring the newly created socket non-blocking fails we  
error out and return INVALID_SOCKET, but the socket that had  
been created wasn't closed. Fix by issuing closesocket in the  
errorpath.  
  
Backpatch to all supported branches.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://postgr.es/m/CAEudQApmU5CrKefH85VbNYE2y8H=-qqEJbg6RAPU65+vCe+89A@mail.gmail.com  
Backpatch-through: v12  

M src/backend/port/win32/socket.c

Fix description of DecodeInsert() in decode.c

commit   : 44ad5129ce19d22afe757a6b56e41eaa91304869    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 17:03:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 17:03:02 +0900    

Click here for diff

This incorrectly referred to deletes.  
  
Author: Yongtao Huang  
Reviewed-by: Richard Guo  
Description: https://postgr.es/m/CAOe1Go0Czgvo9eiDqeFpaABwJu=gBK6qjrYzZGZLn=tKDX8AUw@mail.gmail.com  

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

commit   : 061cc7eacac15c4bcd4447a238e16a6e0ea9c6bb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 15:53:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 15:53:59 +0900    

Click here for diff

These comments explained how these functions behave internally, and the  
equivalent is described in the documentation section dedicated to the  
pipeline mode of libpq.  Let's remove these comments, getting rid of the  
duplication with the docs.  
  
Reported-by: Álvaro Herrera  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Add support for parsing of large XML data (>= 10MB)

commit   : 2197d06224a14dba544e05e3df1efcca83bdd9ef    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 14:03:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 14:03:55 +0900    

Click here for diff

This commit adds XML_PARSE_HUGE to the libxml2 functions used in core  
for the parsing of XML objects, raising up the original limit of 10MB  
supported by libxml2.  
  
In most code paths of upstream, XML_MAX_TEXT_LENGTH (10^7) is the  
historical limit that gets upgraded to XML_MAX_HUGE_LENGTH (10^9) once  
XML_PARSE_HUGE is given to the parser calls.  These are still limited by  
any palloc() calls for text, up to 1GB.  
  
This offers the possibility to handle within the backend XML objects  
larger than 10MB in general, with also a higher depth limit.  This  
change affects the contrib module xml2, the xml data type and SQL/XML.  
  
Author: Dmitry Koval  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/utils/adt/xml.c

commit   : 65c5864d7fac46516f17ee89085e349a87ee5bd7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 08:53:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 08:53:16 +0900    

Click here for diff

Some functions are used in the tree and are currently marked as  
deprecated by upstream.  This commit refreshes the code to use the  
recommended functions, leading to the following changes:  
- xmlSubstituteEntitiesDefault() is gone, and needs to be replaced with  
XML_PARSE_NOENT for the paths doing the parsing.  
- xmlParseMemory() -> xmlReadMemory().  
  
These functions, as well as more functions setting global states, have  
been officially marked as deprecated by upstream in August 2022.  Their  
replacements exist since the 2001-ish area, as far as I have checked,  
so that should be safe.  
  
Author: Dmitry Koval  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c

Fix format specifier for NOTICE in copyfrom.c

commit   : 8ad1f7db87f0375cfd7c6ae24aa13bdbdff2477a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 00:59:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 00:59:44 +0200    

Click here for diff

It's incorrect to use %lz for 64-bit numbers on 32-bit machine.  

M src/backend/commands/copyfrom.c

Add new COPY option SAVE_ERROR_TO

commit   : 9e2d8701194fa1d280b73c024759950c74c1c637    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 16 Jan 2024 23:08:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 16 Jan 2024 23:08:53 +0200    

Click here for diff

Currently, when source data contains unexpected data regarding data type or  
range, the entire COPY fails. However, in some cases, such data can be ignored  
and just copying normal data is preferable.  
  
This commit adds a new option SAVE_ERROR_TO, which specifies where to save the  
error information. When this option is specified, COPY skips soft errors and  
continues copying.  
  
Currently, SAVE_ERROR_TO only supports "none". This indicates error information  
is not saved and COPY just skips the unexpected data and continues running.  
  
Later works are expected to add more choices, such as 'log' and 'table'.  
  
Author: Damir Belyalov, Atsushi Torikoshi, Alex Shulgin, Jian He  
Discussion: https://postgr.es/m/87k31ftoe0.fsf_-_%40commandprompt.com  
Reviewed-by: Pavel Stehule, Andres Freund, Tom Lane, Daniel Gustafsson,  
Reviewed-by: Alena Rybakina, Andy Fan, Andrei Lepikhov, Masahiko Sawada  
Reviewed-by: Vignesh C, Atsushi Torikoshi  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list

Fix REALLOCATE_BITMAPSETS code

commit   : c7e5e994b2eb07cd0f3d5f0bb320e981bf1aae6e    
  
author   : David Rowley <[email protected]>    
date     : Wed, 17 Jan 2024 09:30:21 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 17 Jan 2024 09:30:21 +1300    

Click here for diff

7d58f2342 added a compile-time option to have bitmapset.c reallocate the  
set before returning when a set is modified.  That commit failed to do  
its job in various cases and returned the input set when it shouldn't  
have in these cases.  Here we fix those missing cases.  
  
This commit also adds some documentation about what  
REALLOCATE_BITMAPSETS is for.  This is important as future functions  
that go inside bitmapset.c need to know if they need to do anything  
special when this compile-time option is defined.  
  
Also, between 71a3e8c43 and 7d58f2342 some Asserts seem to have become  
duplicated.  Tidy these up.  Rather than having the Assert check each  
aspect of what makes a set invalid, here we introduce a helper function  
which returns false when a set is invalid and have the Asserts use this  
instead.  
  
Also, make a pass on improving the comments in bitmapset.c.  Various  
comments mentioned the input sets being "recycled".  This could be  
interpreted to mean that the output set will always point to the same  
memory as the given input parameter.  Here we try to make it clear that  
this must not be relied upon and that callers must ensure that all  
references to a given set are updated on each modification.  
  
In passing, improve comments for bms_union(), bms_intersect() and  
bms_difference() to detail what they do.  I (David) have too often had to  
remind myself by reading the code each time to find out if I need, for  
example, to use bms_union() or bms_join().  I also removed some  
low-value comments that were trying to convey information about "these  
operations" without mentioning which operations it was talking about.  
It seems better to document these things in the function header comment  
instead.  
  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAMbWs4-djy9qYux2gZrtmxA0StrYXJjvB-oqLxn-d7J88t=PQQ@mail.gmail.com  

M src/backend/nodes/bitmapset.c

Be more consistent about whether to update the FSM while vacuuming.

commit   : 45d395cd75ffc5b4c824467140127a5d11696d4c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Jan 2024 14:16:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Jan 2024 14:16:57 -0500    

Click here for diff

Previously, when lazy_scan_noprune() was called and returned true, we would  
update the FSM immediately if the relation had no indexes or if the page  
contained no dead items. On the other hand, when lazy_scan_prune() was  
called, we would update the FSM if either of those things was true or  
if index vacuuming was disabled. Eliminate that behavioral difference by  
considering vacrel->do_index_vacuuming in both cases.  
  
Also, make lazy_scan_heap() responsible for deciding whether to update  
the FSM, instead of doing it inside lazy_scan_noprune(). This is  
more consistent with the lazy_scan_prune() case. lazy_scan_noprune()  
still needs an output parameter for whether there are LP_DEAD items  
on the page, but the real decision-making now happens in the caller.  
  
Patch by me, reviewed by Peter Geoghegan and Melanie Plageman.  
  
Discussion: http://postgr.es/m/CA+TgmoaOzvN1TcHd9iej=PR3fY40En1USxzOnXSR2CxCLaRM0g@mail.gmail.com  

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

Support identity columns in partitioned tables

commit   : 699586315704a8268808e3bdba4cb5924a038c49    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 17:16:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 17:16:14 +0100    

Click here for diff

Previously, identity columns were disallowed on partitioned tables.  
(The reason was mainly that no one had gotten around to working  
through all the details to make it work.)  This makes it work now.  
  
Some details on the behavior:  
  
* A newly created partition inherits identity property  
  
  The partitions of a partitioned table are integral part of the  
  partitioned table.  A partition inherits identity columns from the  
  partitioned table.  An identity column of a partition shares the  
  identity space with the corresponding column of the partitioned  
  table.  In other words, the same identity column across all  
  partitions of a partitioned table share the same identity space.  
  This is effected by sharing the same underlying sequence.  
  
  When INSERTing directly into a partition, the sequence associated  
  with the topmost partitioned table is used to calculate the value of  
  the corresponding identity column.  
  
  In regular inheritance, identity columns and their properties in a  
  child table are independent of those in its parent tables.  A child  
  table does not inherit identity columns or their properties  
  automatically from the parent.  (This is unchanged.)  
  
* Attached partition inherits identity column  
  
  A table being attached as a partition inherits the identity property  
  from the partitioned table.  This should be fine since we expect  
  that the partition table's column has the same type as the  
  partitioned table's corresponding column.  If the table being  
  attached is a partitioned table, the identity properties are  
  propagated down its partition hierarchy.  
  
  An identity column in the partitioned table is also marked as NOT  
  NULL.  The corresponding column in the partition needs to be marked  
  as NOT NULL for the attach to succeed.  
  
* Drop identity property when detaching partition  
  
  A partition's identity column shares the identity space  
  (i.e. underlying sequence) as the corresponding column of the  
  partitioned table.  If a partition is detached it can longer share  
  the identity space as before.  Hence the identity columns of the  
  partition being detached loose their identity property.  
  
  When identity of a column of a regular table is dropped it retains  
  the NOT NULL constraint that came with the identity property.  
  Similarly the columns of the partition being detached retain the NOT  
  NULL constraints that came with identity property, even though the  
  identity property itself is lost.  
  
  The sequence associated with the identity property is linked to the  
  partitioned table (and not the partition being detached).  That  
  sequence is not dropped as part of detach operation.  
  
* Partitions with their own identity columns are not allowed.  
  
* The usual ALTER operations (add identity column, add identity  
  property to existing column, alter properties of an indentity  
  column, drop identity property) are supported for partitioned  
  tables.  Changing a column only in a partitioned table or a  
  partition is not allowed; the change needs to be applied to the  
  whole partition hierarchy.  
  
Author: Ashutosh Bapat <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/backend/rewrite/rewriteHandler.c
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Decorate WITH with literal markup tags

commit   : 7bcf57a0ca6601163c441270d031bb52e6abc9d2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Jan 2024 13:51:15 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Jan 2024 13:51:15 +0100    

Click here for diff

One instance of "WITH clause" was not using <literal> tags around  
WITH, while others were, so add markup to the last one to ensure  
consistency.  Backpatch to v15 where MERGE was added.  
  
Reported-by: jian he <[email protected]>  
Discussion: https://postgr.es/m/CACJufxGJKY9ZCPV2WDM6xFsXq9C8r7r3vU6AkScN+p9k6CEpMw@mail.gmail.com  
Backpatch-through: v15  

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

Add missing PGDLLIMPORT markings

commit   : c6b86eaa55ff225a7a4aa23c13e42edc4d996a44    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Jan 2024 13:53:28 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Jan 2024 13:53:28 +0200    

Click here for diff

Since commit 8ec569479f, we have a policy of marking all backend  
variables with PGDLLIMPORT.  
  
Reported-by: Anton A. Melnikov  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/postmaster/walsummarizer.h
M src/include/storage/buf_internals.h

struct XmlTableRoutine: use C99 designated initializers

commit   : 585025397337281cdce31bf1df2e0868cfbd0b92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:48:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:48:30 +0100    

Click here for diff

As in c27f8621eed et al.  
  
Not as critical as other cases we've handled, but I figure if we're  
going to add JsonbTableRoutine using TableFuncRoutine, this makes it  
easier to jump around the code.  

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

Don't test already-referenced pointer for nullness

commit   : c6605c1bdf07e8fc026bf857d37628cbb5746bb8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:27:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:27:52 +0100    

Click here for diff

Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer  
returned by pqPrepareAsyncResult(), before some other code that was  
already testing that pointer for nullness.  But since commit  
618c16707a6d (in Postgres 15), pqPrepareAsyncResult() doesn't ever  
return NULL (a statically-allocated result is returned if OOM).  So in  
branches 15 and up, we can remove the redundant pointer check with no  
harm done.  
  
However, in branch 14, pqPrepareAsyncResult() can indeed return NULL if  
it runs out of memory.  Fix things there by adding a null pointer check  
before dereferencing the pointer.  This should hint Coverity that the  
preexisting check is not redundant but necessary.  
  
Backpatch to 14, like b8ba7344e9eb.  
  
Per Coverity.  

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

doc: Add Identity Column section under Data Definition chapter

commit   : a37bb7c13995b834095d9d064cad1023a6f99b10    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 09:42:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 09:42:40 +0100    

Click here for diff

This seems to be missing since identity column support was added.  Add  
the same.  This gives a place to document various pieces of  
information in one place that are currently distributed over several  
command reference pages or just not documented (e.g., inheritance  
behavior).  
  
Author: Ashutosh Bapat <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml

Assert that partition inherits from only one parent in MergeAttributes()

commit   : d22d98c341713a260c1d821a62e83c19e27defa0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:57:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:57:35 +0100    

Click here for diff

A partition inherits only from one partitioned table and thus inherits  
a column definition only once.  Assert the same in MergeAttributes()  
and simplify a condition accordingly.  
  
Similar definition exists about line 3068 in the same function.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M src/backend/commands/tablecmds.c

doc: Decorate PostgreSQL with productname tag

commit   : 58b20e6d75e5ccaba8bd8a8b1c09f90e4a371b63    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:56:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:56:00 +0100    

Click here for diff

... in the section about Generated Columns.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/ddl.sgml

libpq: Add PQsendPipelineSync()

commit   : 4794c2d31714235700ed68edafa10d1928c9bbb2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 10:13:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 10:13:42 +0900    

Click here for diff

This new function is equivalent to PQpipelineSync(), except that it does  
not flush anything to the server except if the size threshold of the  
output buffer is reached; the user must subsequently call PQflush()  
instead.  
  
Its purpose is to reduce the system call overhead of pipeline mode, by  
giving to applications more control over the timing of the flushes when  
manipulating commands in pipeline mode.  
  
Author: Anton Kirilov  
Reviewed-by: Jelte Fennema-Nio, Robert Haas, Álvaro Herrera, Denis  
Laxalde, Michael Paquier  
Discussion: https://postgr.es/m/CACV6eE5arHFZEA717=iKEa_OewpVFfWJOmsOdGrqqsr8CJVfWQ@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-fe.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/multi_pipelines.trace

commit   : 83eb244e419efd43959fdd544ff8c30e175565ef    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 09:17:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 09:17:51 +0900    

Click here for diff

Noticed while reviewing the area for a different patch.  This is  
cosmetic, so no backpatch is done.  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c

Fix typos.

commit   : 237d01139b8a2ad26036d9025ae8e8e99b53e08c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 Jan 2024 11:50:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 Jan 2024 11:50:44 -0500    

Click here for diff

Alexander Lakhin  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/bin/pg_walsummary/t/002_blocks.pl

Fix 'negative bitmapset member' error

commit   : fe093994db4dc5dcc239f8839b094c0b75de00cf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Jan 2024 17:45:16 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Jan 2024 17:45:16 +0200    

Click here for diff

When removing a useless join, we'd remove PHVs that are not used at join  
partner rels or above the join.  A PHV that references the join's relid  
in ph_eval_at is logically "above" the join and thus should not be  
removed.  We have the following check for that:  
  
    !bms_is_member(ojrelid, phinfo->ph_eval_at)  
  
However, in the case of SJE removing a useless inner join, 'ojrelid' is  
set to -1, which would trigger the "negative bitmapset member not  
allowed" error in bms_is_member().  
  
Fix it by skipping examining ojrelid for inner joins in this check.  
  
Reported-by: Zuming Jiang  
Bug: #18260  
Discussion: https://postgr.es/m/18260-1b6a0c4ae311b837%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

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

Avoid useless ReplicationOriginExitCleanup locking

commit   : aa817c7496575b37fde6ea5e0cd65b26f29ea532    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Jan 2024 13:02:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Jan 2024 13:02:03 +0100    

Click here for diff

When session_replication_state is NULL, we can know there's nothing to  
do with no lock acquisition.  Do that.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACX+YaeRU5xJqR4C7kLsTO_F7DBRNF8WgeHvJZcKtNuK_A@mail.gmail.com  

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

Reduce dependency to money data type in main regression test suite

commit   : 31acee4b66f9f88ad5c19c1276252688bdaa95c9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Jan 2024 09:30:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Jan 2024 09:30:16 +0900    

Click here for diff

Most of these tests have been introduced in 6dd8b0080787, to check for  
behaviors related to hashing and hash plans, and money is a data type  
with btree support but no hash functions.  These tests are switched to  
use varbit instead, to provide the same coverage.  
  
Some other tests historically used money but don't really need it for  
what they wanted to test (see rules.sql).  Plans and coverage are  
unchanged after the modifications done here.  
  
Support for money may be removed a a later point, but this needs more  
discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/hash_func.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/union.out
M src/test/regress/expected/with.out
M src/test/regress/sql/hash_func.sql
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/union.sql
M src/test/regress/sql/with.sql

Prevent access to an unpinned buffer in BEFORE ROW UPDATE triggers.

commit   : 6545ba96cb7a98506627554a33bc7e39c88f9b76    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Jan 2024 12:38:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Jan 2024 12:38:41 -0500    

Click here for diff

When ExecBRUpdateTriggers switches to a new target tuple as a result  
of the EvalPlanQual logic, it must form a new proposed update tuple.  
Since commit 86dc90056, that tuple (the result of  
ExecGetUpdateNewTuple) has been a virtual tuple that might contain  
pointers to by-ref fields of the new target tuple (in "oldslot").  
However, immediately after that we materialize oldslot, causing it to  
drop its buffer pin, whereupon the by-ref pointers are unsafe to use.  
This is a live bug only when the new target tuple is in a different  
page than the original target tuple, since we do still hold a pin on  
the original one.  (Before 86dc90056, there was no bug because the  
EPQ plantree would hold a pin on the new target tuple; but now that's  
not assured.)  To fix, forcibly materialize the new tuple before we  
materialize oldslot.  This costs nothing since we would have done that  
shortly anyway.  
  
The real-world impact of this is probably minimal.  A visible failure  
could occur if the new target tuple's buffer were recycled for some  
other page in the short interval before we materialize newslot within  
the trigger-calling loop; but that's quite unlikely given that we'd  
just touched that page.  There's a larger hazard that some other  
process could prune and repack that page within the window.  We have  
lock on the new target tuple, but that wouldn't prevent it being moved  
on the page.  
  
Alexander Lakhin and Tom Lane, per bug #17798 from Alexander Lakhin.  
Back-patch to v14 where 86dc90056 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

pg_dump: Remove obsolete trigger support

commit   : 15235abbf34f6b246f7681e88dccf8c2796a245b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:53:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:53:59 +0100    

Click here for diff

Remove for dumping triggers from pre-9.2 servers.  This should have  
been removed as part of 30e7c175b81.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/56c8f5bf-de47-48c1-a592-588fb526e9e6%40eisentraut.org  

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

doc: Update catalog documentation for attstattarget nullable

commit   : 556799660fc4dc23e187994ae5ea622933ea720f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:46:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:46:01 +0100    

Click here for diff

Fixup for 4f622503d6.  

M doc/src/sgml/catalogs.sgml

Remove useless Assert

commit   : e3aa802e6f843fc8df793d2dccdafecc32fe2cfc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:29:45 +0100    

Click here for diff

It's already included in the subsequent intVal() call.  Fixup for  
4f622503d6.  

M src/backend/commands/tablecmds.c

Escape output of pg_amcheck test

commit   : 6a3631e251d1390673aee469c0cd672cac6195ef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 20:29:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 20:29:01 +0100    

Click here for diff

The pg_amcheck test reports a skip message if the layout of the index  
does not match expectations.  That message includes the bytes that  
were expected and the ones that were found.  But the found ones are  
arbitrary bytes, which can have funny effects on the terminal when  
they are printed.  To avoid that, escape non-word characters before  
printing.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/3f96f079-64e5-468a-8a19-cb481f0d31e5%40eisentraut.org  

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

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

commit   : 36578fa049421429c99bc9a0f06344dc8b4b5152    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:56:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:56:46 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

M .git-blame-ignore-revs

Re-pgindent catcache.c after previous commit.

commit   : 96c019ffa3f883d139709ea0cfe76dc1bce0f1f8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:54:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:54:11 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

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

Cope with catcache entries becoming stale during detoasting.

commit   : ad98fb14226ae6456fbaed7990ee7591cbe5efd2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:46:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:46:27 -0500    

Click here for diff

We've long had a policy that any toasted fields in a catalog tuple  
should be pulled in-line before entering the tuple in a catalog cache.  
However, that requires access to the catalog's toast table, and we'll  
typically do AcceptInvalidationMessages while opening the toast table.  
So it's possible that the catalog tuple is outdated by the time we  
finish detoasting it.  Since no cache entry exists yet, we can't  
mark the entry stale during AcceptInvalidationMessages, and instead  
we'll press forward and build an apparently-valid cache entry.  The  
upshot is that we have a race condition whereby an out-of-date entry  
could be made in a backend's catalog cache, and persist there  
indefinitely causing indeterminate misbehavior.  
  
To fix, use the existing systable_recheck_tuple code to recheck  
whether the catalog tuple is still up-to-date after we finish  
detoasting it.  If not, loop around and restart the process of  
searching the catalog and constructing cache entries from the top.  
The case is rare enough that this shouldn't create any meaningful  
performance penalty, even in the SearchCatCacheList case where  
we need to tear down and reconstruct the whole list.  
  
Indeed, the case is so rare that AFAICT it doesn't occur during  
our regression tests, and there doesn't seem to be any easy way  
to build a test that would exercise it reliably.  To allow  
testing of the retry code paths, add logic (in USE_ASSERT_CHECKING  
builds only) that randomly pretends that the recheck failed about  
one time out of a thousand.  This is enough to ensure that we'll  
pass through the retry paths during most regression test runs.  
  
By adding an extra level of looping, this commit creates a need  
to reindent most of SearchCatCacheMiss and SearchCatCacheList.  
I'll do that separately, to allow putting those changes in  
.git-blame-ignore-revs.  
  
Patch by me; thanks to Alexander Lakhin for having built a test  
case to prove the bug is real, and to Xiaoran Wang for review.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

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

Make attstattarget nullable

commit   : 4f622503d6de975ac87448aea5cea7de4bc140d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 18:14:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 18:14:53 +0100    

Click here for diff

This changes the pg_attribute field attstattarget into a nullable  
field in the variable-length part of the row.  If no value is set by  
the user for attstattarget, it is now null instead of previously -1.  
This saves space in pg_attribute and tuple descriptors for most  
practical scenarios.  (ATTRIBUTE_FIXED_PART_SIZE is reduced from 108  
to 104.)  Also, null is the semantically more correct value.  
  
The ANALYZE code internally continues to represent the default  
statistics target by -1, so that that code can avoid having to deal  
with null values.  But that is now contained to the ANALYZE code.  
Only the DDL code deals with attstattarget possibly null.  
  
For system columns, the field is now always null.  The ANALYZE code  
skips system columns anyway.  
  
To set a column's statistics target to the default value, the new  
command form ALTER TABLE ... SET STATISTICS DEFAULT can be used.  (SET  
STATISTICS -1 still works.)  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/common/tupdesc.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/cache/lsyscache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_attribute.h
M src/include/commands/vacuum.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/create_index.out

Fix memory leak in connection string validation.

commit   : 45da69371ebfc4d6982695e58791989660c1cc33    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 21:38:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 21:38:16 -0800    

Click here for diff

Introduced in commit c3afe8cf5a.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Nathan Bossart, Tom Lane  
Backpatch-through: 16  

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

Add empty placeholder LINGUAS file for pg_walsummary

commit   : 2f696d5a2902333329a95fd80e351e4e6ecf8d4a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 23:20:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 23:20:03 +0100    

Click here for diff

Like bbf1f1340800.  

A src/bin/pg_walsummary/po/LINGUAS

Re-validate connection string in libpqrcv_connect().

commit   : 5c31669058b5550b4b3d623c07bc4203c11b8316    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 13:41:36 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 13:41:36 -0800    

Click here for diff

A superuser may create a subscription with password_required=true, but  
which uses a connection string without a password.  
  
Previously, if the owner of such a subscription was changed to a  
non-superuser, the non-superuser was able to utilize a password from  
another source (like a password file or the PGPASSWORD environment  
variable), which should not have been allowed.  
  
This commit adds a step to re-validate the connection string before  
connecting.  
  
Reported-by: Jeff Davis  
Author: Vignesh C  
Reviewed-by: Peter Smith, Robert Haas, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/flat/e5892973ae2a80a1a3e0266806640dae3c428100.camel%40j-davis.com  
Backpatch-through: 16  

M doc/src/sgml/ref/create_subscription.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/test/subscription/t/027_nosuperuser.pl

Refactor ATExecAddColumn() to use BuildDescForRelation()

commit   : a1604237a6ffee70b171bacd5f36b0e380afd33a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Jan 2024 16:05:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Jan 2024 16:05:15 +0100    

Click here for diff

BuildDescForRelation() has all the knowledge for converting a  
ColumnDef into pg_attribute/tuple descriptor.  ATExecAddColumn() can  
make use of that, instead of duplicating all that logic.  We just pass  
a one-element list of ColumnDef and we get back exactly the data  
structure we need.  Note that we don't even need to touch  
BuildDescForRelation() to make this work.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Fix typo.

commit   : 882887e9b458f533b301c36951c93dfdd37dccfc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Jan 2024 09:46:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Jan 2024 09:46:46 -0500    

Click here for diff

Noriyoshi Shinoda  
  
Discussion: http://postgr.es/m/DM4PR84MB17347D9466419413698105D8EE6F2@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/pg_walsummary.sgml

Added literal tag for RETURNING

commit   : 6780b79d5c580586ae6feb37b9c8b8bf33367886    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 12:44:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 12:44:20 +0100    

Click here for diff

This is an old mistake (92e38182d7c8); backpatch all the way back.  
  
Author: Atsushi Torikoshi <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix pg_walsummary's .gitignore

commit   : 278972f5933679e06e7d71d2060c1867f5aa4ebe    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 13:40:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 13:40:58 +0900    

Click here for diff

It missed a entry for tmp_check/ generated by the tests.  While on it,  
append a slash at the beginning of "pg_walsummary" to restrict its check  
to the current directory, like anywhere else.  
  
Oversights in ee1bfd168390.  

M src/bin/pg_walsummary/.gitignore

Refactor code checking for file existence

commit   : e72a37528ddaadd796be73fe9b0a0c08b18476d2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 12:04:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 12:04:51 +0900    

Click here for diff

jit.c and dfgr.c had a copy of the same code to check if a file exists  
or not, with a twist: jit.c did not check for EACCES when failing the  
stat() call for the path whose existence is tested.  This refactored  
routine will be used by an upcoming patch.  
  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/jit.c
M src/backend/storage/file/fd.c
M src/backend/utils/fmgr/dfmgr.c
M src/include/storage/fd.h

Rework how logirep launchers are stopped during pg_upgrade

commit   : 08c3ad27eb5348d0cbffa843a3edb11534f9904a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 08:23:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 08:23:07 +0900    

Click here for diff

This is a rework of 7021d3b17664, where we relied on forcing  
max_logical_replication_workers to 0 in the postgres command.  This  
commit now prevents logical replication launchers to start using -b and  
a backend-side check based on IsBinaryUpgrade, effective when upgrading  
from 17 and newer versions.  
  
This commit improves the comments explaining why this restriction is  
necessary.  
  
This discussion was on hold until we were sure how to add support for  
subscribers in pg_upgrade, something now done thanks to 9a17be1e244a.  
  
Reviewed-by: Álvaro Herrera, Amit Kapila, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c
M src/bin/pg_upgrade/server.c

Fix some inconsistent whitespace in Perl file

commit   : 7786af4d74182ddd32e00f694bba741ee5d33efa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 22:23:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 22:23:44 +0100    

Click here for diff

M src/test/modules/test_pg_dump/t/001_base.pl

Fix incorrect format placeholder

commit   : 35bc310c04a477376778f437a56f0fcfb504c9c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 21:49:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 21:49:00 +0100    

Click here for diff

M src/bin/pg_upgrade/info.c

Cleanup for unicode-update build target and test.

commit   : cf64d4e99f6480ad6d73af82bfbbf2b2e637a7ec    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 11 Jan 2024 12:20:25 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 11 Jan 2024 12:20:25 -0800    

Click here for diff

In preparation for adding more Unicode tables.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Jeremy Schneider  

M src/common/unicode/Makefile
M src/common/unicode/category_test.c
M src/common/unicode/meson.build

Allow subquery pullup to wrap a PlaceHolderVar in another one.

commit   : 29f114b6ff0c4ccad29b3a3707ab2c299647d450    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2024 15:28:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2024 15:28:13 -0500    

Click here for diff

The code for wrapping subquery output expressions in PlaceHolderVars  
believed that if the expression already was a PlaceHolderVar, it was  
never necessary to wrap that in another one.  That's wrong if the  
expression is underneath an outer join and involves a lateral  
reference to outside that scope: failing to add an additional PHV  
risks evaluating the expression at the wrong place and hence not  
forcing it to null when the outer join should do so.  This is an  
oversight in commit 9e7e29c75, which added logic to forcibly wrap  
lateral-reference Vars in PlaceHolderVars, but didn't see that the  
adjacent case for PlaceHolderVars needed the same treatment.  
  
The test case we have for this doesn't fail before 4be058fe9, but now  
that I see the problem I wonder if it is possible to demonstrate  
related errors before that.  That's moot though, since all such  
branches are out of support.  
  
Per bug #18284 from Holger Reise.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Try to fix pg_walsummary buildfarm failures.

commit   : a7097ca630a25dd2248229f21ebce4968d85d10a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 15:01:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 15:01:51 -0500    

Click here for diff

Apparently the new tuple isn't guaranteed to end up at the end of  
the relation, so make the test not depend on that happening.  

M src/bin/pg_walsummary/t/002_blocks.pl

Remove hastup from LVPagePruneState.

commit   : e2d5b3b9b643739bd83e42769b44005dfd2bbb90    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:22:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:22:04 -0500    

Click here for diff

Instead, just have lazy_scan_prune() and lazy_scan_noprune() update  
LVRelState->nonempty_pages directly. This makes the two functions  
more similar and also removes makes lazy_scan_noprune need one fewer  
output parameters.  
  
Melanie Plageman, reviewed by Andres Freund, Michael Paquier, and me  
  
Discussion: http://postgr.es/m/CAAKRu_btji_wQdg=ok-5E4v_bGVxKYnnFFe7RA6Frc1EcOwtSg@mail.gmail.com  

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

Reindent after commit d9ef650fca7bc574586f4171cd929cfd5240326e.

commit   : 5faffa0434b484772782ff4763c0b2080222dde0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:24:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:24:35 -0500    

Click here for diff

M src/backend/postmaster/walsummarizer.c

Repair various defects in dc212340058b4e7ecfc5a7a81ec50e7a207bf288.

commit   : 3d5c332a3d6002c5c95cb238e2164ae054c8e805    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:06:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:06:10 -0500    

Click here for diff

pg_combinebackup had various problems:  
  
* strncpy was used in various places where strlcpy should be used  
  instead, to avoid any possibility of the result not being  
  \0-terminated.  
* scan_for_existing_tablespaces() failed to close the directory,  
  and an error when opening the directory was reported with the  
  wrong pathname.  
* write_reconstructed_file() contained some redundant and therefore  
  dead code.  
* flush_manifest() didn't check the result of pg_checksum_update()  
  as we do in other places, and misused a local pathname variable  
  that shouldn't exist at all.  
  
In pg_basebackup, the wrong variable name was used in one place,  
due to a copy and paste that was not properly adjusted.  
  
In blkreftable.c, the loop incorrectly doubled chunkno instead of  
max_chunks. Fix that. Also remove a nearby assertion per repeated  
off-list complaints from Tom Lane.  
  
Per Coverity and subsequent code inspection by me and by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/write_manifest.c
M src/common/blkreftable.c

Add new pg_walsummary tool.

commit   : ee1bfd168390bc843c6704d16e909692c0a79f27    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:47:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:47:28 -0500    

Click here for diff

This can dump the contents of the WAL summary files found in  
pg_wal/summaries. Normally, this shouldn't really be something anyone  
needs to do, but it may be needed for debugging problems with  
incremental backup, or could possibly be useful to external tools.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/pg_walsummary.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
M src/bin/meson.build
A src/bin/pg_walsummary/.gitignore
A src/bin/pg_walsummary/Makefile
A src/bin/pg_walsummary/meson.build
A src/bin/pg_walsummary/nls.mk
A src/bin/pg_walsummary/pg_walsummary.c
A src/bin/pg_walsummary/t/001_basic.pl
A src/bin/pg_walsummary/t/002_blocks.pl
M src/tools/pgindent/typedefs.list

Add new function pg_get_wal_summarizer_state().

commit   : d9ef650fca7bc574586f4171cd929cfd5240326e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:41:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:41:18 -0500    

Click here for diff

This makes it possible to access information about the progress  
of WAL summarization from SQL. The previously-added functions  
pg_available_wal_summaries() and pg_wal_summary_contents() only  
examine on-disk state, but this function exposes information from  
the server's shared memory.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/backup/walsummaryfuncs.c
M src/backend/postmaster/walsummarizer.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/postmaster/walsummarizer.h

Clarify which xml tools are missing in meson error message

commit   : 544bcb5a5e778e8ef8d784de611c5f85bc33433c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:55:43 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:55:43 +0100    

Click here for diff

M meson.build

Fix omission in partitioning limitation documentation

commit   : ba2d2784f3f83277de6f9c17505229fa3f2f6d5c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:27:10 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:27:10 +0100    

Click here for diff

UNIQUE and PRIMARY KEY constraints can be created on ONLY the  
partitioned table.  We already had an example demonstrating that,  
but forgot to mention it in the documentation of the limits of  
partitioning.  
  
Author: Laurenz Albe  
Reviewed-By: shihao zhong, Shubham Khanna, Ashutosh Bapat  
Backpatch-through: 12  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Fix an intermetant BF failure in 003_logical_slots.

commit   : 6f97ef05d62a9c4ed5c53e98ac8a44cf3e0a2780    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 11 Jan 2024 08:56:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 11 Jan 2024 08:56:27 +0530    

Click here for diff

During upgrade, when pg_restore performs CREATE DATABASE, bgwriter or  
checkpointer may flush buffers and hold a file handle for pg_largeobject,  
so later TRUNCATE pg_largeobject command will fail if OS (such as older  
Windows versions) doesn't remove an unlinked file completely till it's  
open. The probability of seeing this behavior is higher in this test  
because we use wal_level as logical via allows_streaming => 'logical'  
which in turn set shared_buffers as 1MB and make it more probable for  
bgwriter to hold the file handle.  
  
Diagnosed-by: Alexander Lakhin  
Author: Hayato Kuroda, Amit Kapila  
Reviewed-by: Alexander Lakhin  
Discussion: https://postgr.es/m/TYAPR01MB5866AB7FD922CE30A2565B8BF5A8A@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/003_logical_slots.pl

Update documentation of default fdw_tuple_cost

commit   : f7f694b21400b14696dd8e85747dcef845e959ff    
  
author   : John Naylor <[email protected]>    
date     : Thu, 11 Jan 2024 08:58:18 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 11 Jan 2024 08:58:18 +0700    

Click here for diff

Follow up to cac169d68  
  
Umair Shahid  
  
Reviewed by Richard Guo and Chris Travers  
  
Discussion: https://postgr.es/m/CALVUYo9RECc5gwD%2B4SRM5Es%2Bbg9cpNfhd3_qUjf7kVTGyLpFJg%40mail.gmail.com  

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

pg_regress: Disable autoruns for cmd.exe on Windows

commit   : b83747a8a65b6c4b7b9afea4e50b00cb0cd64ee5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Jan 2024 10:39:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Jan 2024 10:39:58 +0900    

Click here for diff

This is similar to 9886744a361b, to prevent the execution of other  
programs due to autorun configurations which could influence the  
postmaster startup.  
  
Like the other change, no backpatch is done.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Restore initdb's old behavior of always setting the lc_xxx GUCs.

commit   : 3d185cfc09c32b1f250adfbb62c0c7a3f96c5af2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 18:09:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 18:09:29 -0500    

Click here for diff

In commit 3e51b278d I (tgl) caused initdb to leave lc_messages and  
other lc_xxx GUCs commented-out in the installed postgresql.conf file  
if they were going to be set to 'C'.  This was a hack for cosmetic  
purposes, and it was buggy because lc_messages' wired-in default is  
not 'C' but '' (empty string).  That led to --no-locale not having  
the expected effect, since the postmaster would then obtain  
lc_messages from its startup environment.  
  
Let's just revert to the prior behavior of always de-commenting the  
lc_xxx entries; the argument for changing that longstanding behavior  
was weak in the first place.  
  
Also, fix postgresql.conf.sample's erroneous claim that the default  
value of lc_messages is 'C'.  I suspect that was what misled me into  
making this mistake in the first place.  
  
Report and patch by Kyotaro Horiguchi.  Back-patch to v16 where  
the problem was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c

Allow noise semicolons ending psql \sf, \ef, \sv, \ev commands.

commit   : 390298f0806588ceb131dd47760208bd2cd6298f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 14:20:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 14:20:09 -0500    

Click here for diff

Many psql backslash commands tolerate trailing semicolons, even  
though that's not part of the official syntax.  These did not.  
They tried to, by passing semicolon = true to psql_scan_slash_option,  
but that function ignored this parameter in OT_WHOLE_LINE mode.  
Teach it to do the right thing, and remove the now-duplicative  
logic in exec_command_help.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c
M src/bin/psql/psqlscanslash.l
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Fix Asserts in calc_non_nestloop_required_outer().

commit   : add673b897c3d76767cec5ac1619fad6b1eb7582    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 13:51:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 13:51:36 -0500    

Click here for diff

These were not testing the same thing as the comparable Assert  
in calc_nestloop_required_outer(), because we neglected to map  
the given Paths' relids to top-level relids.  When considering  
a partition child join the latter is the correct thing to do.  
  
This oversight is old, but since it's only an overly-weak Assert  
check there doesn't seem to be much value in back-patching.  
  
Richard Guo (with cosmetic changes and comment updates by me)  
  
Discussion: https://postgr.es/m/CAMbWs49sqbe9GBZ8sy8dSfKRNURgicR85HX8vgzcgQsPF0XY1w@mail.gmail.com  

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

Handle WindowClause.runCondition in tree walker/mutator functions.

commit   : d641b827af3966e349cbcc592bc51a4ab770c37b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 13:36:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2024 13:36:33 -0500    

Click here for diff

Commit 9d9c02ccd, which added the notion of a "run condition" for  
window functions, neglected to teach nodeFuncs.c to process the new  
field.  Remarkably, that doesn't seem to have had any ill effects  
before we invented Var.varnullingrels, but now it can cause visible  
failures in join-removal scenarios.  
  
I have no faith that there's not reachable problems in v15 too,  
so back-patch the code change to v15 where 9d9c02ccd came in.  
The test case seems irrelevant to v15, though.  
  
Per bug #18277 from Zuming Jiang.  Diagnosis and patch by  
Richard Guo.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: clarify who owns the initdb-created cluster, by default

commit   : 5b2da240e01ecaef8181b0feebaeb69e6fefdaa0    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Jan 2024 11:20:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Jan 2024 11:20:15 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16  

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

Show the default checkpoint method in the pg_basebackup help message

commit   : cd02b35a4609090e6c4e4fc3d8bd055c559dea1b    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 10 Jan 2024 13:30:10 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 10 Jan 2024 13:30:10 +0100    

Click here for diff

Author: Michael Banck  
Reviewed-By: Aleksander Alekseev, Michael Paquier, Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

pg_ctl: Disable autoruns for cmd.exe on Windows

commit   : 9886744a361b1b1d376fcad661eb2857829f3fde    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Jan 2024 10:41:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Jan 2024 10:41:57 +0900    

Click here for diff

On Windows, cmd.exe is used to launch the postmaster process to ease its  
redirection setup.  However, cmd.exe may execute other programs at  
startup due to autorun configurations, which could influence the  
postmaster startup.  This patch adds /D flag to the launcher cmd.exe  
command line to disable autorun settings written in the registry.  
  
This is arguably a bug, but no backpatch is done now out of caution.  
  
Reported-by: Hayato Kuroda  
Author: Kyotaro Horiguchi  
Reviewed-by: Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Document WAL summarization information functions.

commit   : f896057e46b06d5ac3f62f7d18f87a7f12185177    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2024 13:04:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2024 13:04:46 -0500    

Click here for diff

Commit 174c480508ac25568561443e6d4a82d5c1103487 added two new  
information functions but failed to document them anywhere.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix documentation for wal_summary_keep_time.

commit   : d97ef756afcadeeb040c3f11e764d6a7179d441e    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 9 Jan 2024 11:35:10 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 9 Jan 2024 11:35:10 -0600    

Click here for diff

The documentation for this parameter lists its type as boolean, but  
it is actually an integer.  Furthermore, there is no mention of how  
the value is interpreted when specified without units.  This commit  
fixes these oversights in commit 174c480508.  
  
Co-authored-by: Hubert Depesz Lubaczewski  
Discussion: https://postgr.es/m/ZZwkujFihO2uqKwp%40depesz.com  

M doc/src/sgml/config.sgml

Cross-check lists of predefined LWLocks.

commit   : 5b1b9bce84497ec71dbd6d5a969e8fc5aa22b4ef    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 9 Jan 2024 11:05:19 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 9 Jan 2024 11:05:19 -0600    

Click here for diff

Both lwlocknames.txt and wait_event_names.txt contain a list of all  
the predefined LWLocks, i.e., those with predefined positions  
within MainLWLockArray.  It is easy to miss one or the other,  
especially since the list in wait_event_names.txt omits the "Lock"  
suffix from all the LWLock wait events.  This commit adds a cross-  
check of these lists to the script that generates lwlocknames.h.  
If the lists do not match exactly, building will fail.  
  
Suggested-by: Robert Haas  
Reviewed-by: Robert Haas, Michael Paquier, Bertrand Drouvot  
Discussion: https://postgr.es/m/20240102173120.GA1061678%40nathanxps13  

M src/backend/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/meson.build

Add new function, PQchangePassword(), to libpq

commit   : a7be2a6c262d5352756d909b29c419ea5e5fa1d9    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 9 Jan 2024 09:16:48 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 9 Jan 2024 09:16:48 -0500    

Click here for diff

Essentially this moves the non-interactive part of psql's "\password"  
command into an exported client function. The password is not sent to the  
server in cleartext because it is "encrypted" (in the case of scram and md5  
it is actually hashed, but we have called these encrypted passwords for a  
long time now) on the client side. This is good because it ensures the  
cleartext password is never known by the server, and therefore won't end up  
in logs, pg_stat displays, etc.  
  
In other words, it exists for the same reason as PQencryptPasswordConn(), but  
is more convenient as it both builds and runs the "ALTER USER" command for  
you. PQchangePassword() uses PQencryptPasswordConn() to do the password  
encryption. PQencryptPasswordConn() is passed a NULL for the algorithm  
argument, hence encryption is done according to the server's  
password_encryption setting.  
  
Also modify the psql client to use the new function. That provides a builtin  
test case. Ultimately drivers built on top of libpq should expose this  
function and its use should be generally encouraged over doing ALTER USER  
directly for password changes.  
  
Author: Joe Conway  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/flat/b75955f7-e8cc-4bbd-817f-ef536bacbe93%40joeconway.com  

M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/libpq-fe.h

Doc: fix character_sets view.

commit   : d596736a499858de800cabb241c0107c978f1b95    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 9 Jan 2024 19:43:19 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 9 Jan 2024 19:43:19 +0900    

Click here for diff

The note regarding character encoding form in "The Information Schema"  
said that LATIN1 character repertoires only use one encoding form  
LATIN1. This is not correct because LATIN1 has another encoding form  
ISO-2022-JP-2. To fix this, replace LATIN1 with LATIN2, which is not  
supported by ISO-2022-JP-2, thus it can be said that LATIN2 only uses  
one encoding form.  
  
Back-patch to supported branches.  
  
Author: Tatsuo Ishii  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/flat/20240102.153925.1147403616414525145.t-ishii%40sranhm.sra.co.jp  

M doc/src/sgml/information_schema.sgml

An addition to 8c441c08279

commit   : 028b15405b4113e1b0f492bf9908d001a5983a77    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 10:12:14 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 10:12:14 +0200    

Click here for diff

Given that now SJE doesn't work with result relation, turn a code dealing with  
that into an assert that it shouldn't happen.  

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

Forbid SJE with result relation

commit   : 8c441c082797f22ae96f50b641a8ef3f65c92b8d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 10:01:22 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 10:01:22 +0200    

Click here for diff

The target relation for INSERT/UPDATE/DELETE/MERGE has a different behavior  
than other relations in EvalPlanQual() and RETURNING clause.  This is why we  
forbid target relation to be either source or target relation in SJE.  
It's not clear if we could ever support this.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/b9e8f460-f9a6-0e9b-e8ba-60d59f0bc22c%40gmail.com  

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

Fix misuse of RelOptInfo.unique_for_rels cache by SJE

commit   : 30b4955a4668887044568743debef804b14418ca    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 00:08:35 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 9 Jan 2024 00:08:35 +0200    

Click here for diff

When SJE uses RelOptInfo.unique_for_rels cache, it passes filtered quals to  
innerrel_is_unique_ext().  That might lead to an invalid match to cache entries  
made by previous non self-join checking calls.  Add UniqueRelInfo.self_join  
flag to prevent such cases.  Also, fix that SJE should require a strict match  
of outerrelids to make sure UniqueRelInfo.extra_clauses are valid.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/4788f781-31bd-9796-d7d6-588a751c8787%40gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

commit   : d3c5f37dd543498cc7c678815d3921823beec9e9    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    

Click here for diff

This replaces dblink's blocking libpq calls, allowing cancellation and  
allowing DROP DATABASE (of a database not involved in the query).  Apart  
from explicit dblink_cancel_query() calls, dblink still doesn't cancel  
the remote side.  The replacement for the blocking calls consists of  
new, general-purpose query execution wrappers in the libpqsrv facility.  
Out-of-tree extensions should adopt these.  Use them in postgres_fdw,  
replacing a local implementation from which the libpqsrv implementation  
derives.  This is a bug fix for dblink.  Code inspection identified the  
bug at least thirteen years ago, but user complaints have not appeared.  
Hence, no back-patch for now.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove excess #include "utils/wait_event.h".

commit   : 0efc8318477714600567d15812dc8d15841e269e    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    

Click here for diff

This simplifies copying libpq/libpq-be-fe-helpers.h into extensions,  
because some supported PostgreSQL versions lack the other header.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/libpq-be-fe-helpers.h

Fix missing word in comment.

commit   : 196799d6765706697ff9417ae85929085774b8f4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Jan 2024 11:39:56 -0800    

Click here for diff

M src/include/libpq/libpq-be-fe-helpers.h

Fix indentation in ExecParallelHashIncreaseNumBatches()

commit   : 6d94cc6ca1b775335f58527ece6c12d74ec41bde    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Jan 2024 19:43:05 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Jan 2024 19:43:05 +0200    

Click here for diff

Backpatch-through: 12  

M src/backend/executor/nodeHash.c

Allow examine_simple_variable() to work on INSERT RETURNING Vars.

commit   : 89b69db82adf742cadc36ee9a365cf47a632cdb0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2024 11:48:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2024 11:48:44 -0500    

Click here for diff

Since commit 599b33b94, this function assumed that every RTE_RELATION  
RangeTblEntry would have an associated RelOptInfo.  But that's not so:  
we only build RelOptInfos for relations that are scanned by the query.  
In particular the target of an INSERT won't have one, so that Vars  
appearing in an INSERT ... RETURNING list will not have an associated  
RelOptInfo.  This apparently wasn't a problem before commit f7816aec2  
taught examine_simple_variable() to drill down into CTEs containing  
INSERT RETURNING, but it is now.  
  
To fix, add a fallback code path that gets the userid to use directly  
from the RTEPermissionInfo associated with the RTE.  (Sadly, we must  
have two code paths, because not every RTE has a RTEPermissionInfo  
either.)  
  
Per report from Alexander Lakhin.  No back-patch, since the case is  
apparently unreachable before f7816aec2.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/relnode.c
M src/backend/utils/adt/selfuncs.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Strengthen tests for 5ef34a8fc3

commit   : bea18b1c949145ba2ca79d4765dba3cc9494a480    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 8 Jan 2024 15:00:42 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 8 Jan 2024 15:00:42 +0200    

Click here for diff

The test query in 5ef34a8fc3 is running over the empty emp1 table giving the  
same (empty) return both with and without the fix.  Add one row to that table  
to make not just the test query plan, but also the test query result different.  
  
Reported-by: Richard Guo  
Bug: #18261  
Discussion: https://postgr.es/m/CAMbWs49igjcszLgicb4D1N21_5iNDoxheJ7KFmAcs_z%3DLx6jhg%40mail.gmail.com  

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

Fix integer-overflow problem in intarray's g_int_decompress().

commit   : 9034a2d5123498104ef1e515c0b56d70d98d0ce2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jan 2024 15:19:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jan 2024 15:19:50 -0500    

Click here for diff

An array element equal to INT_MAX gave this code indigestion,  
causing an infinite loop that surely ended in SIGSEGV.  We fixed  
some nearby problems awhile ago (cf 757c5182f) but missed this.  
  
Report and diagnosis by Alexander Lakhin (bug #18273); patch by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/_int_gist.c
M contrib/intarray/data/test__int.data
M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql

Fix oversized memory allocation in Parallel Hash Join

commit   : 2a67b5a60ee68892bb028587ddc6de7650822480    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 7 Jan 2024 09:03:55 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 7 Jan 2024 09:03:55 +0200    

Click here for diff

During the calculations of the maximum for the number of buckets, take into  
account that later we round that to the next power of 2.  
  
Reported-by: Karen Talarico  
Bug: #16925  
Discussion: https://postgr.es/m/16925-ec96d83529d0d629%40postgresql.org  
Author: Thomas Munro, Andrei Lepikhov, Alexander Korotkov  
Reviewed-by: Alena Rybakina  
Backpatch-through: 12  

M src/backend/executor/nodeHash.c

Fix the issue that SJE mistakenly omits qual clauses

commit   : 5ef34a8fc3899a306fbc907a762fee0ba3782462    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 6 Jan 2024 14:09:39 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 6 Jan 2024 14:09:39 +0200    

Click here for diff

When the SJE code handles the transfer of qual clauses from the removed  
relation to the remaining one, it replaces the Vars of the removed  
relation with the Vars of the remaining relation for each clause, and  
then reintegrates these clauses into the appropriate restriction or join  
clause lists, while attempting to avoid duplicates.  
  
However, the code compares RestrictInfo->clause to determine if two  
clauses are duplicates.  This is just flat wrong.  Two RestrictInfos  
with the same clause can have different required_relids,  
incompatible_relids, is_pushed_down, and so on.  This can cause qual  
clauses to be mistakenly omitted, leading to wrong results.  
  
This patch fixes it by comparing the entire RestrictInfos not just their  
clauses ignoring 'rinfo_serial' field (otherwise almost all RestrictInfos will  
be unique).  Making 'rinfo_serial' equal_ignore would break other code.  This  
is why this commit implements our own comparison function for checking the  
equality of RestrictInfos.  
  
Reported-by: Zuming Jiang  
Bug: #18261  
Discussion: https://postgr.es/m/18261-2a75d748c928609b%40postgresql.org  
Author: Richard Guo  

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

Clean up some edge cases in plpgsql's %TYPE parsing.

commit   : 43b46aae12b220b7eca8250c6c361083f35985a0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2024 14:32:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2024 14:32:34 -0500    

Click here for diff

Support referencing a composite-type variable in %TYPE.  
  
Remove the undocumented, untested, and pretty useless ability  
to have the subject of %TYPE be an (unqualified) type name.  
You get the same result by just not writing %TYPE.  
  
Add or adjust some test cases to improve code coverage here.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : dbad1c53e92e364e2675f1246e443b95545d4070    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 5 Jan 2024 13:15:50 +0000    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 5 Jan 2024 13:15:50 +0000    

Click here for diff

M config/check_modules.pl
M src/backend/snowball/snowball_create.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_misc/t/004_io_direct.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/tools/ci/windows_build_config.pl
M src/tools/gen_export.pl

Fix corruption of local buffer state during extend of temp relation

commit   : 9cd0d77dfcdf847cc42e0401d406c501b3baccbb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Jan 2024 20:08:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Jan 2024 20:08:34 +0900    

Click here for diff

A typo has been introduced by 31966b151e6a when updating the state of a  
local buffer when a temporary relation is extended, for the case of a  
block included in the relation range extended, when it is already found  
in the hash table holding the local buffers.  In this case, BM_VALID  
should be cleared, but the buffer state was changed so as BM_VALID  
remained while clearing the other flags.  
  
As reported on the thread, it was possible to corrupt the state of the  
local buffers on ENOSPC, but the states would be corrupted on any kind  
of ERROR during the relation extend (like partial writes or some other  
errno).  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang  
Reviewed-by: Richard Guo, Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Teach estimate_array_length() to use statistics where available.

commit   : 9391f71523b6e57f1194d9f6543bc7948c16411b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2024 18:36:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2024 18:36:19 -0500    

Click here for diff

If we have DECHIST statistics about the argument expression, use  
the average number of distinct elements as the array length estimate.  
(It'd be better to use the average total number of elements, but  
that is not currently calculated by compute_array_stats(), and  
it's unclear that it'd be worth extra effort to get.)  
  
To do this, we have to change the signature of estimate_array_length  
to pass the "root" pointer.  While at it, also change its result  
type to "double".  That's probably not really necessary, but it  
avoids any risk of overflow of the value extracted from DECHIST.  
All existing callers are going to use the result in a "double"  
calculation anyway.  
  
Paul Jungwirth, reviewed by Jian He and myself  
  
Discussion: https://postgr.es/m/CA+renyUnM2d+SmrxKpDuAdpiq6FOM=FByvi6aS6yi__qyf6j9A@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Add macros for looping through a List without a ListCell.

commit   : 14dd0f27d7cd56ffae9ecdbe324965073d01a9ff    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 4 Jan 2024 16:09:34 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 4 Jan 2024 16:09:34 -0600    

Click here for diff

Many foreach loops only use the ListCell pointer to retrieve the  
content of the cell, like so:  
  
    ListCell   *lc;  
  
    foreach(lc, mylist)  
    {  
        int         myint = lfirst_int(lc);  
  
        ...  
    }  
  
This commit adds a few convenience macros that automatically  
declare the loop variable and retrieve the current cell's contents.  
This allows us to rewrite the previous loop like this:  
  
    foreach_int(myint, mylist)  
    {  
        ...  
    }  
  
This commit also adjusts a few existing loops in order to add  
coverage for the new/adjusted macros.  There is presently no plan  
to bulk update all foreach loops, as that could introduce a  
significant amount of back-patching pain.  Instead, these macros  
are primarily intended for use in new code.  
  
Author: Jelte Fennema-Nio  
Reviewed-by: David Rowley, Alvaro Herrera, Vignesh C, Tom Lane  
Discussion: https://postgr.es/m/CAGECzQSwXKnxGwW1_Q5JE%2B8Ja20kyAbhBHO04vVrQsLcDciwXA%40mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/nodes/pg_list.h

In plpgsql, allow %TYPE and %ROWTYPE to be followed by array decoration.

commit   : 5e8674dc83926f52516f847f1a77e8d38e94e143    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2024 15:24:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2024 15:24:15 -0500    

Click here for diff

This provides the useful ability to declare a variable that is an array  
of the type of some other variable or some table column.  
  
Quan Zongliang, Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/expected/plpgsql_array.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_array.sql

ALTER TABLE command to change generation expression

commit   : 5d06e99a3cfc23bbc217b4d78b8c070ad52f720e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2024 15:45:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2024 15:45:35 +0100    

Click here for diff

This adds a new ALTER TABLE subcommand ALTER COLUMN ... SET EXPRESSION  
that changes the generation expression of a generated column.  
  
The syntax is not standard but was adapted from other SQL  
implementations.  
  
This command causes a table rewrite, using the usual ALTER TABLE  
mechanisms.  The implementation is similar to and makes use of some of  
the infrastructure of the SET DATA TYPE subcommand (for example,  
rebuilding constraints and indexes afterwards).  The new command  
requires a new pass in AlterTablePass, and the ADD COLUMN pass had to  
be moved earlier so that combinations of ADD COLUMN and SET EXPRESSION  
can work.  
  
Author: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b94yyJeGA-5M951_Lr+KfZokOp-2kXicpmEhi5FXhBeTog@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Fix use of incorrect TupleTableSlot in DISTINCT aggregates

commit   : ae69c4fcf1337af399a788ab8d96af540bd1cd8e    
  
author   : David Rowley <[email protected]>    
date     : Thu, 4 Jan 2024 20:38:25 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 4 Jan 2024 20:38:25 +1300    

Click here for diff

1349d2790 added code to allow DISTINCT and ORDER BY aggregates to work  
more efficiently by using presorted input.  That commit added some code  
that made use of the AggState's tmpcontext and adjusted the  
ecxt_outertuple and ecxt_innertuple slots before checking if the current  
row is distinct from the previously seen row.  That code forgot to set the  
TupleTableSlots back to what they were originally, which could result in  
errors such as:  
  
ERROR:  attribute 1 of type record has wrong type  
  
This only affects aggregate functions which have multiple arguments when  
DISTINCT is used.  For example: string_agg(DISTINCT col, ', ')  
  
Thanks to Tom Lane for identifying the breaking commit.  
  
Bug: #18264  
Reported-by: Vojtěch Beneš  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16, where 1349d2790 was added  

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

Track conflict_reason in pg_replication_slots.

commit   : 007693f2a3ac2ac19affcb03ad43cdb36ccff5b5    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 4 Jan 2024 08:21:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 4 Jan 2024 08:21:51 +0530    

Click here for diff

This patch changes the existing 'conflicting' field to 'conflict_reason'  
in pg_replication_slots. This new field indicates the reason for the  
logical slot's conflict with recovery. It is always NULL for physical  
slots, as well as for logical slots which are not invalidated. The  
non-NULL values indicate that the slot is marked as invalidated. Possible  
values are:  
  
wal_removed = required WAL has been removed.  
rows_removed = required rows have been removed.  
wal_level_insufficient = the primary doesn't have a wal_level sufficient  
to perform logical decoding.  
  
The existing users of 'conflicting' column can get the same answer by  
using 'conflict_reason' IS NOT NULL.  
  
Author: Shveta Malik  
Reviewed-by: Amit Kapila, Bertrand Drouvot, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/slotfuncs.c
M src/bin/pg_upgrade/info.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/regress/expected/rules.out

commit   : 29275b1d177096597675b5c6e7e7c9db2df8f4df    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 3 Jan 2024 20:49:05 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 3 Jan 2024 20:49:05 -0500    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 12  

M COPYRIGHT
M configure
M configure.ac
M contrib/adminpack/adminpack.c
M contrib/adminpack/meson.build
M contrib/amcheck/meson.build
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/t/005_pitr.pl
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auth_delay/meson.build
M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/meson.build
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/meson.build
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/basic_archive/meson.build
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/bloom/meson.build
M contrib/bloom/t/001_wal.pl
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/dblink.c
M contrib/dblink/meson.build
M contrib/dict_int/dict_int.c
M contrib/dict_int/meson.build
M contrib/dict_xsyn/dict_xsyn.c
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/daitch_mokotoff.c
M contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/hstore_subs.c
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intagg/meson.build
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/intarray/meson.build
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/meson.build
M contrib/oid2name/meson.build
M contrib/oid2name/t/001_basic.pl
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/meson.build
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/meson.build
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/meson.build
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/t/010_restart.pl
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/meson.build
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_walinspect/meson.build
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/meson.build
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/seg/meson.build
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/meson.build
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/meson.build
M contrib/tcn/tcn.c
M contrib/test_decoding/meson.build
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/meson.build
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/meson.build
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/meson.build
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/meson.build
M contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M contrib/xml2/meson.build
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/generate-targets-meson.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/meson.build
M doc/src/sgml/targets-meson.txt
M meson.build
M meson_options.txt
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/brin/meson.build
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/meson.build
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/syncscan.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gin/meson.build
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/gist/meson.build
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/hash/meson.build
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/meson.build
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/index/meson.build
M src/backend/access/meson.build
M src/backend/access/nbtree/meson.build
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/meson.build
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/meson.build
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/meson.build
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/meson.build
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/meson.build
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/archive/meson.build
M src/backend/archive/shell_archive.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_sink.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/meson.build
M src/backend/backup/walsummary.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/bootstrap/meson.build
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/meson.build
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/meson.build
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/meson.build
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/foreign/meson.build
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/jit/llvm/meson.build
M src/backend/jit/meson.build
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/meson.build
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/meson.build
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/main/meson.build
M src/backend/meson.build
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/meson.build
M src/backend/nodes/multibitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/geqo/meson.build
M src/backend/optimizer/meson.build
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/meson.build
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/meson.build
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/meson.build
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/meson.build
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/gramparse.h
M src/backend/parser/meson.build
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/meson.build
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/po/meson.build
M src/backend/port/atomics.c
M src/backend/port/meson.build
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/meson.build
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/meson.build
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/meson.build
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/meson.build
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/buffer/meson.build
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/meson.build
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/freespace/meson.build
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/large_object/meson.build
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/meson.build
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/meson.build
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/page/meson.build
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/meson.build
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/meson.build
M src/backend/storage/sync/sync.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/meson.build
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/meson.build
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/meson.build
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/error/meson.build
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/fmgr/meson.build
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/meson.build
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/meson.build
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/init/usercontext.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/meson.build
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/meson.build
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_internal.h
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/meson.build
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/meson.build
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/postprocess_dtrace.sed
M src/backend/utils/probes.d
M src/backend/utils/resowner/meson.build
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/meson.build
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/meson.build
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/initdb/meson.build
M src/bin/initdb/po/meson.build
M src/bin/initdb/t/001_initdb.pl
M src/bin/meson.build
M src/bin/pg_amcheck/Makefile
M src/bin/pg_amcheck/meson.build
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/011_in_place_tablespace.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/meson.build
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_combinebackup/Makefile
M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/backup_label.h
M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/copy_file.h
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_combinebackup/load_manifest.h
M src/bin/pg_combinebackup/meson.build
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/po/meson.build
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/reconstruct.h
M src/bin/pg_combinebackup/t/001_basic.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_combinebackup/t/003_timeline.pl
M src/bin/pg_combinebackup/t/004_manifest.pl
M src/bin/pg_combinebackup/t/005_integrity.pl
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_combinebackup/write_manifest.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/meson.build
M src/bin/pg_config/pg_config.c
M src/bin/pg_config/po/meson.build
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/meson.build
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_gzip.h
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_lz4.h
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_none.h
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/filter.c
M src/bin/pg_dump/filter.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/po/meson.build
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/meson.build
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_rewind/rewind_source.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/t/001_basic.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/po/meson.build
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/meson.build
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/pgevent/Makefile
M src/bin/pgevent/meson.build
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/meson.build
M src/bin/psql/po/meson.build
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/meson.build
M src/bin/scripts/pg_isready.c
M src/bin/scripts/po/meson.build
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/common/archive.c
M src/common/base64.c
M src/common/binaryheap.c
M src/common/blkreftable.c
M src/common/checksum_helper.c
M src/common/compression.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/encnames.c
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/hashfn.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/ip.c
M src/common/jsonapi.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/md5_common.c
M src/common/md5_int.h
M src/common/meson.build
M src/common/parse_manifest.c
M src/common/percentrepl.c
M src/common/pg_get_line.c
M src/common/pg_lzcompress.c
M src/common/pg_prng.c
M src/common/pgfnames.c
M src/common/protocol_openssl.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha1.c
M src/common/sha1_int.h
M src/common/sha2.c
M src/common/sha2_int.h
M src/common/sprompt.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/category_test.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/generate-unicode_version.pl
M src/common/unicode/meson.build
M src/common/unicode/norm_test.c
M src/common/unicode_category.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/common/wchar.c
M src/fe_utils/Makefile
M src/fe_utils/archive.c
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/connect_utils.c
M src/fe_utils/mbprint.c
M src/fe_utils/meson.build
M src/fe_utils/option_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrdesc_utils.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/syncscan.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogarchive.h
M src/include/access/xlogbackup.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/archive/archive_module.h
M src/include/archive/shell_archive.h
M src/include/backup/backup_manifest.h
M src/include/backup/basebackup.h
M src/include/backup/basebackup_incremental.h
M src/include/backup/basebackup_sink.h
M src/include/backup/basebackup_target.h
M src/include/backup/walsummary.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/meson.build
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/proclang.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/common/archive.h
M src/include/common/base64.h
M src/include/common/blkreftable.h
M src/include/common/checksum_helper.h
M src/include/common/compression.h
M src/include/common/config_info.h
M src/include/common/connect.h
M src/include/common/controldata_utils.h
M src/include/common/cryptohash.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/hashfn.h
M src/include/common/hmac.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/jsonapi.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/openssl.h
M src/include/common/parse_manifest.h
M src/include/common/percentrepl.h
M src/include/common/pg_prng.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha1.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_category.h
M src/include/common/unicode_category_table.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_version.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execAsync.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMemoize.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidrangescan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/archive.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect_utils.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/option_utils.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/query_utils.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/sort_template.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be-fe-helpers.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/protocol.h
M src/include/libpq/sasl.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/meson.build
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/meson.build
M src/include/nodes/miscnodes.h
M src/include/nodes/multibitmapset.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/queryjumble.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pch/meson.build
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/pg_iovec.h
M src/include/port/pg_lfind.h
M src/include/port/simd.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walsummarizer.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSearchCycle.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/fileset.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/md.h
M src/include/storage/meson.build
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilelocator.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/cmdtag.h
M src/include/tcop/cmdtaglist.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/conffiles.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/meson.build
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pgstat_internal.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenumbermap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/wait_event.h
M src/include/utils/xid8.h
M src/include/utils/xml.h
M src/include/varatt.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/meson.build
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/compat_oracle/meson.build
M src/interfaces/ecpg/test/connect/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/ecpg/test/pgtypeslib/meson.build
M src/interfaces/ecpg/test/preproc/meson.build
M src/interfaces/ecpg/test/sql/meson.build
M src/interfaces/ecpg/test/thread/meson.build
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/fe-trace.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/interfaces/libpq/test/libpq_testclient.c
M src/interfaces/libpq/test/libpq_uri_regress.c
M src/interfaces/libpq/test/meson.build
M src/interfaces/libpq/win32.c
M src/interfaces/meson.build
M src/makefiles/meson.build
M src/meson.build
M src/pl/meson.build
M src/pl/plperl/meson.build
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/plperl_system.h
M src/pl/plperl/po/meson.build
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/meson.build
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/meson.build
M src/pl/plpython/plpython.h
M src/pl/plpython/plpython_system.h
M src/pl/plpython/po/meson.build
M src/pl/tcl/generate-pltclerrcodes.pl
M src/pl/tcl/meson.build
M src/pl/tcl/po/meson.build
M src/port/bsearch_arg.c
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/explicit_bzero.c
M src/port/getpeereid.c
M src/port/kill.c
M src/port/meson.build
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_loongarch.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pthread_barrier_wait.c
M src/port/quotes.c
M src/port/snprintf.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/user.c
M src/port/win32common.c
M src/port/win32dlopen.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32fdatasync.c
M src/port/win32fseek.c
M src/port/win32getrusage.c
M src/port/win32link.c
M src/port/win32ntdll.c
M src/port/win32pread.c
M src/port/win32pwrite.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32stat.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/authentication/meson.build
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/authentication/t/005_sspi.pl
M src/test/authentication/t/006_login_trigger.pl
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/icu/Makefile
M src/test/icu/meson.build
M src/test/icu/t/010_database.pl
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/meson.build
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/kerberos/meson.build
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl
M src/test/locale/sort-test.pl
M src/test/meson.build
M src/test/modules/brin/meson.build
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/modules/commit_ts/meson.build
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/ldap_password_func/Makefile
M src/test/modules/ldap_password_func/ldap_password_func.c
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/meson.build
M src/test/modules/plsample/meson.build
M src/test/modules/plsample/plsample.c
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_copy_callbacks/test_copy_callbacks.c
M src/test/modules/test_custom_rmgrs/meson.build
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_dsa/meson.build
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_lfind/test_lfind.c
M src/test/modules/test_misc/meson.build
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_parser/meson.build
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_regex/meson.build
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_resowner/meson.build
M src/test/modules/test_resowner/test_resowner_basic.c
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/test_slru/meson.build
M src/test/modules/test_slru/test_slru.c
M src/test/modules/unsafe_tests/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi.c
M src/test/modules/xid_wraparound/meson.build
M src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/modules/xid_wraparound/t/003_wraparounds.pl
M src/test/modules/xid_wraparound/xid_wraparound.c
M src/test/perl/Makefile
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/perl/meson.build
M src/test/recovery/Makefile
M src/test/recovery/meson.build
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/036_truncated_dropped.pl
M src/test/recovery/t/037_invalid_database.pl
M src/test/recovery/t/038_save_logical_slots_shutdown.pl
M src/test/recovery/t/039_end_of_wal.pl
M src/test/regress/GNUmakefile
M src/test/regress/meson.build
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/regress/sql/xml.sql
M src/test/ssl/Makefile
M src/test/ssl/meson.build
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/Makefile
M src/test/subscription/meson.build
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/meson.build
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/tznames/meson.build
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/fix-old-flex-code.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/ifaddrs/Makefile
M src/tools/mark_pgdllimport.pl
M src/tools/msvc_gendef.pl
M src/tools/pg_bsd_indent/Makefile
M src/tools/pg_bsd_indent/meson.build
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pg_bsd_indent/tests/comments.pro
M src/tools/pg_bsd_indent/tests/elsecomment.pro
M src/tools/pg_bsd_indent/tests/label.pro
M src/tools/pg_bsd_indent/tests/nsac.pro
M src/tools/pg_bsd_indent/tests/sac.pro
M src/tools/pg_bsd_indent/tests/surplusbad.pro
M src/tools/pg_bsd_indent/tests/types_from_file.list
M src/tools/pg_bsd_indent/tests/types_from_file.pro
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

doc: fix typo "vertexes" -> "vertices"

commit   : 793ecff7df80c5ffe598e431a6c2aca1d4c64eff    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jan 2024 08:47:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jan 2024 08:47:34 +0900    

Click here for diff

The "vertexes" spelling is also valid, but we consistently use  
"vertices" elsewhere.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Shubham Khanna  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Avoid masking EOF (no-password-supplied) conditions in auth.c.

commit   : aaf09c5923b8123ff01421eb1263db64a629aed3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2024 17:40:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2024 17:40:38 -0500    

Click here for diff

CheckPWChallengeAuth() would return STATUS_ERROR if the user does not  
exist or has no password assigned, even if the client disconnected  
without responding to the password challenge (as libpq often will,  
for example).  We should return STATUS_EOF in that case, and the  
lower-level functions do, but this code level got it wrong since the  
refactoring done in 7ac955b34.  This breaks the intent of not logging  
anything for EOF cases (cf. comments in auth_failed()) and might  
also confuse users of ClientAuthentication_hook.  
  
Per report from Liu Lang.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c

Second attempt at organizing jsonpath operators and methods

commit   : 59fd390d5e8a7e169ff8f095882e32e189f3c5bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 21:56:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 21:56:41 +0100    

Click here for diff

Second attempt at 283a95da923.  Since we can't reorder the enum values  
of JsonPathItemType, instead reorder the switch cases where they are  
used to generally follow the order of the enum values, for better  
maintainability.  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/jsonpath.h

Revert "Reorganise jsonpath operators and methods"

commit   : 0958f8f6bf60639a1d22d78d5b49a6092b11833d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 21:02:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 21:02:49 +0100    

Click here for diff

This reverts commit 283a95da923605c1cc148155db2d865d0801b419.  
  
The reordering of JsonPathItemType affects the binary on-disk  
compatibility of the jsonpath type, so we must not change it.  Revert  
for now and consider.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h

Doc: Python's control flow construct is try/except not try/catch.

commit   : 76ba8a8b631454ad06b6d4dd186ef2a739f0f7ce    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2024 12:22:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2024 12:22:00 -0500    

Click here for diff

Very ancient thinko, dating evidently to 22690719e.  
Spotted by gweatherby.  
  
Discussion: https://postgr.es/m/170423637139.1288848.11840082988774620003@wrigleys.postgresql.org  

M doc/src/sgml/plpython.sgml

Fix defects in PrepareForIncrementalBackup.

commit   : dffde5bf16a590543a35bedffc936a33686651d4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 3 Jan 2024 09:59:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 3 Jan 2024 09:59:46 -0500    

Click here for diff

Swap the arguments to TimestampDifferenceMilliseconds so that we get  
a positive answer instead of zero.  
  
Then use the result of that computation instead of ignoring it.  
  
Per reports from Alexander Lakhin.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/backup/basebackup_incremental.c

Make Perl warnings fatal in newly added TAP tests

commit   : 8ce5aef2e6337a5c1f6693c486c28310c2b35dfc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 13:16:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 13:16:55 +0100    

Click here for diff

New TAP tests added by commits 9a17be1e and 4710b67d missed to convert  
warnings to FATAL.  This commit fixes that.  
  
Author: Bharath Rupireddy <[email protected]>  

M contrib/pg_stat_statements/t/010_restart.pl
M src/bin/pg_upgrade/t/004_subscription.pl

Reorganise jsonpath operators and methods

commit   : 283a95da923605c1cc148155db2d865d0801b419    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 11:25:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 11:25:33 +0100    

Click here for diff

Various jsonpath operators and methods add various keywords, switch  
cases, and documentation entries in some order.  However, they are not  
consistent; reorder them for better maintainability or readability.  
  
Author: Jeevan Chalke <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAM2+6=XjTyqrrqHAOj80r0wVQxJSxc0iyib9bPC55uFO9VKatg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h

Add numeric_int8_opt_error() to optionally suppress errors

commit   : c1b9e1e56d8c11a00869766a02de537d349586cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 10:05:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 10:05:35 +0100    

Click here for diff

This matches the existing numeric_int4_opt_error() (see commit  
16d489b0fe).  It will be used by a future JSON-related patch, which  
wants to report errors in its own way and thus does not want the  
internal functions to throw any error.  
  
Author: Jeevan Chalke <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAM2+6=XjTyqrrqHAOj80r0wVQxJSxc0iyib9bPC55uFO9VKatg@mail.gmail.com  

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

Refactor: separate function to find all objects depending on a column

commit   : d4e66a39eb96ca514e3f49c85cf0b4b6f138854e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 08:48:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2024 08:48:09 +0100    

Click here for diff

Move code from ATExecAlterColumnType() that finds the all the objects  
that depend on the column to a separate function.  A future patch will  
reuse this code.  
  
Author: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b94yyJeGA-5M951_Lr+KfZokOp-2kXicpmEhi5FXhBeTog@mail.gmail.com  

M src/backend/commands/tablecmds.c

Fix some typos

commit   : 359a3c586d7f2fdcb7d919bcc8822993b47ada1c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 3 Jan 2024 14:22:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 3 Jan 2024 14:22:54 +0900    

Click here for diff

Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Shubham Khanna  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/interfaces/ecpg/preproc/type.c
M src/tools/ci/ci_macports_packages.sh

Remove unnecessary PGDATABASE settings from TAP tests

commit   : 4b66d7b4e0b3bb55c04fe9466b428c24d7cb0980    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 3 Jan 2024 10:28:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 3 Jan 2024 10:28:05 +0900    

Click here for diff

Some of the TAP tests have been historically setting the environment  
variable PGDATABASE to 'postgres', which is not needed because  
PostgreSQL::Test::Cluster already sets it when initialized.  This commit  
removes these explicit setups.  
  
Note that the dependency of cluster -a with PGDATABASE (from  
1caef31d9e55) is still documented.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXLAz5dW3ZP+Fec8g6jQMMmDyCVT+qdbye2h7QJJmhsdw@mail.gmail.com  

M src/bin/scripts/t/011_clusterdb_all.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/019_replslot_limit.pl

Minor fixes for search path cache code.

commit   : ae6bc39317f59dff5eb549e77d3f7e330e9ba075    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jan 2024 14:57:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jan 2024 14:57:21 -0500    

Click here for diff

Avoid leaving a dangling pointer in the unlikely event that  
nsphash_create fails.  Improve comments, and fix formatting by  
adding typedefs.list entries.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/tools/pgindent/typedefs.list

Remove Lock suffix from WALSummarizerLock in wait_event_names.txt

commit   : 371b07e8944983261a0f73c3b52dbbf0fd076a96    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 13:17:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 13:17:23 -0500    

Click here for diff

Nathan Bossart  
  
Discussion: https://postgr.es/m/20240102173120.GA1061678@nathanxps13  

M src/backend/utils/activity/wait_event_names.txt

jsonpath_exec: fix typo "absense" -> "absence"

commit   : 5bc7b33b4e16d02fc21b493649939e438b071850    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:27:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:27:38 -0500    

Click here for diff

Dagfinn Ilmari Mannsåker, reviewed by Shubham Khanna.  
  
Discussion: http://postgr.es/m/[email protected]  

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

libpq: fix typo "occurences" -> "occurrences" in tests

commit   : ff09129bec28028c57eb263cbca2836f42c2256c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:27:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:27:09 -0500    

Click here for diff

Dagfinn Ilmari Mannsåker, reviewed by Shubham Khanna.  
  
Discussion: http://postgr.es/m/[email protected]  

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

gist: fix typo "split(t)ed" -> "split"

commit   : e62e73f3a2f2af765a3c69486ed78a5bc451367e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:24:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:24:28 -0500    

Click here for diff

Dagfinn Ilmari Mannsåker, reviewed by Shubham Khanna.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistxlog.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/tools/pgindent/typedefs.list

tsquery: fix typo "rewrited" -> "rewritten"

commit   : 591cf626e71b460c53bef23347b93a0cfbd91f0f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:23:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 12:23:36 -0500    

Click here for diff

Dagfinn Ilmari Mannsåker, reviewed by Shubham Khanna.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix typos in comments and in one isolation test.

commit   : 0d9937d1185629a94bf43dd0768c8f4eb835c9f0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 11:56:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 11:56:02 -0500    

Click here for diff

Dagfinn Ilmari Mannsåker, reviewed by Shubham Khanna. Some subtractions  
by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/bloom/bloom.h
M contrib/pgcrypto/expected/pgp-compression.out
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/sql/pgp-compression.sql
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/access/brin/brin.c
M src/backend/access/common/heaptuple.c
M src/backend/access/nbtree/nbtree.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/event_trigger.c
M src/backend/executor/execMain.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/time/combocid.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/include/pg_config_manual.h
M src/test/isolation/specs/stats.spec
M src/test/regress/expected/boolean.out
M src/test/regress/expected/brin_multi.out
M src/test/regress/expected/join.out
M src/test/regress/sql/boolean.sql
M src/test/regress/sql/brin_multi.sql
M src/test/regress/sql/join.sql

Add WALSummarizerLock to wait_event_names.txt

commit   : 5c430f9dc559ecd3bda8bebf4854f3f8d8bd86f3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 10:31:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 2 Jan 2024 10:31:49 -0500    

Click here for diff

Per report from Nathan Bossart.  
  
Discussion: http://postgr.es/m/20231227153647.GA601861@nathanxps13  

M src/backend/utils/activity/wait_event_names.txt

Fix typos in simplehash.h

commit   : 141752bbb0308a40bdbef3ab0a2ba31162813412    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jan 2024 10:18:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jan 2024 10:18:47 +0100    

Click here for diff

Author: Richard Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/lib/simplehash.h

Replace the relid in some missing fields during SJE

commit   : a7928a57b9f00c14dd1e257aaad9bffb7f5c98c8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 2 Jan 2024 09:48:50 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 2 Jan 2024 09:48:50 +0200    

Click here for diff

Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/a89f480f-8143-0965-f22d-0a892777f501%40gmail.com  
Author: Andrei Lepikhov  

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

Allow upgrades to preserve the full subscription's state.

commit   : 9a17be1e244a45a77de25ed2ada246fd34e4557d    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Jan 2024 08:08:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Jan 2024 08:08:46 +0530    

Click here for diff

This feature will allow us to replicate the changes on subscriber nodes  
after the upgrade.  
  
Previously, only the subscription metadata information was preserved.  
Without the list of relations and their state, it's not possible to  
re-enable the subscriptions without missing some records as the list of  
relations can only be refreshed after enabling the subscription (and  
therefore starting the apply worker).  Even if we added a way to refresh  
the subscription while enabling a publication, we still wouldn't know  
which relations are new on the publication side, and therefore should be  
fully synced, and which shouldn't.  
  
To preserve the subscription relations, this patch teaches pg_dump to  
restore the content of pg_subscription_rel from the old cluster by using  
binary_upgrade_add_sub_rel_state SQL function. This is supported only  
in binary upgrade mode.  
  
The subscription's replication origin is needed to ensure that we don't  
replicate anything twice.  
  
To preserve the replication origins, this patch teaches pg_dump to update  
the replication origin along with creating a subscription by using  
binary_upgrade_replorigin_advance SQL function to restore the  
underlying replication origin remote LSN. This is supported only in  
binary upgrade mode.  
  
pg_upgrade will check that all the subscription relations are in 'i'  
(init) or in 'r' (ready) state and will error out if that's not the case,  
logging the reason for the failure. This helps to avoid the risk of any  
dangling slot or origin after the upgrade.  
  
Author: Vignesh C, Julien Rouhaud, Shlok Kyal  
Reviewed-by: Peter Smith, Masahiko Sawada, Michael Paquier, Amit Kapila, Hayato Kuroda  
Discussion: https://postgr.es/m/20230217075433.u5mjly4d5cr4hcfe@jrouhaud  

M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/pg_upgrade.h
A src/bin/pg_upgrade/t/004_subscription.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_subscription_rel.h
M src/tools/pgindent/typedefs.list

Turn AT_PASS_* macros into an enum

commit   : cea89c93a10216e54974764b40799ba7ceb6b920    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jan 2024 19:17:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jan 2024 19:17:18 +0100    

Click here for diff

This make this code simpler and easier to follow.  Also, patches that  
want to change the passes won't have to renumber the whole list.  
  
Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b94yyJeGA-5M951_Lr+KfZokOp-2kXicpmEhi5FXhBeTog@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/tools/pgindent/typedefs.list

Revert "pg_stat_statements: Add coverage for entry_dealloc()"

commit   : 1141e29b61e9bf82b045540d41b27581fc3207ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 31 Dec 2023 15:30:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 31 Dec 2023 15:30:57 +0100    

Click here for diff

This reverts commit 742f6b3e6df980d7dafa4a18a165d285483d5f0e.  
  
The new test failed on big-endian platforms.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_stat_statements/Makefile
D contrib/pg_stat_statements/expected/max.out
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.conf
D contrib/pg_stat_statements/sql/max.sql

Exclude files generated by generate-wait_event_types.pl from pgindent

commit   : a99009a9a32c2b0edd7b6632c37bc2fb6c4f594e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 31 Dec 2023 18:06:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 31 Dec 2023 18:06:56 +0900    

Click here for diff

The format of these files becomes arguably worse after being indented,  
and, as they are generated, there is no point in applying an indentation  
anyway.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACW2JUocmieuR3n9AXL4iSsHcL1LmNkiukuFRUvKNMoiKg@mail.gmail.com  

M src/tools/pgindent/exclude_file_patterns

Fix parallel BRIN builds with synchronized scans

commit   : cb44a8345e7c248cf4158f2702fd9c9358399cfb    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 30 Dec 2023 22:59:42 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 30 Dec 2023 22:59:42 +0100    

Click here for diff

The brinbuildCallbackParallel callback used by parallel BRIN builds did  
not consider that the parallel table scans may be synchronized, starting  
from an arbitrary block and then wrap around.  
  
If this happened and the scan actually did wrap around, tuples from the  
beginning of the table were added to the last range produced by the same  
worker. The index would be missing range at the beginning of the table,  
while the last range would be too wide. This would not produce incorrect  
query results, but it'd be less efficient.  
  
Fixed by checking for both past and future ranges in the callback. The  
worker may produce multiple summaries for the same page range, but the  
leader will merge them as if the summaries came from different workers.  
  
Discussion: https://postgr.es/m/c2ee7d69-ce17-43f2-d1a0-9811edbda6e6%40enterprisedb.com  

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

Minor cleanup of the BRIN parallel build code

commit   : 6c63bcbf3ccf555f02a8fd8b2acaf01a6e94cb97    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 30 Dec 2023 22:50:54 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 30 Dec 2023 22:50:54 +0100    

Click here for diff

Commit b437571714 added support for parallel builds for BRIN indexes,  
using code similar to BTREE parallel builds, and also a new tuplesort  
variant. This commit simplifies the new code in two ways:  
  
* The "spool" grouping tuplesort and the heap/index is not necessary.  
  The heap/index are available as separate arguments, causing confusion.  
  So remove the spool, and use the tuplesort directly.  
  
* The new tuplesort variant does not need the heap/index, as it sorts  
  simply by the range block number, without accessing the tuple data.  
  So simplify that too.  
  
Initial report and patch by Ranier Vilela, further cleanup by me.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqD7f2i4iyEaAz-5o-bf6zXVX-AkNUBm-YjUXEemaEh6A%40mail.gmail.com  

M src/backend/access/brin/brin.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/utils/tuplesort.h
M src/tools/pgindent/typedefs.list

Don't send "cannot connect" errors on invalid startup packet

commit   : 5632d6e18a8afd586a99f680eddddc38b4ead769    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 30 Dec 2023 22:18:54 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 30 Dec 2023 22:18:54 +0200    

Click here for diff

Commit 16671ba6e7 moved the code that sends "sorry, too many clients  
already" and other such messages, but it had the effect that we would  
send that error even if the the startup packet processing failed, e.g.  
because the client sent an invalid startup packet. That was not  
intentional.  
  
Spotted while reading the code again.  

M src/backend/postmaster/postmaster.c

pg_stat_statements: Add TAP test for testing restarts

commit   : 4710b67d4d35832223dc49ccc2ccc043dff53793    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 19:55:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 19:55:32 +0100    

Click here for diff

This tests that pg_stat_statement contents are successfully kept  
across restart.  (This similar to  
src/test/recovery/t/029_stats_restart.pl for the stats collector.)  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/t/010_restart.pl

pg_stat_statements: Add coverage for entry_dealloc()

commit   : 742f6b3e6df980d7dafa4a18a165d285483d5f0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 19:55:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 19:55:32 +0100    

Click here for diff

This involves creating more than pg_stat_statements.max entries and  
checking that the limit is kept and the least used entries are kicked  
out.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/max.out
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.conf
A contrib/pg_stat_statements/sql/max.sql

Add GUC backtrace_on_internal_error

commit   : a740b213d4b4d3360ad0cac696e47e5ec0eb8864    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 11:11:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Dec 2023 11:11:26 +0100    

Click here for diff

When enabled (default off), this logs a backtrace anytime elog() or an  
equivalent ereport() for internal errors is called.  
  
This is not well covered by the existing backtrace_functions, because  
there are many equally-worded low-level errors in many functions.  And  
if you find out where the error is, then you need to manually rewrite  
the elog() to ereport() to attach the errbacktrace(), which is  
annoying.  Having a backtrace automatically on every elog() call could  
be very helpful during development for various kinds of common errors  
from palloc, syscache, node support, etc.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc.h

Follow-up fixes for "Make all Perl warnings fatal"

commit   : 9d49837d7144e27ad8ea8918acb28f9872cb1585    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Dec 2023 23:54:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Dec 2023 23:54:40 +0100    

Click here for diff

Mostly, we need to check whether $ENV{PG_TEST_EXTRA} is set before  
doing regular expression matches against it.  

M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/modules/xid_wraparound/t/003_wraparounds.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Fix collate.windows.win1252 test.

commit   : 2c321ceaa904eb2722050abd35bf4eaea434c8b5    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 29 Dec 2023 11:26:10 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 29 Dec 2023 11:26:10 -0800    

Click here for diff

Do not rely on the OS recognizing a particular locale; find the right  
locale by querying the "en_US" collation.  
  
Author: Alexander Lakhin  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/collate.windows.win1252.out
M src/test/regress/sql/collate.windows.win1252.sql

Make all Perl warnings fatal

commit   : c5385929593dd8499cfb5d85ac322e8ee1819fd4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Dec 2023 18:01:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Dec 2023 18:01:53 +0100    

Click here for diff

There are a lot of Perl scripts in the tree, mostly code generation  
and TAP tests.  Occasionally, these scripts produce warnings.  These  
are probably always mistakes on the developer side (true positives).  
Typical examples are warnings from genbki.pl or related when you make  
a mess in the catalog files during development, or warnings from tests  
when they massage a config file that looks different on different  
hosts, or mistakes during merges (e.g., duplicate subroutine  
definitions), or just mistakes that weren't noticed because there is a  
lot of output in a verbose build.  
  
This changes all warnings into fatal errors, by replacing  
  
    use warnings;  
  
by  
  
    use warnings FATAL => 'all';  
  
in all Perl files.  
  
Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org  

M config/check_modules.pl
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/t/005_pitr.pl
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/bloom/t/001_wal.pl
M contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/oid2name/t/001_basic.pl
M contrib/pg_prewarm/t/001_basic.pl
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/vacuumlo/t/001_basic.pl
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/generate-targets-meson.pl
M doc/src/sgml/mk_feature_tables.pl
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/nodes/gen_node_support.pl
M src/backend/parser/check_keywords.pl
M src/backend/snowball/snowball_create.pl
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/011_in_place_tablespace.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_combinebackup/t/001_basic.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_combinebackup/t/003_timeline.pl
M src/bin/pg_combinebackup/t/004_manifest.pl
M src/bin/pg_combinebackup/t/005_integrity.pl
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/t/001_basic.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/create_help.pl
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/generate-unicode_version.pl
M src/include/catalog/duplicate_oids
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/unused_oids
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/tcl/generate-pltclerrcodes.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/authentication/t/005_sspi.pl
M src/test/authentication/t/006_login_trigger.pl
M src/test/icu/t/010_database.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl
M src/test/locale/sort-test.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_misc/t/004_io_direct.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/modules/xid_wraparound/t/003_wraparounds.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/perl/README
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/036_truncated_dropped.pl
M src/test/recovery/t/037_invalid_database.pl
M src/test/recovery/t/038_save_logical_slots_shutdown.pl
M src/test/recovery/t/039_end_of_wal.pl
M src/test/recovery/t/cp_history_files
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/100_bugs.pl
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/ci/windows_build_config.pl
M src/tools/copyright.pl
M src/tools/fix-old-flex-code.pl
M src/tools/gen_export.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/mark_pgdllimport.pl
M src/tools/msvc_gendef.pl
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl

In pg_dump, don't dump a stats object unless dumping underlying table.

commit   : 7418767f11d11ca4003ed3e8e96296eabb2acfe1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Dec 2023 10:57:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Dec 2023 10:57:11 -0500    

Click here for diff

If the underlying table isn't being dumped, it's useless to dump  
an extended statistics object; it'll just cause errors at restore.  
We have always applied similar policies to, say, indexes.  
  
(When and if we get cross-table stats objects, it might be profitable  
to think a little harder about what to do with them.  But for now  
there seems no point in considering a stats object as anything but  
an appendage of its table.)  
  
Rian McGuire and Tom Lane, per report from Rian McGuire.  
Back-patch to supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix variable name and comment

commit   : 541e8f14a185495f814ae0a0876a0d0c4118833a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Dec 2023 17:25:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Dec 2023 17:25:47 +0100    

Click here for diff

Should match the name of the related GUC variable.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

doc: Mention AttributeRelationId in FDW validator function description

commit   : f246c48ac4ac323152d3569bed1ccd571a5cc3d8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Dec 2023 20:09:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Dec 2023 20:09:12 +0900    

Click here for diff

The documentation has been missing one value in the list of catalog OIDs  
that can be given to the validator function of a FDW, as of  
AttributeRelationId, when changing the attribute options of a foreign  
table.  
  
Author: Ian Lawrence Barwick  
Discussion: https://postgr.es/m/CAB8KJ=i16t2yJU_Pq2Z+hnNGWFhagp_bJmzxHZu3ZkOjZm-+rQ@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/fdwhandler.sgml

Improve the implementation of information_schema._pg_expandarray().

commit   : 58054de2d0847c09ef091956f72ae5e9fb9a176e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 15:55:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 15:55:46 -0500    

Click here for diff

This function was originally coded with a handmade expansion  
of the array subscripts.  We can do it a little faster and far  
more legibly today, by using unnest() WITH ORDINALITY.  
  
While at it, let's apply the rowcount estimation support that exists  
for the underlying unnest() function: reduce the default ROWS estimate  
to 100 and attach array_unnest_support.  I'm not sure that  
array_unnest_support can do anything useful today with the call sites  
that exist in information_schema, but it can't hurt, and the existing  
default rowcount of 1000 is surely much too high for any of these  
cases.  
  
The psql.sql regression script is using _pg_expandarray() as a  
test case for \sf+.  While we could keep doing so, the new one-line  
function body makes a poor test case for \sf+ row-numbering, so  
switch it to print another information_schema function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/backend/utils/adt/arrayfuncs.c
M src/include/catalog/catversion.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Doc: specify aclitem syntax more clearly.

commit   : 6c361d323b908c0391e05d15afc01957db2e415b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 13:52:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 13:52:01 -0500    

Click here for diff

The previous wording here relied solely on an example to explain  
aclitem output format.  Add an actual syntax synopsis and  
explanation of the elements to make it clearer.  
  
David Johnston and Tom Lane, per gripe from Eugen Konkov.  
  
Discussion: https://postgr.es/m/170326116972.1876499.18357820037829248593@wrigleys.postgresql.org  

M doc/src/sgml/ddl.sgml

Fix another incorrect data type choice from commit dc2123400.

commit   : 3f1fd416316cbb66de61ac1ac34839f025b0b242    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 13:05:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 13:05:16 -0500    

Click here for diff

add_file_to_manifest declared its mtime argument as pg_time_t,  
apparently on the principle that copy-and-paste from the backend  
is fine.  However, the callers are passing struct stat's st_mtime  
field which is plain time_t, and add_file_to_manifest itself is  
passing the value to gmtime(3) which expects plain time_t,  
so the whole thing would not work at all on any platform where  
those types are different.  Fortunately we can just switch this  
variable to time_t.  
  
Per warnings from assorted buildfarm members.  

M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_combinebackup/write_manifest.h

Fix incorrect format placeholders

commit   : 390408ec08d338f36798ec063f81c5098596f8da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 17:39:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 17:39:10 +0100    

Click here for diff

M src/backend/replication/syncrep.c

Fix a warning in Perl test code

commit   : a7ebd82b9e50960cac59868fa1dd3cbe12de8c7b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 17:15:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 17:15:26 +0100    

Click here for diff

The code was passing a scalar argument to node->restart(), but it was  
expecting a hash, which causes a warning from Perl ("Odd number of  
elements in hash assignment").  
  
But the node->restart() function doesn't take a mode argument anyway.  
This was probably copied from an incorrect comment (see commit  
750c59d7ec).  The default restart mode is already "fast", so the test  
should still be semantically correct without explicitly specifying the  
mode.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/recovery/t/006_logical_decoding.pl

Fix incorrect data type choices in some read and write calls.

commit   : 98c6231d198a98b1c5ec9d400cd5593752fa9de9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 11:02:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Dec 2023 11:02:53 -0500    

Click here for diff

Recently-introduced code in reconstruct.c was using "unsigned"  
to store the result of read(), pg_pread(), or write().  This is  
completely bogus: it breaks subsequent tests for the result being  
negative, as we're being reminded of by a chorus of buildfarm  
warnings.  Switch to "int" as was doubtless intended.  (There are  
several other uses of "unsigned" in this file that also look poorly  
chosen to me, but for now I'm just trying to clean up the buildfarm.)  
  
A larger problem is that "int" is not necessarily wide enough to hold  
the result: per POSIX, all these functions return ssize_t.  In places  
where the requested read or write length clearly fits in int, that's  
academic.  It may be academic anyway as long as we constrain  
individual data files to 1GB, since even a readv or writev-like  
operation would then not be responsible for transferring more than  
1GB.  Nonetheless it seems like trouble waiting to happen, so I made  
a pass over readv and writev calls and fixed the result variables  
where that seemed appropriate.  We might want to think about changing  
some of the fd.c functions to return ssize_t too, for future-proofing;  
but I didn't tackle that here.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/backup/basebackup.c
M src/bin/pg_combinebackup/reconstruct.c

Initialize variable to placate compiler.

commit   : da083b20f63739130dd65d8f0ca4a49b6db31cfe    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2023 08:41:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2023 08:41:53 -0500    

Click here for diff

I don't think there's a real problem here, because if we reach  
the loop over 'tles' then we will either find at least one  
TimeLineHistoryEntry such that oldest_segno != 0, in which case  
unsummarized_lsn will be initialized, or else unsummarized_tli  
will remain 0 and an error will occur before unsummarized_lsn  
is used for anything. But some compilers are complainining, as  
reported on list by Nathan Bossart and off-list by Andrew Dunstan.  
  
Discussion: http://postgr.es/m/20231223215147.GA69623@nathanxps13  

M src/backend/postmaster/walsummarizer.c

Improvements and fixes for e0b1ee17dc

commit   : 7e6fb5da41d8ee1bddcd5058b7204018ef68d193    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 14:22:02 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 14:22:02 +0200    

Click here for diff

e0b1ee17dc introduced optimization for matching B-tree scan keys required for  
the directional scan.  However, it incorrectly assumed that all keys required  
for opposite direction scan are satisfied by _bt_first().  It has been  
illustrated that with multiple scan keys over the same column, a lesser one  
(according to the scan direction) could win leaving the other one unsatisfied.  
  
Instead of relying on _bt_first() this commit introduces code that memorizes  
whether there was at least one match on the page.  If that's true we know that  
keys required for opposite-direction scan are satisfied as soon as  
corresponding values are not NULLs.  
  
Also, this commit simplifies the description for the optimization of keys  
required for the current direction scan.  Now the flag used for this is named  
continuescanPrechecked and means exactly that *continuescan flag is known  
to be true for the last item on the page.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzn0LeLcb1PdBnK0xisz8NpHkxRrMr3NWJ%2BKOK-WZ%2BQtTQ%40mail.gmail.com  
Reviewed-by: Pavel Borisov  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Remove BTScanOpaqueData.firstPage

commit   : 06b10f80ba4db745f21847520b07b4ffad814313    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 14:21:49 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 14:21:49 +0200    

Click here for diff

It's not necessary to keep the firstPage flag as a field of BTScanOpaqueData.  
This commit makes it an argument of the _bt_readpage() function.  We can easily  
distinguish first-time and repeated calls (within the scan) of this function.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzk4SOsw%2BtHuTFiz8U9Jqj-R77rYPkhWKODCBb1mdHACXA%40mail.gmail.com  
Reviewed-by: Pavel Borisov  

M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/include/access/nbtree.h

pg_stat_statements: Add test coverage for pg_stat_statements_reset_1_7

commit   : 3e527aeeedb0bbbb2388365147ab00cd0f55dfc4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 10:48:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 10:48:01 +0100    

Click here for diff

Run pg_stat_statements_reset() once while the appropriate extension  
version is installed.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/sql/oldextversions.sql

pg_stat_statements: Add test coverage for pg_stat_statements_1_8()

commit   : 3727b8d0e3f1fa7568f6a6f4378ce5a79daeb0d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 10:48:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Dec 2023 10:48:01 +0100    

Click here for diff

This requires reading pg_stat_statements at least once while the 1.8  
version of the extension is installed.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/sql/oldextversions.sql

Fix typo and case in messages

commit   : 7d7ef075d2b3f3bac4db323c2a47fb15a4a9a817    
  
author   : John Naylor <[email protected]>    
date     : Wed, 27 Dec 2023 13:30:12 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 27 Dec 2023 13:30:12 +0700    

Click here for diff

Follow up to dc2123400  
  
Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/pg_combinebackup.c

Make replace_relid() leave argument unmodified

commit   : e0477837ce49d73c9f21a5e00143b741ce6e1f89    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:29 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:29 +0200    

Click here for diff

There are a lot of situations when we share the same pointer to a Bitmapset  
structure across different places.  In order to evade undesirable side effects  
replace_relid() function should always return a copy.  
  
Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_wJthNtYBL%2BSsebpgF-5L2r5zFFk6xYbS0A78GKOTFHw%40mail.gmail.com  
Reviewed-by: Richard Guo, Andres Freund, Ashutosh Bapat, Andrei Lepikhov  

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

REALLOCATE_BITMAPSETS manual compile-time option

commit   : 7d58f2342bd3d2f0474207b63a3a548c29e20a9e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:23 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:23 +0200    

Click here for diff

This option forces each bitmapset modification to reallocate bitmapset.  This  
is useful for debugging hangling pointers to bitmapset's.  
  
Discussion: https://postgr.es/m/CAMbWs4_wJthNtYBL%2BSsebpgF-5L2r5zFFk6xYbS0A78GKOTFHw%40mail.gmail.com  
Reviewed-by: Richard Guo, Andres Freund, Ashutosh Bapat, Andrei Lepikhov  

M src/backend/nodes/bitmapset.c
M src/include/pg_config_manual.h

Add asserts to bimapset manipulation functions

commit   : 71a3e8c43ba8f3d026ae0cb2c2df27455ffdca76    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:12 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Dec 2023 03:34:12 +0200    

Click here for diff

New asserts validate that arguments are really bitmapsets.  This should help  
to early detect accesses to dangling pointers.  
  
Discussion: https://postgr.es/m/CAMbWs4_wJthNtYBL%2BSsebpgF-5L2r5zFFk6xYbS0A78GKOTFHw%40mail.gmail.com  
Reviewed-by: Richard Guo, Andres Freund, Ashutosh Bapat, Andrei Lepikhov  

M src/backend/nodes/bitmapset.c

Fix failure to verify PGC_[SU_]BACKEND GUCs in pg_file_settings view.

commit   : 059de3ca4766012743b4ff7c8e7193abb71f7189    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 17:57:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 17:57:48 -0500    

Click here for diff

set_config_option() bails out early if it detects that the option to  
be set is PGC_BACKEND or PGC_SU_BACKEND class and we're reading the  
config file in a postmaster child; we don't want to apply any new  
value in such a case.  That's fine as far as it goes, but it fails  
to consider the requirements of the pg_file_settings view: for that,  
we need to check validity of the value even though we have no  
intention to apply it.  Because we didn't, even very silly values  
for affected GUCs would be reported as valid by the view.  There  
are only half a dozen such GUCs, which perhaps explains why this  
got overlooked for so long.  
  
Fix by continuing when changeVal is false; this parallels the logic  
in some other early-exit paths.  
  
Also, the check added by commit 924bcf4f1 to prevent GUC changes in  
parallel workers seems a few bricks shy of a load: it's evidently  
assuming that ereport(elevel, ...) won't return.  Make sure we  
bail out if it does.  The lack of trouble reports suggests that  
this is only a latent bug, i.e. parallel workers don't actually  
reach here with elevel < ERROR.  (Per the code coverage report,  
we never reach here at all in the regression suite.)  But we clearly  
don't want to risk proceeding if that does happen.  
  
Per report from Rıdvan Korkmaz.  These are ancient bugs, so back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix mistaken file name in plpython's meson recipe.

commit   : a46972e30ca7e15b667a47b57b42c9dd78bfaab8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 17:03:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 17:03:02 -0500    

Click here for diff

Brown-paper-bag bug in commit 58c3151bb.  Per buildfarm.  

M src/pl/plpython/meson.build

Hide warnings from Python headers when using gcc-compatible compiler.

commit   : 58c3151bbc045e8f575027f53c79e328381e7e61    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 16:16:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 16:16:29 -0500    

Click here for diff

Like commit 388e80132, use "#pragma GCC system_header" to silence  
warnings appearing within the Python headers, since newer Python  
versions no longer worry about some restrictions we still use like  
-Wdeclaration-after-statement.  
  
This patch improves on 388e80132 by inventing a separate wrapper  
header file, allowing the pragma to be tightly scoped to just  
the Python headers and not other stuff we have laying about in  
plpython.h.  I applied the same technique to plperl for the same  
reason: the original patch suppressed warnings for a good deal  
of our own code, not only the Perl headers.  
  
Like the previous commit, back-patch to supported branches.  
  
Peter Eisentraut and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/GNUmakefile
M src/pl/plperl/meson.build
M src/pl/plperl/plperl.h
A src/pl/plperl/plperl_system.h
M src/pl/plpython/Makefile
M src/pl/plpython/meson.build
M src/pl/plpython/plpython.h
A src/pl/plpython/plpython_system.h

Add meson NLS support for pg_combinebackup

commit   : c4fe2e8220462a9688dba4380bda0ccb2ecaabb7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2023 21:31:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2023 21:31:39 +0100    

Click here for diff

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

doc: add ISO 8601 extended format example using to_char()

commit   : f67a3d42688adf8045fe9bfaec699abbc6a33c83    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Dec 2023 15:31:50 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Dec 2023 15:31:50 -0500    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Erik Wienhold  
  
Backpatch-through: master  

M doc/src/sgml/func.sgml

Add empty placeholder LINGUAS file for pg_combinebackup.

commit   : bbf1f1340800da38625ea7034dca3c14c6431f64    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 14:37:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Dec 2023 14:37:46 -0500    

Click here for diff

This will eventually be replaced once some translations exist  
for pg_combinebackup's messages.  In the meantime, we need  
something here to prevent "make" from complaining in  
builds with --enable-nls.  Per advice added in 88dad06b4.  

A src/bin/pg_combinebackup/po/LINGUAS

Remove unused macro

commit   : d327f418d1e6aea1fee3105853ca5c9ef937ce1f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2023 20:13:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2023 20:13:11 +0100    

Click here for diff

Usage was removed in 6c5576075b but the definition was not removed.  

M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c

Fix some translatable strings in pg_basebackup and pg_combinebackup

commit   : 231ff70f98e389dd510db86d3971b87e92c65d39    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Dec 2023 18:54:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Dec 2023 18:54:36 +0900    

Click here for diff

Two translatable strings introduced in dc212340058b were split into two  
parts, making their translation harder than necessary.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_combinebackup/pg_combinebackup.c

Doc: Add missing pgoutput options.

commit   : 0eac3c798c2d223d6557a5440d7534317dbd4fa0    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 26 Dec 2023 10:30:42 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 26 Dec 2023 10:30:42 +0530    

Click here for diff

We forgot to update the docs while adding new options in pgoutput.  
  
Author: Emre Hasegeli  
Reviewed-by: Peter Smith, Amit Kapila  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CAE2gYzwdwtUbs-tPSV-QBwgTubiyGD2ZGsSnAVsDfAGGLDrGOA%40mail.gmail.com  

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

Fix erroneous -Werror=missing-braces on old GCC.

commit   : bad0763a4d7be3005eae35d460c73ac4bc7ebaad    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Dec 2023 23:36:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Dec 2023 23:36:33 -0500    

Click here for diff

In the same spirit as 5e0c761d0 and some earlier commits,  
suppress a chorus of buildfarm warnings about braces in  
these initializers.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs48GzM-Ff7vr=_CeqaXxFBB9UntqtaW1cjU8hOo62AbOOg@mail.gmail.com  

M src/common/blkreftable.c

Fix a comment for remove_self_joins_recurse()

commit   : 0a93f803f45f45f39473e2c61923c4b4777bc8a8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:31:24 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:31:24 +0200    

Click here for diff

Discussion: https://postgr.es/m/18187-831da249cbd2ff8e%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

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

Don't constrain self-join removal due to PHVs

commit   : b5fb6736ed3b6875e2a4ca39d33325147f535137    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:24:25 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:24:25 +0200    

Click here for diff

Self-join removal appears to be safe to apply with placeholder variables  
as long as we handle PlaceHolderVar in replace_varno_walker() and replace  
relid in phinfo->ph_lateral.  
  
Discussion: https://postgr.es/m/18187-831da249cbd2ff8e%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

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

Handle PlaceHolderVar case in replace_varno_walker

commit   : 8a8ed916f73f4f16e8eb3e0e30ac1201a7642fda    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:16:09 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 01:16:09 +0200    

Click here for diff

This commit also retires sje_walker.  This increases the generalty of replacing  
varno in the parse tree and simplifies the code.  
  
Discussion: https://postgr.es/m/18187-831da249cbd2ff8e%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

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

Enhance checkpointer restartpoint statistics

commit   : 12915a58eec962f407a6c38ce2bf08a48dde57b5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 00:52:42 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Dec 2023 00:52:42 +0200    

Click here for diff

Bhis commit introduces enhancements to the pg_stat_checkpointer view by adding  
three new columns: restartpoints_timed, restartpoints_req, and  
restartpoints_done. These additions aim to improve the visibility and  
monitoring of restartpoint processes on replicas.  
  
Previously, it was challenging to differentiate between successful and failed  
restartpoint requests. This limitation arises because restartpoints on replicas  
are dependent on checkpoint records from the primary, and cannot occur more  
frequently than these checkpoints.  
  
The new columns allow for clear distinction and tracking of restartpoint  
requests, their triggers, and successful completions.  This enhancement aids  
database administrators and developers in better understanding and diagnosing  
issues related to restartpoint behavior, particularly in scenarios where  
restartpoint requests may fail.  
  
System catalog is changed.  Catversion is bumped.  
  
Discussion: https://postgr.es/m/99b2ccd1-a77a-962a-0837-191cdf56c2b9%40inbox.ru  
Author: Anton A. Melnikov  
Reviewed-by: Kyotaro Horiguchi, Alexander Korotkov  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/wal.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/checkpointer.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

pgbench: Fix overflow in table populating when rows >= 2^31-1

commit   : 64e77b496af61ee31189ba69b40e785e11e9967f    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 24 Dec 2023 11:49:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 24 Dec 2023 11:49:14 +0900    

Click here for diff

Using a scale factor large enough so as the number of rows to insert  
gets larger than INT32_MAX would cause an infinite loop in  
initPopulateTable(), preventing pgbench to finish its initialization.  
  
Oversight in e35cc3b3f2d0 that has refactored the data generation logic.  
  
Author: John Hsu  
Reviewed-by: Tatsuo Ishii, Japin Li  
Discussion: https://postgr.es/m/CA+-JvFvHsOafjHcuFPfkyouHNZvbOXhBNhwZxKm3WNgYz9bwzA@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Set readline-relevant ENV vars in interactive_psql(), not caller.

commit   : da44ff312ea3b2868b8fab68944017cb56427709    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Dec 2023 11:50:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Dec 2023 11:50:33 -0500    

Click here for diff

Commit 664d75753 pulled 010_tab_completion.pl's infrastructure for  
invoking an interactive psql session out into a generally-useful test  
function, but it didn't move enough stuff.  We need to set up various  
environment variables that readline will look at, both to ensure  
stability of test results and to prevent test actions from cluttering  
the calling user's ~/.psql_history.  Expecting calling scripts to  
remember to do that is too failure-prone: the other existing caller  
001_password.pl did not do it.  Hence, remove those initialization  
steps from 010_tab_completion.pl and put them into interactive_psql().  
Since interactive_psql was already making a local ENV hash, this has  
no effect on calling scripts.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Set all variable-length fields of pg_attribute to null on column drop

commit   : 3e2e0d5ad7fcb89d18a71cbfc885ef184e1b6f2e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Dec 2023 21:44:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Dec 2023 21:44:55 +0100    

Click here for diff

When a column is dropped, the fields attacl, attoptions, and  
attfdwoptions were kept unchanged.  This is probably harmless, but it  
seems wasteful, and leaves potentially dangling data lying around (for  
example, attacl could contain references to users that are later also  
dropped).  
  
Change this to set those fields to null when a column is marked as  
dropped.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/heap.c

Stop generating plain-text INSTALL instructions.

commit   : e2b73f4a4de6c2df6a1e623ad06b42f1bb2471ad    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Dec 2023 13:32:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Dec 2023 13:32:15 -0500    

Click here for diff

Up to now, our distribution tarballs have included a plain-text form  
of the installation.sgml chapter.  The rationale for that was that a  
recipient might not have either ready internet access or HTML-viewing  
tools; a theory that seems downright quaint today.  Maintaining the  
ability to generate this file is not without cost, because it puts  
special requirements on installation.sgml that are often overlooked.  
Moreover, we are moving in the direction of making our distribution  
tarballs be pure git snapshots for traceability/reproducibility  
reasons; including generated files doesn't fit into that plan.  
Hence, let's just drop INSTALL and remove the infrastructure for  
generating it.  The top-level README will now recommend visiting  
our website to see the installation instructions.  As a useful  
side-effect, we can get rid of README.git which has provoked  
confusion.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M Makefile
M README
D README.git
M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
D doc/src/sgml/standalone-install.xml
D doc/src/sgml/standalone-profile.xsl
M src/pl/plperl/README
M src/tools/RELEASE_CHANGES

Make win32tzlist.pl checkable again

commit   : 8ddf9c1dc020d569d3a0aa22e3269a64e8a4ef23    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 22 Dec 2023 13:56:27 +0000    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 22 Dec 2023 13:56:27 +0000    

Click here for diff

Commit 1301c80b21 removed some infrastructure needed to check  
windows-oriented perl scripts. It also removed most such scripts, but  
this one was left over. We repair the damage by making Win32::Registry a  
conditional requirement that is only loaded on Windows. With this change  
`perl -cw win32tzlist.pl` once again passes on non-Windows machines.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/win32tzlist.pl

Initialize data directories with --lc-messages=C for tests.

commit   : 8793c60051541c8df8dbe133cb9cf8138efe3b3f    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 21 Dec 2023 15:10:13 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 21 Dec 2023 15:10:13 -0800    

Click here for diff

Commit db6d9891e8 changed them to be initialized with --no-locale, but  
that reduced the test coverage for non-C locales.  
  
Discussion: https://postgr.es/m/0d47e5ecc037b3908149aad5f2a987793cf938bd.camel%40j-davis.com  

M meson.build
M src/Makefile.global.in

Replace nonsense comment with a relevant one.

commit   : ffc6ab9b56ae02a64349c8c6b59dd659dab5516a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2023 16:03:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2023 16:03:03 -0500    

Click here for diff

Per report from Alexander Lakhin.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/postmaster/walsummarizer.c

Fix numerous typos in incremental backup commits.

commit   : 49f2194ed5c1f6274ac807fb033880aee0b0d1c3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2023 15:36:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2023 15:36:17 -0500    

Click here for diff

Apparently, spell check would have been a really good idea.  
  
Alexander Lakhin, with a few additions as per an off-list report  
from Andres Freund.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_combinebackup.sgml
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/walsender.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_combinebackup/t/004_manifest.pl
M src/bin/pg_combinebackup/write_manifest.c
M src/common/blkreftable.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

pg_combinebackup didn't clean its tmp_check directory, either.

commit   : ba08c10fcd7f58486e77166fa93e61ed59962da0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 15:04:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 15:04:00 -0500    

Click here for diff

Another oversight in dc2123400, visible when building/testing  
in the source directory.  (There's a lot of stuff we could  
simplify if we stop supporting that case, but for now it's  
still mainstream.)  

M src/bin/pg_combinebackup/Makefile

Avoid trying to fetch metapage of an SPGist partitioned index.

commit   : 903737c5bf9431c2f983c87ac211082418341805    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 12:43:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 12:43:36 -0500    

Click here for diff

This is necessary when spgcanreturn() is invoked on a partitioned  
index, and the failure might be reachable in other scenarios as  
well.  The rest of what spgGetCache() does is perfectly sensible  
for a partitioned index, so we should allow it to go through.  
  
I think the main takeaway from this is that we lack sufficient test  
coverage for non-btree partitioned indexes.  Therefore, I added  
simple test cases for brin and gin as well as spgist (hash and  
gist AMs were covered already in indexing.sql).  
  
Per bug #18256 from Alexander Lakhin.  Although the known test case  
only fails since v16 (3c569049b), I've got no faith at all that there  
aren't other ways to reach this problem; so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgutils.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

pg_combinebackup's .gitignore file is incomplete.

commit   : 0590480132bf5db7383a90a29e7b3e29a2a4743a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 11:50:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2023 11:50:41 -0500    

Click here for diff

Oversight in commit dc2123400, evidently.  

M src/bin/pg_combinebackup/.gitignore

Fix BEFORE ROW trigger handling in cross-partition MERGE update.

commit   : a0ff37173d7d412d53bc299fc611068be3bc7060    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 21 Dec 2023 12:55:22 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 21 Dec 2023 12:55:22 +0000    

Click here for diff

Fix a bug during MERGE if a cross-partition update is attempted on a  
partitioned table with a BEFORE DELETE ROW trigger that returns NULL,  
to prevent the update. This would cause an error to be thrown, or an  
assert failure in an assert-enabled build.  
  
This was an oversight in 9321c79c86, which failed to properly  
distinguish a DELETE prevented by a trigger from one prevented by a  
concurrent update. Fix by having ExecDelete() return the TM_Result  
status to ExecCrossPartitionUpdate(), so that it can distinguish the  
two cases, and make ExecCrossPartitionUpdate() return the TM_Result  
status to ExecUpdateAct(), so that it can return the correct status  
from a concurrent update.  
  
In addition, ensure that the command tag is correctly updated by  
having ExecMergeMatched() pass canSetTag to ExecUpdateAct(), rather  
than passing false, so that it updates the command tag if it does a  
cross-partition update, making this code path in ExecMergeMatched()  
consistent with ExecUpdate().  
  
Per bug #18238 from Alexander Lakhin. Back-patch to v15, where MERGE  
was introduced.  
  
Dean Rasheed, reviewed by Richard Guo and Jian He.  
  
Discussion: https://postgr.es/m/18238-2f2bdc7f720180b9%40postgresql.org  

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

Fix prologue of get_partition_ancestors()

commit   : e557db106ef69413edb75c362191084ee73a0f55    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 11:42:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 11:42:12 +0100    

Click here for diff

The callers of this function assume that the first Oid in the list  
returned by this function corresponds to the immediate parent and the  
last on corresponds to the topmost parent.  Make that explicit in the  
function prologue.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vCbATEmht861=G-BFPHNwLUqyeGa_=8-xibJ6Q1UxAeA@mail.gmail.com  

M src/backend/catalog/partition.c

meson: Make gzip and tar optional

commit   : 9ca6e7b9411e36488ef539a2c1f6846ac92a7072    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 08:40:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 08:40:32 +0100    

Click here for diff

They are only used for some tests.  The tests are already set to skip  
as appropriate if they are not available.  
  
Discussion: https://www.postgresql.org/message-id/flat/ZQzp_VMJcerM1Cs_%40paquier.xyz  

M contrib/basebackup_to_shell/meson.build
M meson.build
M src/bin/pg_basebackup/meson.build
M src/bin/pg_dump/meson.build
M src/bin/pg_verifybackup/meson.build

meson: Make sed optional

commit   : 9aa374dcfb760746cd9ebe248dc68979c18849a5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 08:40:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Dec 2023 08:40:32 +0100    

Click here for diff

sed is used only if dtrace or selinux are enabled.  Those options are  
only used on Unix platforms, which should have sed.  But we don't want  
to make sed a hard requirement on Windows, which was the case in meson  
until now.  
  
This just changes sed to be not-required by meson.  If you happen to  
use a system with, say, dtrace but without sed, you might get a  
slightly complicated error from meson during the build, but that seems  
better than making the requiredness a complicated conditional that  
will need to be maintained.  
  
Discussion: https://www.postgresql.org/message-id/flat/ZQzp_VMJcerM1Cs_%40paquier.xyz  

M meson.build

Add PostgreSQL::Test::Cluster::advance_wal

commit   : c161ab74f76af8e0f3c6b349438525ad9575683b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Dec 2023 10:19:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Dec 2023 10:19:17 +0900    

Click here for diff

This is a function that makes a node jump by N WAL segments, which is  
something a couple of tests have been relying on for some cases related  
to streaming, replication slot limits and logical decoding on standbys.  
Hence, this centralizes the logic, while making it cheaper by relying on  
pg_logical_emit_message() to emit WAL records before switching to a new  
segment.  
  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi, Euler Taveira  
Discussion: https://postgr.es/m/CALj2ACU3R8QFCvDewHCMKjgb2w_-CMCyd6DAK=Jb-af14da5eg@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/035_standby_logical_decoding.pl

Show isCatalogRel in several rmgr descriptions.

commit   : bf6260b39da6ef34c7147d560c49f35d2bbf07c9    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 21 Dec 2023 10:09:38 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 21 Dec 2023 10:09:38 +0900    

Click here for diff

Commit 6af179395 added isCatalogRel field to some WAL record types,  
but this field was not shown in the rmgr descriptions. This commit  
changes the several rmgr descriptions to display the isCatalogRel  
field.  
  
Author: Bertrand Drouvot  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/957dc8f9-2a02-4640-9c01-9dcbf97c4187%40gmail.com  

M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/spgdesc.c

Rename pgindent options

commit   : 387aecc948ed2fa39e04f84d9eea086d32ebd42e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 20 Dec 2023 22:28:57 +0000    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 20 Dec 2023 22:28:57 +0000    

Click here for diff

--show-diff becomes --diff, and --silent-diff becomes --check. These  
options may now be given together. Without --check, --diff will exit  
with a zero status even if diffs are found. With --check, it will now  
exit with a non-zero status in that case.  
  
Author: Tristan Partin  
Reviewed-by: Daniel Gustafsson, Jelte Fennema-Nio  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

doc: Fix typo in pg_combinebackup documentation

commit   : e6c56f2a9d45d2ee636bb94c93a4268c39a1ad18    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 20 Dec 2023 23:07:44 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 20 Dec 2023 23:07:44 +0100    

Click here for diff

Commit dc2123400 accidentally misspelled "combination".  

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

Fix unchecked return value from strdup

commit   : 30e54d5c5d8fceb7287162c116961fa0627544f5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 20 Dec 2023 22:37:28 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 20 Dec 2023 22:37:28 +0100    

Click here for diff

The pg_dump compression was using strdup() instead of pg_strdup()  
and failed to check the returned pointer for out-of-memory before  
dereferencing it. Fix by using pg_strdup() instead which probably  
was the intention here in the original patch.  
  
Backpatch to v16 where pg_dump compression was introduced.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/bin/pg_dump/compress_io.c

Add support for incremental backup.

commit   : dc212340058b4e7ecfc5a7a81ec50e7a207bf288    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2023 09:49:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2023 09:49:12 -0500    

Click here for diff

To take an incremental backup, you use the new replication command  
UPLOAD_MANIFEST to upload the manifest for the prior backup. This  
prior backup could either be a full backup or another incremental  
backup.  You then use BASE_BACKUP with the INCREMENTAL option to take  
the backup.  pg_basebackup now has an --incremental=PATH_TO_MANIFEST  
option to trigger this behavior.  
  
An incremental backup is like a regular full backup except that  
some relation files are replaced with files with names like  
INCREMENTAL.${ORIGINAL_NAME}, and the backup_label file contains  
additional lines identifying it as an incremental backup. The new  
pg_combinebackup tool can be used to reconstruct a data directory  
from a full backup and a series of incremental backups.  
  
Patch by me.  Reviewed by Matthias van de Meent, Dilip Kumar, Jakub  
Wartak, Peter Eisentraut, and Álvaro Herrera. Thanks especially to  
Jakub for incredibly helpful and extensive testing.  
  
Discussion: http://postgr.es/m/CA+TgmoYOYZfMCyOXFyC-P+-mdrZqm5pP2N7S-r0z3_402h9rsA@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/allfiles.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
A doc/src/sgml/ref/pg_combinebackup.sgml
M doc/src/sgml/reference.sgml
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/Makefile
M src/backend/backup/basebackup.c
A src/backend/backup/basebackup_incremental.c
M src/backend/backup/meson.build
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/bin/Makefile
M src/bin/meson.build
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
A src/bin/pg_combinebackup/.gitignore
A src/bin/pg_combinebackup/Makefile
A src/bin/pg_combinebackup/backup_label.c
A src/bin/pg_combinebackup/backup_label.h
A src/bin/pg_combinebackup/copy_file.c
A src/bin/pg_combinebackup/copy_file.h
A src/bin/pg_combinebackup/load_manifest.c
A src/bin/pg_combinebackup/load_manifest.h
A src/bin/pg_combinebackup/meson.build
A src/bin/pg_combinebackup/nls.mk
A src/bin/pg_combinebackup/pg_combinebackup.c
A src/bin/pg_combinebackup/reconstruct.c
A src/bin/pg_combinebackup/reconstruct.h
A src/bin/pg_combinebackup/t/001_basic.pl
A src/bin/pg_combinebackup/t/002_compare_backups.pl
A src/bin/pg_combinebackup/t/003_timeline.pl
A src/bin/pg_combinebackup/t/004_manifest.pl
A src/bin/pg_combinebackup/t/005_integrity.pl
A src/bin/pg_combinebackup/write_manifest.c
A src/bin/pg_combinebackup/write_manifest.h
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/access/xlogbackup.h
M src/include/backup/basebackup.h
A src/include/backup/basebackup_incremental.h
M src/include/nodes/replnodes.h
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/pgindent/typedefs.list

Add a new WAL summarizer process.

commit   : 174c480508ac25568561443e6d4a82d5c1103487    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2023 08:41:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2023 08:41:09 -0500    

Click here for diff

When active, this process writes WAL summary files to  
$PGDATA/pg_wal/summaries. Each summary file contains information for a  
certain range of LSNs on a certain TLI. For each relation, it stores a  
"limit block" which is 0 if a relation is created or destroyed within  
a certain range of WAL records, or otherwise the shortest length to  
which the relation was truncated during that range of WAL records, or  
otherwise InvalidBlockNumber. In addition, it stores a list of blocks  
which have been modified during that range of WAL records, but  
excluding blocks which were removed by truncation after they were  
modified and never subsequently modified again.  
  
In other words, it tells us which blocks need to copied in case of an  
incremental backup covering that range of WAL records. But this  
doesn't yet add the capability to actually perform an incremental  
backup; the next patch will do that.  
  
A new parameter summarize_wal enables or disables this new background  
process.  The background process also automatically deletes summary  
files that are older than wal_summarize_keep_time, if that parameter  
has a non-zero value and the summarizer is configured to run.  
  
Patch by me, with some design help from Dilip Kumar and Andres Freund.  
Reviewed by Matthias van de Meent, Dilip Kumar, Jakub Wartak, Peter  
Eisentraut, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoYOYZfMCyOXFyC-P+-mdrZqm5pP2N7S-r0z3_402h9rsA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/backup/Makefile
M src/backend/backup/meson.build
A src/backend/backup/walsummary.c
A src/backend/backup/walsummaryfuncs.c
M src/backend/postmaster/Makefile
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/postmaster.c
A src/backend/postmaster/walsummarizer.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/common/Makefile
A src/common/blkreftable.c
M src/common/meson.build
M src/include/access/xlog.h
A src/include/backup/walsummary.h
M src/include/catalog/pg_proc.dat
A src/include/common/blkreftable.h
M src/include/miscadmin.h
A src/include/postmaster/walsummarizer.h
M src/include/storage/proc.h
M src/include/utils/guc_tables.h
M src/tools/pgindent/typedefs.list

Fix generation of distribution tarball

commit   : 00498b718564cee3530b76d860b328718aed672b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 15:07:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 15:07:55 +0900    

Click here for diff

1301c80b2167 has introduced in installation.sgml a link reference that  
`make dist` was not able to understand.  
  
Per buildfarm member guaibasaurus.  

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

Additional write barrier in AdvanceXLInsertBuffer().

commit   : 766571be16598b401b5527208847145edc6be1f4    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 19 Dec 2023 17:35:54 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 19 Dec 2023 17:35:54 -0800    

Click here for diff

First, mark the xlblocks member with InvalidXLogRecPtr, then issue a  
write barrier, then initialize it. That ensures that the xlblocks  
member doesn't appear valid while the contents are being initialized.  
  
In preparation for reading WAL buffer contents without a lock.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVfFMfqD5oLzZSQQZWfXiJqd-NdX0_317veP6FuB31QWA@mail.gmail.com  
Reviewed-by: Andres Freund  

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

Use 64-bit atomics for xlblocks array elements.

commit   : c3a8e2a7cb16d55e3b757934b538cb8b8a0eab02    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 19 Dec 2023 17:35:42 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 19 Dec 2023 17:35:42 -0800    

Click here for diff

In preparation for reading the contents of WAL buffers without a  
lock. Also, avoids the previously-needed comment in GetXLogBuffer()  
explaining why it's safe from torn reads.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVfFMfqD5oLzZSQQZWfXiJqd-NdX0_317veP6FuB31QWA@mail.gmail.com  
Reviewed-by: Andres Freund  

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

Remove MSVC scripts

commit   : 1301c80b2167feb658a738fa4ceb1c23d0991e23    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 09:44:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 09:44:37 +0900    

Click here for diff

This commit removes all the scripts located in src/tools/msvc/ to build  
PostgreSQL with Visual Studio on Windows, meson becoming the recommended  
way to achieve that.  The scripts held some information that is still  
relevant with meson, information kept and moved to better locations.  
Comments that referred directly to the scripts are removed.  
  
All the documentation still relevant that was in install-windows.sgml  
has been moved to installation.sgml under a new subsection for Visual.  
All the content specific to the scripts is removed.  Some adjustments  
for the documentation are planned in a follow-up set of changes.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/perl.m4
M doc/src/sgml/filelist.sgml
D doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/standalone-profile.xsl
M meson.build
M src/backend/meson.build
M src/bin/pg_basebackup/Makefile
M src/bin/pgevent/meson.build
M src/common/Makefile
M src/common/meson.build
M src/interfaces/libpq/Makefile
M src/port/Makefile
M src/port/pgstrsignal.c
D src/tools/msvc/.gitignore
D src/tools/msvc/Install.pm
D src/tools/msvc/MSBuildProject.pm
D src/tools/msvc/Mkvcbuild.pm
D src/tools/msvc/Project.pm
D src/tools/msvc/README
D src/tools/msvc/Solution.pm
D src/tools/msvc/VSObjectFactory.pm
D src/tools/msvc/build.bat
D src/tools/msvc/build.pl
D src/tools/msvc/clean.bat
D src/tools/msvc/config_default.pl
D src/tools/msvc/dummylib/README
D src/tools/msvc/dummylib/Win32.pm
D src/tools/msvc/dummylib/Win32/Registry.pm
D src/tools/msvc/dummylib/Win32API/File.pm
D src/tools/msvc/ecpg_regression.proj
D src/tools/msvc/install.bat
D src/tools/msvc/install.pl
D src/tools/msvc/mkvcbuild.pl
D src/tools/msvc/pgbison.bat
D src/tools/msvc/pgbison.pl
D src/tools/msvc/pgflex.bat
D src/tools/msvc/pgflex.pl
D src/tools/msvc/vcregress.bat
D src/tools/msvc/vcregress.pl
R097 src/tools/msvc/gendef.pl src/tools/msvc_gendef.pl
M src/tools/perlcheck/pgperlsyncheck

commit   : 27f7f81e4c8d5d390ea212d13b65ada8e4a232cd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 08:39:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Dec 2023 08:39:54 +0900    

Click here for diff

These comments incorrectly referred to shared_preload_libraries as being  
required for the test to work.  
  
Thinko in commit c68a1839902d.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXpjFDiXf-L7AARQ4ppuxiDYSKZjyZb=wOa+cgg0zuWAw@mail.gmail.com  

M contrib/basic_archive/Makefile
M contrib/basic_archive/meson.build

Move src/bin/pg_verifybackup/parse_manifest.c into src/common.

commit   : aafc07c7a191bc807c77fe2a044006a5db07faba    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2023 15:21:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2023 15:21:34 -0500    

Click here for diff

This makes it possible for the code to be easily reused by other  
client-side tools, and/or by the server.  
  
Patch by me. Review of this patch in particular by at least Peter  
Eisentraut; reviewers for the patch series in general include Dilip  
Kumar, Andres Fruend, David Steele, Álvaro Herrera, and Jakub Wartak.  
  
Discussion: http://postgr.es/m/CA+TgmoZ6UGZVnSy5iak6s6+AXu_DewXovDjhLs3-su6nmU_x_g@mail.gmail.com  

M src/bin/pg_verifybackup/Makefile
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/nls.mk
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/common/Makefile
M src/common/meson.build
R099 src/bin/pg_verifybackup/parse_manifest.c src/common/parse_manifest.c
R097 src/bin/pg_verifybackup/parse_manifest.h src/include/common/parse_manifest.h

Fix brown paper bag bug in 5c47c6546c413d5eb51c1626070a807026e6139d.

commit   : 47f01d727e3a271bbff7d2f9db838e81d27bd495    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2023 15:00:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2023 15:00:23 -0500    

Click here for diff

The previous logic failed to work for anything other than the first  
segment of a relation.  
  
Report by Jakub Wartak. Patch by me.  
  
Discussion: http://postgr.es/m/CAKZiRmwd3KTNMQhm9Bv4oR_1uMehXroO6kGyJQkiw9DfM8cMwQ@mail.gmail.com  

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

Prevent integer overflow when forming tuple width estimates.

commit   : 7e1ce2b3de16dfbe1598cef060dfc8458522938a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Dec 2023 11:12:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Dec 2023 11:12:16 -0500    

Click here for diff

It's at least theoretically possible to overflow int32 when adding up  
column width estimates to make a row width estimate.  (The bug example  
isn't terribly convincing as a real use-case, but perhaps wide joins  
would provide a more plausible route to trouble.)  This'd lead to  
assertion failures or silly planner behavior.  To forestall it, make  
the relevant functions compute their running sums in int64 arithmetic  
and then clamp to int32 range at the end.  We can reasonably assume  
that MaxAllocSize is a hard limit on actual tuple width, so clamping  
to that is simply a correction for dubious input values, and there's  
no need to go as far as widening width variables to int64 everywhere.  
  
Per bug #18247 from RekGRpth.  There've been no reports of this issue  
arising in practical cases, so I feel no need to back-patch.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/optimizer.h

Update comment for Cardinality typedef

commit   : 2a607fb822a2ad8f3a2cc714871283ad8cdf71c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Dec 2023 14:58:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Dec 2023 14:58:47 +0100    

Click here for diff

Author: Richard Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs4-Zd7Yy80RL1NdskLLo-wz6QoqsbC5TKs%3D3yZxG3BT_aA%40mail.gmail.com  

M src/include/nodes/nodes.h

doc: Fix syntax in ALTER FOREIGN DATA WRAPPER example

commit   : e52e271b23005f27e997215617993c87629247f2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Dec 2023 14:13:50 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Dec 2023 14:13:50 +0100    

Click here for diff

The example for dropping an option was incorrectly quoting the  
option key thus making it a value turning the command into an  
unqualified ADD operation. The result of dropping became adding  
a new key/value pair instead:  
  
 d=# alter foreign data wrapper f options (drop 'b');  
 ALTER FOREIGN DATA WRAPPER  
 d=# select fdwoptions from pg_foreign_data_wrapper where fdwname='f';  
  fdwoptions  
 ------------  
  {drop=b}  
 (1 row)  
  
This has been incorrect for a long time so backpatch to all  
supported branches.  
  
Author: Tim <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml

Simplify newNode() by removing special cases

commit   : 3c080fb4fad3e1c1e34f74a7b84a443137adc9f2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Dec 2023 12:11:47 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Dec 2023 12:11:47 +0200    

Click here for diff

- Remove MemoryContextAllocZeroAligned(). It was supposed to be a  
  faster version of MemoryContextAllocZero(), but modern compilers turn  
  the MemSetLoop() into a call to memset() anyway, making it more or  
  less identical to MemoryContextAllocZero(). That was the only user of  
  MemSetTest, MemSetLoop, so remove those too, as well as palloc0fast().  
  
- Convert newNode() to a static inline function. When this was  
  originally originally written, it was written as a macro because  
  testing showed that gcc didn't inline the size check as we  
  intended. Modern compiler versions do, and now that it just calls  
  palloc0() there is no size-check to inline anyway.  
  
One nice effect is that the palloc0() takes one less argument than  
MemoryContextAllocZeroAligned(), which saves a few instructions in the  
callers of newNode().  
  
Reviewed-by: Peter Eisentraut, Tom Lane, John Naylor, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/nodes/Makefile
M src/backend/nodes/meson.build
D src/backend/nodes/nodes.c
M src/backend/utils/mmgr/mcxt.c
M src/include/c.h
M src/include/nodes/nodes.h
M src/include/utils/palloc.h

pageinspect: Fix failure with hash_bitmap_info() for partitioned indexes

commit   : 20847013642127e75ee4fe3ddb8228a1fb4b652f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Dec 2023 18:19:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Dec 2023 18:19:05 +0900    

Click here for diff

This function reads directly a page from a relation, relying on  
index_open() to open the index to read from.  Unfortunately, this would  
crash when using partitioned indexes, as these can be opened with  
index_open() but they have no physical pages.  
  
Alexander has fixed the module, while I have written the test.  
  
Author: Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/sql/hash.sql

pgstattuple: Fix failure with pgstathashindex() for partitioned indexes

commit   : a8dd62ef4959141e410278fd68b3d1821e0bbbaa    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Dec 2023 15:20:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Dec 2023 15:20:39 +0900    

Click here for diff

As coded, the function relied on index_open() when opening an index  
relation, allowing partitioned indexes to be processed by  
pgstathashindex().  This was leading to a "could not open file" error  
because partitioned indexes have no physical files, or to a crash with  
an assertion failure (like on HEAD).  
  
This issue is fixed by applying the same checks as the other stat  
functions for indexes, with a lookup at both RELKIND_INDEX and the index  
AM expected.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/sql/pgstattuple.sql

pgoutput: Raise an error for missing protocol version parameter.

commit   : c8bc807cf8bc741c83bc74553326856affee5a4f    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 19 Dec 2023 09:53:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 19 Dec 2023 09:53:33 +0530    

Click here for diff

Currently, we give a misleading error if the user omits to pass the  
required parameter 'proto_version' in SQL API  
pg_logical_slot_get_changes() or during START_REPLICATION protocol  
message. The error raised is as follows which indicates that the wrong  
version is passed.  
ERROR:  client sent proto_version=0 but server only supports protocol 1 or higher  
  
Author: Emre Hasegeli  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/CAE2gYzwdwtUbs-tPSV-QBwgTubiyGD2ZGsSnAVsDfAGGLDrGOA@mail.gmail.com  

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

compute_bitmap_pages' loop_count parameter should be double not int.

commit   : 8b965c549dc8753be8a38c4a1b9fabdb535a4338    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Dec 2023 12:46:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Dec 2023 12:46:07 -0500    

Click here for diff

The value was double in the original implementation of this logic.  
Commit da08a6598 pulled it out into a subroutine, but carelessly  
declared the parameter as int when it should have been double.  
On most platforms, the only ill effect would be to clamp the value  
to be not more than INT_MAX, which would seldom be exceeded and  
probably wouldn't change the estimates too much anyway.  Nonetheless,  
it's wrong and can cause complaints from ubsan.  
  
While here, improve the comments and parameter names.  
  
This is an ABI change in a globally exposed subroutine, so  
back-patching would create some risk of breaking extensions.  
The value of the fix doesn't seem high enough to warrant taking  
that risk, so fix in HEAD only.  
  
Per report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/include/optimizer/cost.h

Optimize pg_atomic_exchange_u32 and pg_atomic_exchange_u64.

commit   : 64b1fb5f03266f0ef4eef3ad2b7d97170bb05b78    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 18 Dec 2023 10:53:32 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 18 Dec 2023 10:53:32 -0600    

Click here for diff

Presently, all platforms implement atomic exchanges by performing  
an atomic compare-and-swap in a loop until it succeeds.  This can  
be especially expensive when there is contention on the atomic  
variable.  This commit optimizes atomic exchanges on many platforms  
by using compiler intrinsics, which should compile into something  
much less expensive than a compare-and-swap loop.  Since these  
intrinsics have been available for some time, the inline assembly  
implementations are omitted.  
  
Suggested-by: Andres Freund  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/20231129212905.GA1258737%40nathanxps13  

M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h

Micro-optimize datum_to_json_internal() some more.

commit   : 0d1adae6f739273046705acaf5314384e8a73a18    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 18 Dec 2023 10:34:33 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 18 Dec 2023 10:34:33 -0600    

Click here for diff

Commit dc3f9bc549 mainly targeted the JSONTYPE_NUMERIC code path.  
This commit applies similar optimizations (e.g., removing  
unnecessary runtime calls to strlen() and palloc()) to nearby code.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20231208203708.GA4126315%40nathanxps13  

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

Provide vectored variants of smgrread() and smgrwrite().

commit   : 4908c5872059c409aa647bcde758dfeffe07996e    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 18 Dec 2023 13:08:49 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 18 Dec 2023 13:08:49 +1300    

Click here for diff

smgrreadv() and smgrwritev() and their md.c implementations call  
FileReadV() and FileWriteV().  A range of disk blocks beginning at  
'blocknum' and extending for 'nblocks' can be scattered to or gathered  
from multiple buffers with a single system call.  The traditional  
smgrread() and smgrwrite() functions are implemented in terms of the new  
functions.  
  
Later commits will introduce calls with nblocks > 1, but the following  
behavioral changes can be seen already:  
  
* After a short transfer we'll now retry until we eventually read 0  
  bytes (= EOF) or get ENOSPC, EDQUOT, EFBIG etc, where previously we  
  would infer the reason.  Retrying is consistent with xlog.c's  
  treatment of large WAL writes, and arguably also xlog.c and fd.c's  
  treatment of EINTR.  Arbitrary short returns for larger transfers have  
  been observed on several OSes, and might in theory also happen for  
  transient reasons with our own pg_p*v() fallback code.  
  
* After unexpected EOF or -1, the error thrown now talks about  
  a range even for the single block case, eg "blocks 42..42".  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/md.h
M src/include/storage/smgr.h

Doc: add a bit to indices.sgml about what is an indexable clause.

commit   : b7412e293b6b3bf9dd02596d6f6be456a0597d58    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2023 16:49:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2023 16:49:44 -0500    

Click here for diff

We didn't explain this clearly until somewhere deep in the  
"Extending SQL" chapter, but really it ought to be mentioned  
in the introductory material too.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indices.sgml

Refactor pgstat_prepare_io_time() with an input argument instead of a GUC

commit   : 3c9d9acae0bc0cd2f905043cb1d581baec4622c4    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 16 Dec 2023 20:16:20 +0100    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 16 Dec 2023 20:16:20 +0100    

Click here for diff

Originally, this routine relied on track_io_timing to check if a time  
interval for an I/O operation stored in pg_stat_io should be initialized  
or not.  However, the addition of WAL statistics to pg_stat_io requires  
that the initialization happens when track_wal_io_timing is enabled,  
which is dependent on the code path where the I/O operation happens.  
  
Author: Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/CAN55FZ3AiQ+ZMxUuXnBpd0Rrh1YhwJ5FudkHg=JU0P+-W8T4Vg@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/md.c
M src/backend/utils/activity/pgstat_io.c
M src/include/pgstat.h

Remove useless LIMIT_OPTION_DEFAULT value from LimitOption

commit   : a6be0600ac3b71dda8277ab0fcbe59ee101ac1ce    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 16 Dec 2023 18:20:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 16 Dec 2023 18:20:03 +0100    

Click here for diff

During the development that led to commit 357889eb17bb, for a time we  
had the value LIMIT_OPTION_DEFAULT, which was mostly but not completely  
removed later on, before commit.  Complete the removal now.  
  
Author: Zhang Mingli <[email protected]>  
Discussion: https://postgr.es/m/59d61a1a-3858-475a-964f-24468c97cc67@Spark  

M src/backend/parser/gram.y
M src/include/nodes/nodes.h

Provide multi-block smgrprefetch().

commit   : b485ad7f07c80efbfd47329f138f0fe3a5acf013    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 16 Dec 2023 16:14:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 16 Dec 2023 16:14:47 +1300    

Click here for diff

Previously smgrprefetch() could issue POSIX_FADV_WILLNEED advice for a  
single block at a time.  Add an nblocks argument so that we can do the  
same for a range of blocks.  This usually produces a single system call,  
but might need to loop if it crosses a segment boundary.  Initially it  
is only called with nblocks == 1, but proposed patches will make wider  
calls.  
  
Reviewed-by: Heikki Linnakangas <[email protected]> (earlier version)  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/md.h
M src/include/storage/smgr.h

Fix bugs in manipulation of large objects.

commit   : 59bd34c2fa02b005dc33190245b2bffc6a08c0b9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Dec 2023 13:55:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Dec 2023 13:55:05 -0500    

Click here for diff

In v16 and up (since commit afbfc0298), large object ownership  
checking has been broken because object_ownercheck() didn't take care  
of the discrepancy between our object-address representation of large  
objects (classId == LargeObjectRelationId) and the catalog where their  
ownership info is actually stored (LargeObjectMetadataRelationId).  
This resulted in failures such as "unrecognized class ID: 2613"  
when trying to update blob properties as a non-superuser.  
  
Poking around for related bugs, I found that AlterObjectOwner_internal  
would pass the wrong classId to the PostAlterHook in the no-op code  
path where the large object already has the desired owner.  Also,  
recordExtObjInitPriv checked for the wrong classId; that bug is only  
latent because the stanza is dead code anyway, but as long as we're  
carrying it around it should be less wrong.  These bugs are quite old.  
  
In HEAD, we can reduce the scope for future bugs of this ilk by  
changing AlterObjectOwner_internal's API to let the translation happen  
inside that function, rather than requiring callers to know about it.  
  
A more bulletproof fix, perhaps, would be to start using  
LargeObjectMetadataRelationId as the dependency and object-address  
classId for blobs.  However that has substantial risk of breaking  
third-party code; even within our own code, it'd create hassles  
for pg_dump which would have to cope with a version-dependent  
representation.  For now, keep the status quo.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/alter.c
M src/backend/libpq/be-fsstubs.c
M src/backend/storage/large_object/inv_api.c
M src/include/commands/alter.h
M src/test/regress/expected/largeobject.out
M src/test/regress/expected/largeobject_1.out
M src/test/regress/sql/largeobject.sql

Fix typo

commit   : 0e917508b89dd21c5bcd9183e77585f01055a20d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Dec 2023 09:48:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Dec 2023 09:48:24 +0100    

Click here for diff

Reported-by: Junwang Zhao <[email protected]>  

M meson.build

docs: Fix typo in pg_stat_statements documentation

commit   : 741fb0056eda5e7bd03deb0719121f88b4b9e34a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 13 Dec 2023 11:32:13 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 13 Dec 2023 11:32:13 +0100    

Click here for diff

Commit dc9f8a79830 accidentally misspelled minimum as minimun.  

M doc/src/sgml/pgstatstatements.sgml

Prevent tuples to be marked as dead in subtransactions on standbys

commit   : 8a7cbfce13d476a3e9782111c45a7b3335646ee4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Dec 2023 17:05:18 +0100    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Dec 2023 17:05:18 +0100    

Click here for diff

Dead tuples are ignored and are not marked as dead during recovery, as  
it can lead to MVCC issues on a standby because its xmin may not match  
with the primary.  This information is tracked by a field called  
"xactStartedInRecovery" in the transaction state data, switched on when  
starting a transaction in recovery.  
  
Unfortunately, this information was not correctly tracked when starting  
a subtransaction, because the transaction state used for the  
subtransaction did not update "xactStartedInRecovery" based on the state  
of its parent.  This would cause index scans done in subtransactions to  
return inconsistent data, depending on how the xmin of the primary  
and/or the standby evolved.  
  
This is broken since the introduction of hot standby in efc16ea52067, so  
backpatch all the way down.  
  
Author: Fei Changhong  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix typo in comment

commit   : c5962ad21a6e3119c9f63b5fbfbcfe663413d551    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 12 Dec 2023 12:16:38 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 12 Dec 2023 12:16:38 +0100    

Click here for diff

Commit 98e675ed7af accidentally mistyped IDENTIFY_SYSTEM as  
IDENTIFY_SERVER. Backpatch to all supported branches.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Provide vectored variants of FileRead() and FileWrite().

commit   : 871fe4917e1e92304bdcc2ab779de7416492c6de    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 11:56:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 11:56:11 +1300    

Click here for diff

FileReadV() and FileWriteV() adapt pg_preadv() and pg_pwritev() for  
fd.c's virtual file descriptors.  The simple FileRead() and FileWrite()  
functions are now implemented in terms of the vectored functions, to  
avoid code duplication, and they are converted back to the corresponding  
simple system calls further down (commit 15c9ac36).  Later work will  
make more interesting multi-iovec calls.  
  
The traditional behavior of reporting a "fake" ENOSPC error is  
simplified.  It's now always set for non-failing writes, for the benefit  
of callers that expect to log a meaningful "%m" if they determine that  
the write was short.  (Perhaps we should consider getting rid of that  
expectation one day.)  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

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

Provide helper for retrying partial vectored I/O.

commit   : 0c6be59f5e34f44b20d9ec3ffb58c1d9a0bf985e    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 10:28:46 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 10:28:46 +1300    

Click here for diff

compute_remaining_iovec() is a re-usable routine for retrying after  
pg_readv() or pg_writev() reports a short transfer.  This will gain new  
users in a later commit, but can already replace the open-coded  
equivalent code in the existing pg_pwritev_with_retry() function.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M src/common/file_utils.c
M src/include/common/file_utils.h

Define unconstify() and unvolatize() for C++.

commit   : baf7c93ed583949d837bc13f24a15a0efbcb1ae7    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 09:31:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Dec 2023 09:31:44 +1300    

Click here for diff

These two macros wouldn't work if used in an inline function definition  
in a header seen by g++, because __builtin_types_compatible_p is only  
available in C.  Redirect to standard C++ const_cast (which also  
adds/removes volatile despite its name).  
  
Per cpluspluscheck failure in a development branch.  
  
Suggested-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3OXFjkOyZiw-DgL2bUqk9by1uGuCnViJX786W%2BfyDSw%40mail.gmail.com  

M src/include/c.h

Be more wary about OpenSSL not setting errno on error.

commit   : 0a5c46a7a488f2f4260a90843bb9de6c584c7f4e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Dec 2023 11:51:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Dec 2023 11:51:56 -0500    

Click here for diff

OpenSSL will sometimes return SSL_ERROR_SYSCALL without having set  
errno; this is apparently a reflection of recv(2)'s habit of not  
setting errno when reporting EOF.  Ensure that we treat such cases  
the same as read EOF.  Previously, we'd frequently report them like  
"could not accept SSL connection: Success" which is confusing, or  
worse report them with an unrelated errno left over from some  
previous syscall.  
  
To fix, ensure that errno is zeroed immediately before the call,  
and report its value only when it's not zero afterwards; otherwise  
report EOF.  
  
For consistency, I've applied the same coding pattern in libpq's  
pqsecure_raw_read().  Bare recv(2) shouldn't really return -1 without  
setting errno, but in case it does we might as well cope.  
  
Per report from Andres Freund.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/pqcomm.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c

Simplify productions for FORMAT JSON [ ENCODING name ]

commit   : d3fe6e90bab52b8cbf085cfad5e4da110a2cd373    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Dec 2023 11:55:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Dec 2023 11:55:34 +0100    

Click here for diff

This removes the production json_encoding_clause_opt, instead merging  
it into json_format_clause.  Also remove the auxiliary  
makeJsonEncoding() function.  
  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/202312071841.u2gueb5dsrbk%40alvherre.pgsql  

M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/include/nodes/makefuncs.h

Remove trace_recovery_messages

commit   : c7a3e6b46d38f880f42642df003796b9bf99c1a8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Dec 2023 11:49:02 +0100    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Dec 2023 11:49:02 +0100    

Click here for diff

This GUC was intended as a debugging help in the 9.0 area when hot  
standby and streaming replication were being developped, able to offer  
more information at LOG level rather than DEBUGn.  There are more tools  
available these days that are able to offer rather equivalent  
information, like pg_waldump introduced in 9.3.  It is not obvious how  
this facility is useful these days, so let's remove it.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/cache/inval.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc_tables.c
M src/include/miscadmin.h

Fix an undetected deadlock due to apply worker.

commit   : 8d7d2197f31c1839db4726d1a12cb29016f4fa36    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 11 Dec 2023 08:50:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 11 Dec 2023 08:50:43 +0530    

Click here for diff

The apply worker needs to update the state of the subscription tables to  
'READY' during the synchronization phase which requires locking the  
corresponding subscription. The apply worker also waits for the  
subscription tables to reach the 'SYNCDONE' state after holding the locks  
on the subscription and the wait is done using WaitLatch. The 'SYNCDONE'  
state is changed by tablesync workers again by locking the corresponding  
subscription. Both the state updates use AccessShareLock mode to lock the  
subscription, so they can't block each other. However, a backend can  
simultaneously try to acquire a lock on the same subscription using  
AccessExclusiveLock mode to alter the subscription. Now, the backend's  
wait on a lock can sneak in between the apply worker and table sync worker  
causing deadlock.  
  
In other words, apply_worker waits for tablesync worker which waits for  
backend, and backend waits for apply worker. This is not detected by the  
deadlock detector because apply worker uses WaitLatch.  
  
The fix is to release existing locks in apply worker before it starts to  
wait for tablesync worker to change the state.  
  
Reported-by: Tomas Vondra  
Author: Shlok Kyal  
Reviewed-by: Amit Kapila, Peter Smith  
Backpatch-through: 12  
Discussion: https://postgr.es/m/[email protected]  

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

Remove some unnecessary includes of "access/xlog_internal.h"

commit   : 90834ceccd7298d4495c088fab85e6d87b9cb086    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 10 Dec 2023 07:44:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 10 Dec 2023 07:44:04 +0100    

Click here for diff

There were a few places where access/xlog_internal.h was apparently  
included unnecessarily.  In some of those places, a more specific  
header file (that somehow came in via access/xlog_internal.h) can be  
used instead.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a56a6eec-eb14-471b-9570-3cac23603964%40eisentraut.org  

M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/timeline.c
M src/include/access/generic_xlog.h

Fix nbtree backward scan race condition comments.

commit   : aa210e0c121eb8f58c86d4fcc833a5a6fbb6f5a9    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 8 Dec 2023 15:37:53 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 8 Dec 2023 15:37:53 -0800    

Click here for diff

Remove comments that supposed that holding a pin was a useful interlock  
for _bt_walk_left().  There are times when _bt_walk_left() doesn't hold  
either a lock or a pin on any page, so clearly this can't be true.  
_bt_walk_left() is even prepared to deal with concurrent deletion of  
both the original page and any pages to its left.  
  
Oversight in commit 2ed5b87f96.  

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

Micro-optimize JSONTYPE_NUMERIC code path in json.c.

commit   : dc3f9bc549d4cc8cb1d4030bdc94e788d70fdcfe    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 8 Dec 2023 13:39:08 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 8 Dec 2023 13:39:08 -0600    

Click here for diff

This commit does the following:  
  
* In datum_to_json_internal(), the call to IsValidJsonNumber() is  
  replaced with simplified validation code.  This avoids an extra  
  call to strlen() in this path, and it avoids validating the  
  entire string (which is okay since we know we're dealing with a  
  numeric data type's output).  
  
* In datum_to_json_internal(), the call to escape_json() in the  
  JSONTYPE_NUMERIC path is replaced with code that just surrounds  
  the string with quotes.  In passing, some other nearby calls to  
  appendStringInfo() have been replaced with similar code to avoid  
  unnecessary calls to vsnprintf().  
  
* In composite_to_json(), the length of the separator is now  
  determined at compile time to avoid unnecessary calls to  
  strlen().  
  
On my machine, this speeds up a benchmark for the proposed COPY TO  
(FORMAT json) command with many integers by upwards of 20%.  There  
are likely other code paths that could be given a similar  
treatment, but that is left as a future exercise.  
  
Reviewed-by: Jeff Davis, Tom Lane, David Rowley, John Naylor  
Discussion: https://postgr.es/m/20231207231251.GB3359478%40nathanxps13  

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

Cache opaque handle for GUC option to avoid repeasted lookups.

commit   : 867dd2dc8704e58636b8599f61ada3d83c7e6473    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Dec 2023 11:16:01 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Dec 2023 11:16:01 -0800    

Click here for diff

When setting GUCs from proconfig, performance is important, and hash  
lookups in the GUC table are significant.  
  
Per suggestion from Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoYpKxhR3HOD9syK2XwcAUVPa0+ba0XPnwWBcYxtKLkyxA@mail.gmail.com  
Reviewed-by: John Naylor  

M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/tools/pgindent/typedefs.list

Optimize nbtree backward scan boundary cases.

commit   : c9c0589fda0edc46b8f5e7362b04636c0c4f0723    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 8 Dec 2023 11:05:17 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 8 Dec 2023 11:05:17 -0800    

Click here for diff

Teach _bt_binsrch (and related helper routines like _bt_search and  
_bt_compare) about the initial positioning requirements of backward  
scans.  Routines like _bt_binsrch already know all about "nextkey"  
searches, so it seems natural to teach them about "goback"/backward  
searches, too.  These concepts are closely related, and are much easier  
to understand when discussed together.  
  
Now that certain implementation details are hidden from _bt_first, it's  
straightforward to add a new optimization: backward scans using the <  
strategy now avoid extra leaf page accesses in certain "boundary cases".  
Consider the following example, which uses the tenk1 table (and its  
tenk1_hundred index) from the standard regression tests:  
  
SELECT * FROM tenk1 WHERE hundred < 12 ORDER BY hundred DESC LIMIT 1;  
  
Before this commit, nbtree would scan two leaf pages, even though it was  
only really necessary to scan one leaf page.  We'll now descend straight  
to the leaf page containing a (12, -inf) high key instead.  The scan  
will locate matching non-pivot tuples with "hundred" values starting  
from the value 11.  The scan won't waste a page access on the right  
sibling leaf page, which cannot possibly contain any matching tuples.  
  
You can think of the optimization added by this commit as disabling an  
optimization (the _bt_compare "!pivotsearch" behavior that was added to  
Postgres 12 in commit dd299df8) for a small subset of cases where it was  
always counterproductive.  
  
Equivalently, you can think of the new optimization as extending the  
"pivotsearch" behavior that page deletion by VACUUM has long required  
(since the aforementioned Postgres 12 commit went in) to other, similar  
cases.  Obviously, this isn't strictly necessary for these new cases  
(unlike VACUUM, _bt_first is prepared to move the scan to the left once  
on the leaf level), but the underlying principle is the same.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=XPzM8HzaLPq278Vms420mVSHfgs9wi5tjFKHcapZCEw@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Allow parallel CREATE INDEX for BRIN indexes

commit   : b437571714707bc6466abde1a0af5e69aaade09c    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 8 Dec 2023 18:15:23 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 8 Dec 2023 18:15:23 +0100    

Click here for diff

Allow using multiple worker processes to build BRIN index, which until  
now was supported only for BTREE indexes. For large tables this often  
results in significant speedup when the build is CPU-bound.  
  
The work is split in a simple way - each worker builds BRIN summaries on  
a subset of the table, determined by the regular parallel scan used to  
read the data, and feeds them into a shared tuplesort which sorts them  
by blkno (start of the range). The leader then reads this sorted stream  
of ranges, merges duplicates (which may happen if the parallel scan does  
not align with BRIN pages_per_range), and adds the resulting ranges into  
the index.  
  
The number of duplicate results produced by workers (requiring merging  
in the leader process) should be fairly small, thanks to how parallel  
scans assign chunks to workers. The likelihood of duplicate results may  
increase for higher pages_per_range values, but then there are fewer  
page ranges in total. In any case, we expect the merging to be much  
cheaper than summarization, so this should be a win.  
  
Most of the parallelism infrastructure is a simplified copy of the code  
used by BTREE indexes, omitting the parts irrelevant for BRIN indexes  
(e.g. uniqueness checks).  
  
This also introduces a new index AM flag amcanbuildparallel, determining  
whether to attempt to start parallel workers for the index build.  
  
Original patch by me, with reviews and substantial reworks by Matthias  
van de Meent, certainly enough to make him a co-author.  
  
Author: Tomas Vondra, Matthias van de Meent  
Reviewed-by: Matthias van de Meent  
Discussion: https://postgr.es/m/c2ee7d69-ce17-43f2-d1a0-9811edbda6e6%40enterprisedb.com  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/parallel.c
M src/backend/catalog/index.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/amapi.h
M src/include/access/brin.h
M src/include/utils/tuplesort.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/tools/pgindent/typedefs.list

Add empty BRIN ranges during CREATE INDEX

commit   : dae761a87edae444d11a411f711f1d679bed5941    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 8 Dec 2023 17:07:30 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 8 Dec 2023 17:07:30 +0100    

Click here for diff

When building BRIN indexes, the brinbuildCallback only advances to the  
next page range when seeing a tuple that doesn't belong to the current  
one. This means that the index may end up missing ranges at the end of  
the table, if those pages do not contain any indexable tuples.  
  
We tend not to have completely empty pages at the end of a relation, but  
this also applies to partial indexes, where the tuples may simply not  
match the index predicate. This results in inefficient scans using the  
affected BRIN index - without the summaries, the page ranges have to be  
read and processed, which consumes I/O and possibly also CPU time.  
  
The existing code already added empty ranges for earlier parts of the  
table, this commit makes sure we add them for the ranges at the end of  
the table too.  
  
Patch by Matthias van de Meent, with review/improvements by me.  
  
Author: Matthias van de Meent  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAEze2WiMsPZg%3DxkvSF_jt4%3D69k6K7gz5B8V2wY3gCGZ%2B1BzCbQ%40mail.gmail.com  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/sql/brin.sql
M src/backend/access/brin/brin.c

Don't clean initdb files on template creation failure

commit   : 00edb2061fcf288574b7b5c0be67fab71f7e136b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Dec 2023 13:42:54 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Dec 2023 13:42:54 +0100    

Click here for diff

Commit 252dcb32397f6 introduced initdb template caching to speed up  
tests by re-using initdb output.  The initdb command didn't however  
use the --no-clean option to preserve generated data in case initdb  
crashes unlike pg_regress which does do this.  This adds the option  
to initdb to aid debugging.  
  
While changing the commandline, switch to using long options for  
initdb to make the code more self-documenting.  
  
Author: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAEze2WhSTjfK_M+Ea4GSQp8odrEOaQS8HyORd1TJUEiyXaB+rw@mail.gmail.com  

M meson.build
M src/Makefile.global.in

Remove some unnecessary #includes of postmaster/interrupt.h

commit   : 44913add91e789884e207f19c1d7ec067f23f6d5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 13:19:37 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 13:19:37 +0200    

Click here for diff

Commit 44fc6e259b removed a bunch of references to  
SignalHandlerForCrashExit, leaving these #includes unneeded.  

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

Test that it works to RESET an invalid reloption

commit   : 7db01fbcefbd95a7c97afa128fab59f4a09b3ff1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Dec 2023 11:58:58 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Dec 2023 11:58:58 +0100    

Click here for diff

This works today, and it's valuable to ensure it doesn't get broken  
if/when we get around to refactoring the implementation.  
  
Author: Nikolay Shaplov <[email protected]>  
Discussion: https://postgr.es/m/4563991.km65PDbjlG@thinkpad-pgpro  

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

Rename ShmemVariableCache to TransamVariables

commit   : b31ba5310b5176402b60abc0454a033b1210ab75    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:47:15 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:47:15 +0200    

Click here for diff

The old name was misleading: It's not a cache, the values kept in the  
struct are the authoritative source.  
  
Reviewed-by: Tristan Partin, Richard Guo  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/amcheck/verify_heapam.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.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/postmaster/autovacuum.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/xid8funcs.c
M src/include/access/transam.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/test/modules/xid_wraparound/xid_wraparound.c
M src/tools/pgindent/typedefs.list

Initialize ShmemVariableCache like other shmem areas

commit   : 15916ffb0468d0b1036ba661767fe6e1b5fb3ee8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:46:59 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:46:59 +0200    

Click here for diff

For sake of consistency.  
  
Reviewed-by: Tristan Partin, Richard Guo  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/varsup.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/include/access/transam.h

Don't try to open visibilitymap when analyzing a foreign table

commit   : 049ef3398d05c9dc8f48aa9a6d68440661cfeb87    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:16:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 Dec 2023 09:16:21 +0200    

Click here for diff

It's harmless, visibilitymap_count() returns 0 if the file doesn't  
exist. But it's also very pointless. I noticed this when I added an  
assertion in smgropen() that the relnumber is valid.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/analyze.c
M src/backend/storage/smgr/smgr.c

Fix potential pointer overflow in xlogreader.c.

commit   : cd7f19da34684b7b12fdc08511c5ce7bebb09419    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Dec 2023 15:10:48 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Dec 2023 15:10:48 +1300    

Click here for diff

While checking if a record could fit in the circular WAL decoding  
buffer, the coding from commit 3f1ce973 used arithmetic that could  
overflow.  64 bit systems were unaffected for various technical reasons,  
which probably explains the lack of problem reports.  Likewise for 32  
bit systems running known 32 bit kernels.  The systems at risk of  
problems appear to be 32 bit processes running on 64 bit kernels, with  
unlucky placement in memory.  
  
Per complaint from GCC -fsanitize=undefined -m32, while testing  
variations of 039_end_of_wal.pl.  
  
Back-patch to 15.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKH0oRPOX7DhiQ_b51sM8HqcPp2J3WA-Oen%3DdXog%2BAGGQ%40mail.gmail.com  

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

doc: clarify handling of ON CONFLICT with triggers

commit   : 2cc2d02dd04ff01602f25c141d814ab46776ade4    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 21:35:29 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 21:35:29 -0500    

Click here for diff

The previous wording was confusing.  Also move partitioning mention to a  
more logical location.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M doc/src/sgml/trigger.sgml

Fix path of regress shared library in pg_upgrade test

commit   : e5b8c4f68fa554b1db9951af579c70c2a4692e55    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Dec 2023 10:36:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Dec 2023 10:36:23 +0900    

Click here for diff

During a pg_upgrade test using an old dump, all references to the old  
regress shared library path (so, dylib or dll) are updated to point to  
the library path used by the new build, to ensure a consistent  
comparison between the old and new dumps.  
  
The test previously relied on a hardcoded value of "src/test/regress/"  
to build the new path value, which would point to an incorrect location  
for the meson and vpath builds.  This is replaced by REGRESS_SHLIB, able  
to point to the correct location of the regress shared library.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

doc, pg_upgrade: add vacuumdb w/ tips for generating quick stats

commit   : c0fcf077708c99d64c86087eb567999cb85848e0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 20:06:23 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 20:06:23 -0500    

Click here for diff

Reported-by: Magnus Hagander  
  
Discussion: https://postgr.es/m/CABUevEwGBY-W7EkTbjMY1rC+mmRL3fMrnX6YaUkcr+7o9PSa3w@mail.gmail.com  
  
Backpatch-through: master  

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

doc: FOR UPDATE / KEY / SHARE / KEY SHARE takes an table alias

commit   : 5134e9d295f335b4ee9f8846f934e5593f65e881    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 19:43:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 19:43:04 -0500    

Click here for diff

Previously only a table name was documented for this SELECT clause.  
  
Reported-by: robert <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

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

doc, intagg: fix one-to-many mention to many-to-many

commit   : 651030a3d7b44e0f448f860f6cccc1b0eff26ac6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 19:36:52 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Dec 2023 19:36:52 -0500    

Click here for diff

Reported-by: Christophe Courtois  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Christophe Courtois  
  
Backpatch-through: master  

M doc/src/sgml/intagg.sgml

Shrink Unicode category table.

commit   : 719b342d36ce9a049137817e93e6a18a711a40e4    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 7 Dec 2023 15:44:03 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 7 Dec 2023 15:44:03 -0800    

Click here for diff

Missing entries can implicitly be considered "unassigned".  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode_category.c
M src/include/common/unicode_category_table.h

Verify that attribute counts match in ExecCopySlot

commit   : d16a0c1e2e3874cd5adfa9ee968008b6c4b1ae01    
  
author   : David Rowley <[email protected]>    
date     : Thu, 7 Dec 2023 21:28:24 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 7 Dec 2023 21:28:24 +1300    

Click here for diff

tts_virtual_copyslot() contained an Assert that checked that the srcslot  
contained <= attributes than the dstslot.  This seems to be backwards as  
if the srcslot contained fewer attributes then the dstslot could be left  
with stale Datum values from the previously stored tuple.  It might make  
more sense to allow the source to contain additional attributes and only  
copy the leading ones that also exist in the destination, however, that's  
not what we're doing here.  
  
Here we just remove the Assert from tts_virtual_copyslot() and add an  
Assert to ExecCopySlot() to verify the attribute counts match.  There  
does not seem to be any places where the destination contains fewer  
attributes, so instead of going to the trouble of making the code  
properly handle this, let's just ensure the attribute counts match.  If  
this Assert fails then that will indicate that we do have cases that  
require us to handle the srcslot with more attributes than the dstslot.  
It seems better to only write this code if there's a genuine requirement  
for it rather than write it now only to leave it untested.  
  
Thanks to Andres Freund for helping with the analysis of this.  
  
Discussion: https://postgr.es/m/CAApHDvpMAvBL0T+TRORquyx1iqFQKMVTXtqNocOw0Pa2uh1heg@mail.gmail.com  

M src/backend/executor/execTuples.c
M src/include/executor/tuptable.h

Improve some error messages with invalid indexes for REINDEX CONCURRENTLY

commit   : d43bd090a8fee81fe88eb1e9e15e30d30ee130ed    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Dec 2023 14:27:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Dec 2023 14:27:54 +0900    

Click here for diff

An invalid index is skipped when doing REINDEX CONCURRENTLY at table  
level, with INDEX_CORRUPTED used as errcode.  This is confusing,  
because an invalid index could exist after an interruption.  The errcode  
is switched to OBJECT_NOT_IN_PREREQUISITE_STATE instead, as per a  
suggestion from Andres Freund.  
  
While on it, the error messages are reworded, and a hint is added,  
telling how to rebuild an invalid index in this case.  This has been  
suggested by Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out

Fix issues in binary_upgrade_logical_slot_has_caught_up().

commit   : 0bf62460bb9e86101d24e31e915c2e8922675296    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 7 Dec 2023 08:42:48 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 7 Dec 2023 08:42:48 +0530    

Click here for diff

The commit 29d0a77fa6 labelled binary_upgrade_logical_slot_has_caught_up()  
as a non-strict function to allow providing a better error message to callers  
in case the passed slot_name is NULL. On further discussion, it seems that  
it is not helpful to have a different error message for NULL input in this  
function, so this patch marks the function as strict.  
  
This patch also removes the explicit permission check to use replication  
slots as this function is invoked only by superusers and instead adds an  
Assert.  
  
Reported-by: Masahiko Sawada  
Author: Hayato Kuroda  
Reviewed-by: Vignesh C  
Discussion: https://postgr.es/m/CAD21AoDSyiBKkMXBxN_gUayZZUCOgyHnG8Ge8rcPXNP3Tf6B4g@mail.gmail.com  

M src/backend/utils/adt/pg_upgrade_support.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix assertion failure with REINDEX and event triggers

commit   : c426f7c2b36a5efd9bcef2a2dfcc559f7879cd84    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Dec 2023 08:31:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Dec 2023 08:31:02 +0900    

Click here for diff

A REINDEX CONCURRENTLY run on a table with no indexes would always pop  
the topmost snapshot from the active snapshot stack, making the snapshot  
handling inconsistent between the multiple-relation and single-relation  
cases.  This commit slightly changes the snapshot stack handling so as a  
snapshot is popped only ReindexMultipleInternal() in this case after a  
relation has been reindexed, fixing a problem where an event trigger  
function may need a snapshot but does not have one.  This also keeps the  
places where PopActiveSnapshot() is called closer to each other.  
  
While on it, this expands the existing tests to cover all the cases that  
could be faced with REINDEX commands and such event triggers, for one or  
more relations, with or without indexes.  
  
This behavior is inconsistent since 5dc92b844e68, but we've never had a  
need for an active snapshot at the end of a REINDEX until now.  
  
Thanks also to Jian He for the input.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Suppress -Wunused-result warning about write().

commit   : c2a465b2c94fb44211c350f73b5a11978d3b4536    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 6 Dec 2023 17:16:57 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 6 Dec 2023 17:16:57 -0600    

Click here for diff

pg_test_fsync's signal_cleanup() intentionally ignores the write()  
result since there's not much we could do about it, but certain  
compilers make that harder than it ought to be.  
  
This was missed in commit 52e98d4502.  
  
Reviewed-by: Tristan Partin, Peter Eisentraut  
Discussion: https://postgr.es/m/20231206161839.GA2828158%40nathanxps13  

M src/bin/pg_test_fsync/pg_test_fsync.c

Use signal-safe functions in signal handler

commit   : 52e98d45023027de0fa8e4eee2d53e2c20185812    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Dec 2023 10:11:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Dec 2023 10:11:36 +0100    

Click here for diff

According to signal-safety(7), exit(3) and puts(3) are not safe to call  
in a signal handler.  
  
Author: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CTVDKVZCCVSY.1XQ87UL50KQRD%40gonk  

M src/bin/pg_test_fsync/pg_test_fsync.c

Fix compilation on Windows with WAL_DEBUG

commit   : 7636725b922c8cd68f21d040f3542d3bce9c68a4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Dec 2023 14:10:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Dec 2023 14:10:39 +0900    

Click here for diff

This has been broken since b060dbe0001a that has reworked the callback  
mechanism of XLogReader, most likely unnoticed because any form of  
development involving WAL happens on platforms where this compiles fine.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVF14WKQMFwcJ=3okVDhiXpuK5f7YdT+BdYXbbypMHqWA@mail.gmail.com  
Backpatch-through: 13  

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

Apply filters to dump files all the time in 002_pg_upgrade.pl

commit   : bfc677c3bc31658957f601886352901fdd8c2811    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Dec 2023 09:54:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Dec 2023 09:54:47 +0900    

Click here for diff

This commit removes the restriction that would not apply filters to the  
dumps used for comparison in the TAP test of pg_upgrade when using the  
same base version for the old and new nodes.  
  
The previous logic would fail on Windows if loading a dump while using  
the same set of binaries for the old and new nodes, as the library  
dependencies updated in the old dump would append CRLFs to the dump  
file as it is treated as a text file.  The dump filtering logic replaces  
all CRLFs (\r\n) by LFs (\n), which is able to prevent this issue.  
  
When the old and new versions of the binaries are the same,  
AdjustUpgrade removes all blank lines, removes version-based comments  
generated by pg_dump and replaces CRLFs by LFs.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Add support for deparsing semi-joins to contrib/postgres_fdw

commit   : 824dbea3e41efa3b35094163c834988dea7eb139    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 5 Dec 2023 22:53:12 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 5 Dec 2023 22:53:12 +0200    

Click here for diff

SEMI-JOIN is deparsed as the EXISTS subquery. It references outer and inner  
relations, so it should be evaluated as the condition in the upper-level WHERE  
clause. The signatures of deparseFromExprForRel() and deparseRangeTblRef() are  
revised so that they can add conditions to the upper level.  
  
PgFdwRelationInfo now has a hidden_subquery_rels field, referencing the relids  
used in the inner parts of semi-join.  They can't be referred to from upper  
relations and should be used internally for equivalence member searches.  
  
The planner can create semi-join, which refers to inner rel vars in its target  
list. However, we deparse semi-join as an exists() subquery. So we skip the  
case when the target list references to inner rel of semi-join.  
  
Author: Alexander Pyhalov  
Reviewed-by: Ashutosh Bapat, Ian Lawrence Barwick, Yuuki Fujii, Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

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

Rename pg_verifybackup's JsonManifestParseContext callback functions.

commit   : 278eb13c48236c261ed4bab1cb4696321e346eb7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2023 12:51:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2023 12:51:39 -0500    

Click here for diff

The old names were too generic, and would have applied to any binary  
that made use of JsonManifestParseContext. Rename to make the names  
specific to pg_verifybackup, since there are plans afoot to reuse  
this infrastructure.  
  
Per suggestion from Álvaro Herrra.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/pg_verifybackup.c

Rename JsonManifestParseContext callbacks.

commit   : d463aa06a9a8c078c1a80ac14b65765b9e5b9ecd    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2023 12:17:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2023 12:17:49 -0500    

Click here for diff

There is no real reason to just run multiple words together when  
we can instead punctuate them with marks intended for that purpose.  
  
Per suggestion from Álvaro Herrera.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pg_verifybackup/parse_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/tools/pgindent/typedefs.list

Fix indentation

commit   : 4d0cf0b05defcee985d5af38cb0db2b9c2f8dbae    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Dec 2023 15:54:59 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Dec 2023 15:54:59 +0100    

Click here for diff

When preparing commit 98e675ed7af I accidentally forgot to run  
pgindent, which did produce a diff. Fix by adding the required  
whitespace per the koel buildfarm failure.  

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

Fix incorrect error message for IDENTIFY_SYSTEM

commit   : 98e675ed7af95cb65a594ce730d42390e0118dcb    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Dec 2023 14:30:56 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Dec 2023 14:30:56 +0100    

Click here for diff

Commit 5a991ef8692e accidentally reversed the order of the tuples  
and fields parameters, making the error message incorrectly refer  
to 3 tuples with 1 field when IDENTIFY_SYSTEM returns 1 tuple and  
3 or 4 fields. Fix by changing the order of the parameters.  This  
also adds a comment describing why we check for < 3 when postgres  
since 9.4 has been sending 4 fields.  
  
Backpatch all the way since the bug is almost a decade old.  
  
Author: Tomonari Katsumata <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Bug: #18224  
Backpatch-through: v12  

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

Fix handling of errors in libpq pipelines

commit   : b8ba7344e9eb9bb505a92900b2a59257ef718135    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Dec 2023 12:43:24 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Dec 2023 12:43:24 +0100    

Click here for diff

The logic to keep the libpq command queue in sync with queries that have  
been processed had a bug when errors were returned for reasons other  
than problems in queries -- for example, when a connection is lost.  We  
incorrectly consumed an element from the command queue every time, but  
this is wrong and can lead to the queue becoming empty ahead of time,  
leading to later malfunction: PQgetResult would return nothing,  
potentially causing the calling application to enter a busy loop.  
  
Fix by making the SYNC queue element a barrier that can only be consumed  
when a SYNC message is received.  
  
Backpatch to 14.  
  
Reported by: Иван Трофимов (Ivan Trofimov) <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix a random failure in 003_logical_slots.pl.

commit   : 63c5df126abb7364b70dafe75fef576dd8eb0bbc    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 5 Dec 2023 09:10:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 5 Dec 2023 09:10:06 +0530    

Click here for diff

The failed test was trying to validate that the two_phase option for a  
slot is retained after the upgrade. The problem was that it didn't get  
enabled before the upgrade so expecting to be enabled after the upgrade  
was not right in the first place. This is a timing issue because we enable  
the two_phase once the initial sync for all the tables is finished.  
Normally, we wait for the two_phase state to be enabled but this test  
missed that step.  
  
Per buildfarm.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TY3PR01MB98892396D1071FC4320D6B31F586A@TY3PR01MB9889.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/003_logical_slots.pl

Optimize SearchPathCache by saving the last entry.

commit   : a86c61c9eefaba7dcf375cd60c875c871ed60945    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 4 Dec 2023 17:19:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 4 Dec 2023 17:19:16 -0800    

Click here for diff

Repeated lookups are common, so it's worth it to check the last entry  
before doing another hash lookup.  
  
Discussion: https://postgr.es/m/04c8592dbd694e4114a3ed87139a7a04e4363030.camel%40j-davis.com  

M src/backend/catalog/namespace.c

Teach convert() and friends to avoid copying when possible.

commit   : b14b1eb4da4c97afec24cf8956e842b98ebb2a51    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 4 Dec 2023 11:55:18 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 4 Dec 2023 11:55:18 -0600    

Click here for diff

Presently, pg_convert() allocates a new bytea and copies the result  
regardless of whether any conversion actually happened.  This  
commit adjusts this function to return the source pointer as-is if  
no conversion occurred.  This optimization isn't expected to make a  
tremendous difference, but it still seems worthwhile to avoid  
unnecessary memory allocations.  
  
Author: Yurii Rashkovskii  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/CA%2BRLCQyknBPSWXRBQGOi6aYEcdQ9RpH9Kch4GjoeY8dQ3D%2Bvhw%40mail.gmail.com  

M src/backend/utils/mb/mbutils.c

Remove now-unnecessary Autovacuum[Launcher|Worker]IAm functions

commit   : e7c6efe305afff030b50fe6f792af48deff5cf3e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Dec 2023 15:34:37 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Dec 2023 15:34:37 +0200    

Click here for diff

After commit fd5e8b440d, InitProcess() is called later in the  
EXEC_BACKEND startup sequence, so it's enough to set the  
am_autovacuum_[launcher|worker] variables at the same place as in the  
!EXEC_BACKEND case.  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/include/postmaster/autovacuum.h

Don't use pgbench -j in tests

commit   : a3f76a3f7e3a670728e2e2bed45499c11acb2936    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Dec 2023 14:00:51 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Dec 2023 14:00:51 +0100    

Click here for diff

It draws an unnecessary error in builds compiled without thread support.  
  
Added by commit 038f586d5f1d, which was backpatched to 14; though in  
branch master we no longer support such builds, there's no reason to  
have this there, so remove it in all branches since 14.  
  
Reported-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Remove unnecessary include of <math.h>

commit   : 457428d9e99b6bed6f3aabd596cb882564d1e207    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    

Click here for diff

This was probably never necessary.  (The header used to use random(),  
but that shouldn't require <math.h> either.  In any case, that's gone,  
too.)  
  
Reviewed-by: Shubham Khanna <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cff5475d-e0a9-4561-b094-794aa36bd031%40eisentraut.org  

M src/include/optimizer/geqo_random.h

Remove unnecessary include of <sys/socket.h>

commit   : da67cb0a4487bfbf269de72de9d9252dfc80813d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    

Click here for diff

This was put here as part of a mechanical replacement of the old  
"getaddrinfo.h" with <netdb.h> plus <sys/socket.h> (commit  
5579388d2d).  But here, we only need netdb.h (for NI_MAXHOST), not  
sys/socket.h.  
  
Reviewed-by: Shubham Khanna <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cff5475d-e0a9-4561-b094-794aa36bd031%40eisentraut.org  

M src/include/replication/walreceiver.h

Remove unnecessary includes of <signal.h>

commit   : dffb2b478f54f4abdd0271bbab44d3f81d017648    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Dec 2023 06:34:27 +0100    

Click here for diff

These were once needed for sig_atomic_t, but that no longer appears in  
these headers, so the include is not needed.  
  
Reviewed-by: Shubham Khanna <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cff5475d-e0a9-4561-b094-794aa36bd031%40eisentraut.org  

M src/include/replication/walsender.h
M src/include/replication/worker_internal.h

Add support for REINDEX in event triggers

commit   : f21848de20130146bc8039504af40bd24add54cd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Dec 2023 09:53:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Dec 2023 09:53:49 +0900    

Click here for diff

This commit adds support for REINDEX in event triggers, making this  
command react for the events ddl_command_start and ddl_command_end.  The  
indexes rebuilt are collected with the ReindexStmt emitted by the  
caller, for the concurrent and non-concurrent paths.  
  
Thanks to that, it is possible to know a full list of the indexes that a  
single REINDEX command has worked on.  
  
Author: Garrett Thornburg, Jian He  
Reviewed-by: Jim Jones, Michael Paquier  
Discussion: https://postgr.es/m/CAEEqfk5bm32G7sbhzHbES9WejD8O8DCEOaLkxoBP7HNWxjPpvg@mail.gmail.com  

M doc/src/sgml/event-trigger.sgml
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/include/catalog/index.h
M src/include/tcop/cmdtaglist.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

doc: Remove reference to trigger file regarding promotion

commit   : d78b6cbb602f5c36db3e267e2713b3aa22c815a5    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Dec 2023 08:09:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Dec 2023 08:09:51 +0900    

Click here for diff

The wording changed here comes from 991bfe11d28a, when the only way to  
trigger a promotion was with a trigger file.  There are more options to  
achieve this operation these days, like the SQL function pg_promote() or  
the command `pg_ctl promote`, so it is confusing to assume that only a  
trigger file is able to do the work.  
  
Note also that promote_trigger_file has been removed as of cd4329d9393f  
in 16~.  
  
Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Refactor how InitProcess is called

commit   : fd5e8b440dfd633be74e3dd3382d4a9038dba24f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:39:18 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:39:18 +0200    

Click here for diff

The order of process initialization steps is now more consistent  
between !EXEC_BACKEND and EXEC_BACKEND modes. InitProcess() is called  
at the same place in either mode. We can now also move the  
AttachSharedMemoryStructs() call into InitProcess() itself. This  
reduces the number of "#ifdef EXEC_BACKEND" blocks.  
  
Reviewed-by: Tristan Partin, Andres Freund, Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/proc.c

Pass BackgroundWorker entry in the parameter file in EXEC_BACKEND mode

commit   : 388491f1e5e63fe97c7cca26d18b64321973d423    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:38:54 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:38:54 +0200    

Click here for diff

The BackgroundWorker struct is now passed the same way as the Port  
struct. Seems more consistent.  
  
This makes it possible to move InitProcess later in SubPostmasterMain  
(in next commit), as we no longer need to access shared memory to read  
background worker entry.  
  
Reviewed-by: Tristan Partin, Andres Freund, Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/include/postmaster/bgworker_internals.h

Refactor CreateSharedMemoryAndSemaphores

commit   : 69d903367cdea188bf865f4edd72a186cda9e689    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:09:42 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 3 Dec 2023 16:09:42 +0200    

Click here for diff

For clarity, have separate functions for *creating* the shared memory  
and semaphores at postmaster or single-user backend startup, and  
for *attaching* to existing shared memory structures in EXEC_BACKEND  
case. CreateSharedMemoryAndSemaphores() is now called only at  
postmaster startup, and a new AttachSharedMemoryStructs() function is  
called at backend startup in EXEC_BACKEND mode.  
  
Reviewed-by: Tristan Partin, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/replication/walreceiver.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/ipc.h

Silence Valgrind complaint with EXEC_BACKEND

commit   : b19890d49d122257ddcdb7ab2c5038f5075906c1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Dec 2023 22:30:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Dec 2023 22:30:08 +0200    

Click here for diff

The padding bytes written to the backend params file were  
uninitialized. That's harmless because we don't access the padding  
bytes when we read the file back in, but Valgrind doesn't know  
that. In any case, clear the padding bytes to make Valgrind happy.  
  
Reported-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c

pgindent fix

commit   : 0d93ce31a584ff454f39df9f94f84376756e074b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 17:58:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 17:58:18 +0100    

Click here for diff

for commit a11c9c42ea  

M src/backend/commands/indexcmds.c

Check collation when creating partitioned index

commit   : a11c9c42ea3193ff7a977764788bda43ebb07b35    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 15:48:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 15:48:06 +0100    

Click here for diff

When creating a partitioned index, the partition key must be a subset  
of the index's columns.  But this currently doesn't check that the  
collations between the partition key and the index definition match.  
So you can construct a unique index that fails to enforce uniqueness.  
(This would most likely involve a nondeterministic collation, so it  
would have to be crafted explicitly and is not something that would  
just happen by accident.)  
  
This patch adds the required collation check.  As a result, any  
previously allowed unique index that has a collation mismatch would no  
longer be allowed to be created.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/3327cb54-f7f1-413b-8fdb-7a9dceebb938%40eisentraut.org  

M src/backend/commands/indexcmds.c

doc: Update info on information schema usage tables

commit   : 5b2dcead39904ae56e2c17cb5c7a14e6f255790c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 08:40:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2023 08:40:45 +0100    

Click here for diff

Commit f40c6969d0 added the information schema usage tables but added  
documentation that they did not fully work yet.  Commit e717a9a18b  
then added SQL-standard function bodies, which made the information  
schema views fully functional, but it neglected to update the  
documentation.  This is now done here.  
  
Reported-by: Erki Eessaar <[email protected]>  
Reviewed-by: Erki Eessaar <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/AM9PR01MB8268EC7B696F9FE346CA5B93FEB8A%40AM9PR01MB8268.eurprd01.prod.exchangelabs.com  

M doc/src/sgml/information_schema.sgml

Fix an uninitialized access in hash_xlog_squeeze_page().

commit   : f66fcc5cd616da8d81a2d2f9b80a9f080796f4b6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 1 Dec 2023 10:14:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 1 Dec 2023 10:14:36 +0530    

Click here for diff

Commit 861f86beea changed hash_xlog_squeeze_page() to start reading  
the write buffer conditionally but forgot to initialize it leading to an  
uninitialized access.  
  
Reported-by: Alexander Lakhin  
Author: Hayato Kuroda  
Reviewed-by: Alexander Lakhin, Amit Kapila  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/test/regress/expected/hash_index.out
M src/test/regress/sql/hash_index.sql

meson: Stop using deprecated way getting path of files

commit   : aa11a9c14902b7bcb1d73533a0403dc50361112a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Nov 2023 17:43:39 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Nov 2023 17:43:39 -0800    

Click here for diff

The just released meson 1.3 strongly deprecated a hack we were using, emitting  
a noisy warning (the hack basically depended on an implementation detail to  
work). Turns out there has been a better way available for a while, I just  
hadn't found it. 1.4 added a more convenient approach, but we can't rely on  
that.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the meson build was added.  

M meson.build

Adjust obsolete comment explaining set_stack_base().

commit   : 3b51265ee30784880fb2652051a4066ab9f9f90e    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 1 Dec 2023 14:58:40 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 1 Dec 2023 14:58:40 +1300    

Click here for diff

Commit 7389aad6 removed the notion of backends started from inside a  
signal handler.  A stray comment still referred to them, while  
explaining the need for a call to set_stack_base().  That leads to the  
question of whether we still need the call in !EXEC_BACKEND builds.  
There doesn't seem to be much point in suppressing it now, as it doesn't  
hurt and probably helps to measure the stack base from the exact same  
place in EXEC_BACKEND and !EXEC_BACKEND builds.  
  
Back-patch to 16.  
  
Reported-by: Heikki Linnakangas <[email protected]>  
Reported-by: Tristan Partin <[email protected]>  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BEJHcevNGNOxVWxTNFbuB%3Dvjf4U68%2B85rAC_Sxvy2zEQ%40mail.gmail.com  

M src/backend/utils/init/miscinit.c

Print lwlock stats also for aux processes, when built with LWLOCK_STATS

commit   : f93133a250c62d4dcda4298296fca759a8779621    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Dec 2023 01:00:03 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Dec 2023 01:00:03 +0200    

Click here for diff

InitAuxiliaryProcess() closely resembles InitProcess(), but it didn't  
call InitLWLockAccess(). But because InitLWLockAccess() is a no-op  
unless compiled with LWLOCK_STATS, and everything works even if it's  
not called, the only consequence was that the stats were not printed  
for aux processes.  
  
This was an oversight in commit 1c6821be31f, in version 9.5, so it is  
missing in all supported branches. But since it only affects  
developers using LWLOCK_STATS and no one has complained, no  
backpatching.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix typo in 5a1dfde8334b

commit   : ae2ccf66a261caac9701986597e3f29188f890d6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Nov 2023 13:45:28 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Nov 2023 13:45:28 +0200    

Click here for diff

Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix spelling and punctuation

commit   : b3efa270b5192f0c72dc26f0ea1bc795ad8516c3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:53 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:53 +0100    

Click here for diff

Remove trailing periods from pg_log_error emitted strings as only  
hint and detail level error messages should be punctuated.  Also  
reword the usage screen which was missing a word.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c

Add missing file to nls Makefile

commit   : c3f4a84481b6a8d84b1928165a7bf459e5304ed8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:51 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:51 +0100    

Click here for diff

Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/nls.mk

Fix array subscript warnings

commit   : 17935e1fdf0aff083347b4b2d6268d945041d188    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:48 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Nov 2023 10:56:48 +0100    

Click here for diff

Commit a5cf808be55 accidentally passed signed chars to isalpha and  
isspace in the parser code which leads to undefined behavior.  Fix  
by casting the parameters to unsigned chars.  
  
Author: Pavel Stehule <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/filter.c

Fix warning due non-standard inline declaration in 4ed8f0913bfdb5f355

commit   : b589f211e025eb66f7c9e5a0b0cc23cc6fff3605    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Nov 2023 11:34:45 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Nov 2023 11:34:45 +0200    

Click here for diff

Reported-by: Alexander Lakhin, Tom Lane  
Author: Pavel Borisov  
Discussion: https://postgr.es/m/[email protected]  

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

Remove redundant setting of hashkey after insertion

commit   : 095d109ccd76ca4c46c4ea2be30d63d70361c5f9    
  
author   : John Naylor <[email protected]>    
date     : Thu, 30 Nov 2023 15:25:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 30 Nov 2023 15:25:57 +0700    

Click here for diff

It's not necessary to fill the key field in most cases, since  
hash_search has already done that. Some existing call sites have an  
assert or comment that this contract has been fulfilled, but those  
are quite old and that practice seems unnecessary here.  
  
While at it, remove a nearby redundant assignment that a smart compiler  
will elide anyway.  
  
Zhao Junwang, with some adjustments by me  
  
Reviewed by Nathan Bossart, with additional feedback from Tom Lane  
  
Discussion: http://postgr.es/m/CAEG8a3%2BUPF%3DR2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA%40mail.gmail.com  

M contrib/dblink/dblink.c
M src/backend/commands/async.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/relation.c

meson: Improve/fix Python version selection

commit   : 489ca33081c8f590a314d4a09d9bee56a81f1a85    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 07:22:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 07:22:51 +0100    

Click here for diff

When we look for the Python installation using the meson python  
module, we should make it use the python program previously determined  
by the 'PYTHON' option.  Otherwise, it will just use its own search  
and the 'PYTHON' option won't affect it.  We need this to be able to  
select the Python installation to build PL/Python against.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/3f5427e8-cef6-474d-ae88-13db1bfdc1a7%40eisentraut.org  

M meson.build

Add tests for XID wraparound.

commit   : e255b646a16b45823c338dadf787813fc9e191dc    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 14:29:48 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 14:29:48 +0900    

Click here for diff

The test module includes helper functions to quickly burn through lots  
of XIDs. They are used in the tests, and are also handy for manually  
testing XID wraparound.  
  
Since these tests are very expensive the entire suite is disabled by  
default. It requires to set PG_TEST_EXTRA to run it.  
  
Reviewed-by: Daniel Gustafsson, John Naylor, Michael Paquier  
Reviewed-by: vignesh C  
Author: Heikki Linnakangas, Masahiko Sawada, Andres Freund  
Discussion: https://www.postgresql.org/message-id/CAD21AoDVhkXp8HjpFO-gp3TgL6tCKcZQNxn04m01VAtcSi-5sA%40mail.gmail.com  

M doc/src/sgml/regress.sgml
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/xid_wraparound/.gitignore
A src/test/modules/xid_wraparound/Makefile
A src/test/modules/xid_wraparound/README
A src/test/modules/xid_wraparound/meson.build
A src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
A src/test/modules/xid_wraparound/t/002_limits.pl
A src/test/modules/xid_wraparound/t/003_wraparounds.pl
A src/test/modules/xid_wraparound/xid_wraparound–1.0.sql
A src/test/modules/xid_wraparound/xid_wraparound.c
A src/test/modules/xid_wraparound/xid_wraparound.control

doc: Mention how to use quotes with GUC names in error messages

commit   : a243569bf65c5664436e8f63d870b7ee9c014dcb    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Nov 2023 14:19:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Nov 2023 14:19:29 +0900    

Click here for diff

Quotes should not be used except if a GUC name is a natural English  
word.  
  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/CAHut+Pv-kSN8SkxSdoHano_wPubqcg5789ejhCDZAcLFceBR-w@mail.gmail.com  

M doc/src/sgml/sources.sgml

Apply quotes more consistently to GUC names in logs

commit   : 8d9978a7176a2805a8188605de3c16ffc914dc8a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Nov 2023 14:11:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Nov 2023 14:11:45 +0900    

Click here for diff

Quotes are applied to GUCs in a very inconsistent way across the code  
base, with a mix of double quotes or no quotes used.  This commit  
removes double quotes around all the GUC names that are obviously  
referred to as parameters with non-English words (use of underscore,  
mixed case, etc).  
  
This is the result of a discussion with Álvaro Herrera, Nathan Bossart,  
Laurenz Albe, Peter Eisentraut, Tom Lane and Daniel Gustafsson.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pv-kSN8SkxSdoHano_wPubqcg5789ejhCDZAcLFceBR-w@mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/backend/commands/variable.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/test/modules/commit_ts/expected/commit_timestamp_1.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out

Add option to specify timeout seconds to BackgroundPsql.pm.

commit   : 334f512f45ebc946ca1a5aa51808b4447f6384a0    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 14:08:34 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 14:08:34 +0900    

Click here for diff

Previously, a background psql session uses the default timeout and it  
cannot be overridden. This change adds a new option to set the timeout  
during start.  
  
There are no users of this new option. It is needed for an upcoming  
patch adding tests for XID wraparound.  
  
Reviewed-by: Daniel Gustafsson, Noah Misch  
Discussion: https://postgr.es/m/C9CF2F76-0D81-4C9D-9832-202BE8517056%40yesql.se  

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

Remove unused macro

commit   : a1827568d22fba9e33044b8cfc5eb19e55ad5488    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 06:00:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 06:00:44 +0100    

Click here for diff

Usage was removed in a33e17f210 but the definition was not removed.  

M src/bin/pg_rewind/pg_rewind.c

Improve "user mapping not found" error message

commit   : 7e5f5177996150bf3845562d00d41d1e1847d7e3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 05:33:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2023 05:33:55 +0100    

Click here for diff

Display the name of the foreign server for which the user mapping was  
not found.  
  
Author: Ian Lawrence Barwick <[email protected]>  
Reviewed-by: Laurenz Albe <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAB8KJ=jFzNaeyFtLcTZNOc6fd1+F93pGVLFa-wyt31wn7VNxqQ@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/foreign/foreign.c

Fix a test in 003_logical_slots.

commit   : 3e36e48d8efecea9f2c991c0341e567af2eb363a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 30 Nov 2023 09:31:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 30 Nov 2023 09:31:21 +0530    

Click here for diff

We allow to upgrade the slot iff there is no pending WAL to be processed.  
The test first disables the subscription to avoid unnecessary LOGs on the  
subscriber and then stops the publisher node. It is quite possible that  
just before the shutdown of the publisher, autovacuum generates some WAL  
record that needs to be processed, so just disable the autovacuum for this  
test.  
  
Per buildfarm.  
  
Author: Hayato Kuroda  
Reviewed-by: Amit Kapila  
Discussion: http://postgr.es/m/OS3PR01MB9882FED1F0060468FB01B9DAF583A@OS3PR01MB9882.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/003_logical_slots.pl

Fix wrong description of BackgroundPsql's timeout.

commit   : 5abff2aaa1ab968cccbb76823e089b790912d21f    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 11:23:00 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 11:23:00 +0900    

Click here for diff

Backpatch through 16 where this was introduced by 664d757531e1.  
  
Reviewed-by: Daniel Gustafsson  
Backpatch-through: 16  
Discussion: http://postgr.es/m/CAD21AoBXMEqDBLoDuAWVWoTLYB4aNsxx4oYNmyJJbhfq_vGQBQ@mail.gmail.com  

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

Fix BackgroundPsql's set_query_timer_restart() issue without argument.

commit   : f99dd98242d41fd33a93c913430cc431b7baa8e2    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 10:14:17 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 30 Nov 2023 10:14:17 +0900    

Click here for diff

The set_query_timer_restart() required an argument to define a value  
to query_timer_restart, but none of the existing callers passes an  
argument to this function.  
  
This changes the function to set a value without an argument.  
  
Backpatch through 16 where the background psql TAP functions were  
refactored by 664d757531e1.  
  
Reviewed-by: Bharath Rupireddy, Tom Lane  
Discussion: https://postgr.es/m/CAD21AoA0B6VKe_5A9nZi8i5umwSN-zJJuPVNht9DaOZ9SJumMA@mail.gmail.com  
Backpatch-through: 16  

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

Fix typo in comment

commit   : 03749325d16c4215ecd6d6a6fe117d93931d84aa    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Nov 2023 14:56:26 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Nov 2023 14:56:26 +0100    

Click here for diff

Spotted while looking over changes for another patch.  

M src/bin/pg_dump/pg_dump.c

Read include/exclude commands for dump/restore from file

commit   : a5cf808be55bcc68c3917c380f95122436af1be1    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Nov 2023 14:56:24 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Nov 2023 14:56:24 +0100    

Click here for diff

When there is a need to filter multiple tables with include and/or exclude  
options it's quite possible to run into the limitations of the commandline.  
This adds a --filter=FILENAME feature to pg_dump, pg_dumpall and pg_restore  
which is used to supply a file containing object exclude/include commands  
which work just like their commandline counterparts. The format of the file  
is one command per row like:  
  
    <command> <object> <objectpattern>  
  
<command> can be "include" or "exclude", <object> can be table_data, index  
table_data_and_children, database, extension, foreign_data, function, table  
schema, table_and_children or trigger.  
  
This patch has gone through many revisions and design changes over a long  
period of time, the list of reviewers reflect reviewers of some version of  
the patch, not necessarily the final version.  
  
Patch by Pavel Stehule with some additional hacking by me.  
  
Author: Pavel Stehule <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: vignesh C <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/CAFj8pRB10wvW0CC9Xq=1XDs=zCQxer3cbLcNZa+qiX4cUH-G_A@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/Makefile
A src/bin/pg_dump/filter.c
A src/bin/pg_dump/filter.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
A src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/typedefs.list

Optimize pg_readv/pg_pwritev single vector case.

commit   : 15c9ac3629936a9bb5010155d3656e913027ccb7    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 29 Nov 2023 16:44:19 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 29 Nov 2023 16:44:19 +1300    

Click here for diff

For the trivial case of iovcnt == 1, kernels are measurably slower at  
dealing with the more complex arguments of preadv/pwritev than the  
equivalent plain old pread/pwrite.  The overheads are worth it for  
iovcnt > 1, but for 1 let's just redirect to the cheaper calls.  While  
we could leave it to callers to worry about that, we already have to  
have our own pg_ wrappers for portability reasons so it seems  
reasonable to centralize this knowledge there (thanks to Heikki for this  
suggestion).  Try to avoid function call overheads by making them  
inlinable, which might also allow the compiler to avoid the branch in  
some cases.  For systems that don't have preadv and pwritev (currently:  
Windows and [closed] Solaris), we might as well pull the replacement  
functions up into the static inline functions too.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com  

M configure
M configure.ac
M src/include/port/pg_iovec.h
M src/port/meson.build
D src/port/preadv.c
D src/port/pwritev.c
M src/tools/msvc/Mkvcbuild.pm

Add SLRU tests for 64-bit page case

commit   : a60b8a58f435c44fc54e904cb05784b49dc04d0e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:44:01 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:44:01 +0200    

Click here for diff

4ed8f0913b added 64-bit page numbering for SLRU.  This commit adds tests for  
page numbers higher than 2^32.  
  
Author: Maxim Orlov  
Reviewed-by: Aleksander Alekseev, Alexander Korotkov  
Discussion: https://postgr.es/m/CACG%3DezZe1NQSCnfHOr78AtAZxJZeCvxrts0ygrxYwe%3DpyyjVWA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAJ7c6TPDOYBYrnCAeyndkBktO0WG2xSdYduTF0nxq%2BvfkmTF5Q%40mail.gmail.com  

M src/test/modules/test_slru/expected/test_slru.out
M src/test/modules/test_slru/sql/test_slru.sql

Make use FullTransactionId in 2PC filenames

commit   : 5a1dfde8334b25e19bf4b3aa75274c547a3aa30f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:43:13 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:43:13 +0200    

Click here for diff

Switch from using TransactionId to FullTransactionId in naming of 2PC files.  
Transaction state file in the pg_twophase directory now have extra 8 bytes in  
the name to address an epoch of a given xid.  
  
Author: Maxim Orlov, Aleksander Alekseev, Alexander Korotkov, Teodor Sigaev  
Author: Nikita Glukhov, Pavel Borisov, Yura Sokolov  
Reviewed-by: Jacob Champion, Heikki Linnakangas, Alexander Korotkov  
Reviewed-by: Japin Li, Pavel Borisov, Tom Lane, Peter Eisentraut, Andres Freund  
Reviewed-by: Andrey Borodin, Dilip Kumar, Aleksander Alekseev  
Discussion: https://postgr.es/m/CACG%3DezZe1NQSCnfHOr78AtAZxJZeCvxrts0ygrxYwe%3DpyyjVWA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAJ7c6TPDOYBYrnCAeyndkBktO0WG2xSdYduTF0nxq%2BvfkmTF5Q%40mail.gmail.com  

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

Use larger segment file names for pg_notify

commit   : 2cdf131c46e631addfc386f6106e52a1b8cc3a70    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:41:48 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:41:48 +0200    

Click here for diff

This avoids the wraparound in async.c and removes the corresponding code  
complexity. The maximum amount of allocated SLRU pages for NOTIFY / LISTEN  
queue is now determined by the max_notify_queue_pages GUC. The default  
value is 1048576. It allows to consume up to 8 GB of disk space which is  
exactly the limit we had previously.  
  
Author: Maxim Orlov, Aleksander Alekseev, Alexander Korotkov, Teodor Sigaev  
Author: Nikita Glukhov, Pavel Borisov, Yura Sokolov  
Reviewed-by: Jacob Champion, Heikki Linnakangas, Alexander Korotkov  
Reviewed-by: Japin Li, Pavel Borisov, Tom Lane, Peter Eisentraut, Andres Freund  
Reviewed-by: Andrey Borodin, Dilip Kumar, Aleksander Alekseev  
Discussion: https://postgr.es/m/CACG%3DezZe1NQSCnfHOr78AtAZxJZeCvxrts0ygrxYwe%3DpyyjVWA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAJ7c6TPDOYBYrnCAeyndkBktO0WG2xSdYduTF0nxq%2BvfkmTF5Q%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/listen.sgml
M doc/src/sgml/ref/notify.sgml
M src/backend/commands/async.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/commands/async.h

Index SLRUs by 64-bit integers rather than by 32-bit integers

commit   : 4ed8f0913bfdb5f3551de3c27fc2c2e880abc5a2    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:39:55 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 29 Nov 2023 01:39:55 +0200    

Click here for diff

We've had repeated bugs in the area of handling SLRU wraparound in the past,  
some of which have caused data loss. Switching to an indexing system for SLRUs  
that does not wrap around should allow us to get rid of a whole bunch  
of problems and improve the overall reliability of the system.  
  
This particular patch however only changes the indexing and doesn't address  
the wraparound per se. This is going to be done in the following patches.  
  
Author: Maxim Orlov, Aleksander Alekseev, Alexander Korotkov, Teodor Sigaev  
Author: Nikita Glukhov, Pavel Borisov, Yura Sokolov  
Reviewed-by: Jacob Champion, Heikki Linnakangas, Alexander Korotkov  
Reviewed-by: Japin Li, Pavel Borisov, Tom Lane, Peter Eisentraut, Andres Freund  
Reviewed-by: Andrey Borodin, Dilip Kumar, Aleksander Alekseev  
Discussion: https://postgr.es/m/CACG%3DezZe1NQSCnfHOr78AtAZxJZeCvxrts0ygrxYwe%3DpyyjVWA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAJ7c6TPDOYBYrnCAeyndkBktO0WG2xSdYduTF0nxq%2BvfkmTF5Q%40mail.gmail.com  

M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/predicate.c
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/slru.h
M src/include/storage/proc.h
M src/include/storage/sync.h
M src/test/modules/test_slru/expected/test_slru.out
M src/test/modules/test_slru/test_slru–1.0.sql
M src/test/modules/test_slru/test_slru.c

Clean up usage of bison precedence for non-operator keywords.

commit   : a916b47e23290ca24ffd083e5128d994f62966f6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2023 13:32:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2023 13:32:15 -0500    

Click here for diff

Assigning a precedence to a keyword that isn't a kind of expression  
operator is rather dangerous, because it might mask grammar  
ambiguities that we'd rather know about.  It's much safer to attach  
explicit precedences to individual rules, which will affect the  
behavior of only that one rule.  Moreover, when we do have to give  
a precedence to a non-operator keyword, we should try to give it the  
same precedence as IDENT, thereby reducing the risk of surprising  
side-effects.  
  
Apply this hard-won knowledge to SET (which I misassigned ages ago  
in commit 2647ad658) and some SQL/JSON-related productions  
(from commits 6ee30209a, 71bfd1543).  
  
Patch HEAD only, since there's no evidence of actual bugs here.  
  
Discussion: https://postgr.es/m/CADT4RqBPdbsZW7HS1jJP319TMRHs1hzUiP=iRJYR6UqgHCrgNQ@mail.gmail.com  

M src/backend/parser/gram.y

Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

commit   : c82207a548db47623a2bfa2447babdaa630302b9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2023 12:34:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2023 12:34:03 -0500    

Click here for diff

We should have done it this way all along, but we accidentally got  
away with using the wrong BIO field up until OpenSSL 3.2.  There,  
the library's BIO routines that we rely on use the "data" field  
for their own purposes, and our conflicting use causes assorted  
weird behaviors up to and including core dumps when SSL connections  
are attempted.  Switch to using the approved field for the purpose,  
i.e. app_data.  
  
While at it, remove our configure probes for BIO_get_data as well  
as the fallback implementation.  BIO_{get,set}_app_data have been  
there since long before any OpenSSL version that we still support,  
even in the back branches.  
  
Also, update src/test/ssl/t/001_ssltests.pl to allow for a minor  
change in an error message spelling that evidently came in with 3.2.  
  
Tristan Partin and Bo Andreson.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAN55FZ1eDDYsYaL7mv+oSLUij2h_u6hvD4Qmv-7PK7jkji0uyQ@mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/backend/libpq/be-secure-openssl.c
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/Solution.pm

Fix comment about ressortgrouprefs being unique in setop plans.

commit   : 10a59925a378bd67aa3834c842dad19de9c5e4c0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Nov 2023 14:08:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Nov 2023 14:08:43 +0200    

Click here for diff

Author: Richard Guo, Tom Lane  
Discussion: https://www.postgresql.org/message-id/CAMbWs49rAfFS-yd7=QxtDUrZDFfRBGy4rGBJNyGDH7=CLipFPg@mail.gmail.com  

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

Remove more statements from stats.sql

commit   : f36b63623db60e16b910658d6fde6b7931e0ac46    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 19:44:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 19:44:13 +0900    

Click here for diff

Some of the statements capturing stats reset timestamps have become  
unnecessary after a9a8108411e4, so let's remove them.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACUnvB_Yo=O1xApBa4CDqQpW-x=QM35GBN1MqVRAxAGXEg@mail.gmail.com  

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

Fix assertions with RI triggers in heap_update and heap_delete.

commit   : 60f227316c0ebf5f4f8296f11cedc9360e9cb8ae    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Nov 2023 11:59:09 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Nov 2023 11:59:09 +0200    

Click here for diff

If the tuple being updated is not visible to the crosscheck snapshot,  
we return TM_Updated but the assertions would not hold in that case.  
Move them to before the cross-check.  
  
Fixes bug #17893. Backpatch to all supported versions.  
  
Author: Alexander Lakhin  
Backpatch-through: 12  
Discussion: https://www.postgresql.org/message-id/17893-35847009eec517b5%40postgresql.org  

M src/backend/access/heap/heapam.c
M src/include/access/tableam.h
M src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/specs/fk-snapshot.spec

psql: Add tab completion for view options.

commit   : cd342474890f31a7364c0d1161334546822b639c    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 28 Nov 2023 09:50:17 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 28 Nov 2023 09:50:17 +0000    

Click here for diff

Add support for tab completion of WITH (...) options to CREATE VIEW,  
and for the corresponding SET/RESET (...) options in ALTER VIEW.  
  
Christoph Heiss, reviewed by Melih Mutlu, Vignesh C, Jim Jones,  
Mikhail Gribkov, David Zhang, Shubham Khanna, and me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove test for pg_stat_reset_shared() in stats.sql

commit   : a9a8108411e49c81316a9aba848a7f9ad3d3e939    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 13:18:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 13:18:59 +0900    

Click here for diff

Some buildfarm members have been failing a test related to pg_stat_io,  
as an effect of 23c8c0c8f472 that has switched pg_stat_reset_shared()  
from being a no-op to reset all shared stats types.  
  
This extra reset has the effect to make pg_stat_io's counters low enough  
that little concurrent activity is enough to cause a failure.  Another  
thing I have considered is to move this sequence at the end of  
stats.sql, but there are other instabilities, one being pg_stat_wal.  
  
Knowing that there are already tests for the reset of each individual  
shared stats target, this test has limited value, so let's remove it to  
minimize the number of resets done for each shared stats type.  This  
should hopefully improve the stability of the whole.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix comment in tableam.h about GetHeapamTableAmRoutine()

commit   : 5ad49322e50459444b201e624d5df706751c9d41    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 08:40:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 08:40:08 +0900    

Click here for diff

This routine is located in heapam_handler.c, not tableamapi.c.  Issue  
noted while hacking the area for a different patch.  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/tableam.h

Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the backend

commit   : 14f2f9eb1a15f234f1ef417b8e62a6b7f950be4d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 08:35:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Nov 2023 08:35:50 +0900    

Click here for diff

scram_SaltedPassword() could take a long time to compute when the number  
of iterations used is large enough, and this code uses a tight loop to  
compute a salted password.  
  
Note that the same issue exists in libpq when using \password and a  
large iteration number, but this cannot be interrupted.  A CFI in the  
backend is useful for server-side computations, at least.  
  
Backpatch down to 16, where the user-settable GUC scram_iterations has  
been added.  
  
Author: Bowen Shi  
Reviewed-by: Aleksander Alekseev, Daniel Gustafsson  
Discussion: https://postgr.es/m/CAM_vCueV6xfr08KczfaCEk5J_qeTZtgqN7+orkNLx=g+phE82Q@mail.gmail.com  
Backpatch-through: 16  

M src/common/scram-common.c

Don't use bms_membership() in cases where we don't need to

commit   : 930d2b442ff12e6d466a8c62cecdf3f17680aa3e    
  
author   : David Rowley <[email protected]>    
date     : Tue, 28 Nov 2023 10:41:12 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 28 Nov 2023 10:41:12 +1300    

Click here for diff

00b41463c adjusted Bitmapset so that an empty set is always represented  
as NULL.  This makes checking for empty sets far cheaper than it used  
to be.  
  
There were various places in the code where we'd call bms_membership()  
to handle the 3 possible BMS_Membership values.  For the BMS_SINGLETON  
case, we'd also call bms_singleton_member() to find the single set member.  
This can now be done in a more optimal way by first checking if the set is  
NULL and then not bothering with bms_membership() and simply call  
bms_get_singleton_member() instead to find the single member.  This  
function will return false if there are multiple members in the set.  
  
Here we also tidy up some logic in examine_variable() for the single  
member case.  There's now no need to call bms_is_member() as we've  
already established that we're working with a singleton Bitmapset, so we  
can just check if varRelid matches the singleton member.  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvqW+CxNPcY245GaWiuqkkqgTudtG2ncGvvSjGn2wdTZLA@mail.gmail.com  

M src/backend/optimizer/plan/initsplan.c
M src/backend/utils/adt/selfuncs.c

Retire a few backwards compatibility macros.

commit   : 75680c3d805e2323cd437ac567f0677fdfc7b680    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 27 Nov 2023 13:10:09 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 27 Nov 2023 13:10:09 -0600    

Click here for diff

As of commits dd04e958c8 and 1833f1a1c3, tuplestore_donestoring(),  
SPI_push(), SPI_pop(), SPI_push_conditional(),  
SPI_pop_conditional(), and SPI_restore_connection() are no-op  
macros provided for backwards compatibility.  This commit removes  
these macros, so any uses in third-party code will need to be  
removed, too.  Since these macros have been no-ops for a while,  
such adjustments won't produce any behavior changes for all  
currently-supported versions of PostgreSQL.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVeO58JM5tK2Qa8QC-%3DkC8sdkJOTd4BFU%3DK8zs4gGYpjQ%40mail.gmail.com  

M src/include/executor/spi.h
M src/include/utils/tuplestore.h

Fix CREATE INDEX CONCURRENTLY example

commit   : 8a553f2aed8dfe6cb8cdd0fe78e01b19d4138b35    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 27 Nov 2023 19:18:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 27 Nov 2023 19:18:03 +0100    

Click here for diff

It fails to use the CONCURRENTLY keyword where it was necessary, so add  
it.  This text was added to pg11 in commit 5efd604ec0a3; backpatch to pg12.  
  
Author: Nikolay Samokhvalov <[email protected]>  
Discussion: https://postgr.es/m/CAM527d9iz6+=_c7EqSKaGzjqWvSeCeRVVvHZ1v3gDgjTtvgsbw@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Check if ii_AmCache is NULL in aminsertcleanup

commit   : a82ee7ef3aacc2073d3ef5f4b7e5067fa08ea76c    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 27 Nov 2023 16:52:59 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 27 Nov 2023 16:52:59 +0100    

Click here for diff

Fix a bug introduced by c1ec02be1d79. It may happen that the executor  
opens indexes on the result relation, but no rows end up being inserted.  
Then the index_insert_cleanup still gets executed, but passes down NULL  
to the AM callback. The AM callback may not expect this, as is the case  
of brininsertcleanup, leading to a crash.  
  
Fixed by only calling the cleanup callback if (ii_AmCache != NULL). This  
way the AM can simply assume to only see a valid cache.  
  
Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4-w9qC-o9hQox9UHvdVZAYTp8OrPQOKtwbvzWaRejTT=Q@mail.gmail.com  

M src/backend/access/index/indexam.c
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Reduce rate of walwriter wakeups due to async commits.

commit   : 1f395354d8742d57c166104874114b6e0d01e104    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Nov 2023 17:42:39 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Nov 2023 17:42:39 +0200    

Click here for diff

XLogSetAsyncXactLSN(), called at asynchronous commit, would wake up  
walwriter every time the LSN advances, but walwriter doesn't actually  
do anything unless it has at least 'wal_writer_flush_after' full  
blocks of WAL to write. Repeatedly waking up walwriter to do nothing  
is a waste of CPU cycles in both walwriter and the backends doing the  
wakeups. To fix, apply the same logic in XLogSetAsyncXactLSN() to  
decide whether to wake up walwriter, as walwriter uses to determine if  
it has any work to do.  
  
In the passing, rename misleadingly named 'flushbytes' local variable  
to 'flushblocks'.  
  
Author: Andres Freund, Heikki Linnakangas  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Avoid unconditionally filling in missing values with NULL in pgoutput.

commit   : 360392fa2a9bb74338b4864790d18eadb13fd8a8    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 27 Nov 2023 08:49:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 27 Nov 2023 08:49:55 +0530    

Click here for diff

52e4f0cd4 introduced a bug in pgoutput in which missing values in tuples  
were incorrectly filled in with NULL. The problem was the use of  
CreateTupleDescCopy where CreateTupleDescCopyConstr was required, as the  
former drops the constraints in the tuple description (specifically, the  
default value constraint) on the floor.  
  
The bug could result in incorrectness when a table replicated via  
`REPLICA IDENTITY FULL` underwent a schema change that added a column  
with a default value. The problem is that in such cases updates fill NULL  
values in old tuples for missing columns for default values. Then on the  
subscriber, we failed to find a matching tuple and missed updating the  
required row.  
  
Author: Nikhil Benesch  
Reviewed-by: Hou Zhijie, Amit Kapila  
Backpatch-through: 15  
Discussion: http://postgr.es/m/CAPWqQZTEpZQamYsGMn6ZDRvVywwpVPiKH6OY4KSgA+NmeqFNzA@mail.gmail.com  

M src/backend/replication/pgoutput/pgoutput.c
M src/test/subscription/t/100_bugs.pl

Track statement entry timestamp in contrib/pg_stat_statements

commit   : dc9f8a798307244d791b71f666f50de319799e7c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 02:51:18 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 02:51:18 +0200    

Click here for diff

This patch adds 'stats_since' and 'minmax_stats_since' columns to the  
pg_stat_statements view and pg_stat_statements() function.  The new min/max  
reset mode for the pg_stat_stetments_reset() function is controlled by the  
parameter minmax_only.  
  
'stat_since' column is populated with the current timestamp when a new  
statement is added to the pg_stat_statements hashtable.  It provides clean  
information about statistics collection time intervals for each statement.  
Besides it can be used by sampling solutions to detect situations when a  
statement was evicted and stored again between samples.  
  
Such a sampling solution could derive any pg_stat_statements statistic values  
for an interval between two samples with the exception of all min/max  
statistics. To address this issue this patch adds the ability to reset  
min/max statistics independently of the statement reset using the new  
minmax_only parameter of the pg_stat_statements_reset(userid oid, dbid oid,  
queryid bigint, minmax_only boolean) function. The timestamp of such reset  
is stored in the minmax_stats_since field for each statement.  
pg_stat_statements_reset() function now returns the timestamp of a reset as the  
result.  
  
Discussion: https://postgr.es/m/flat/72e80e7b160a6eb189df9ef6f068cce3765d37f8.camel%40moonset.ru  
Author: Andrei Zubkov  
Reviewed-by: Julien Rouhaud, Hayato Kuroda, Yuki Seino, Chengxi Sun  
Reviewed-by: Anton Melnikov, Darren Rush, Michael Paquier, Sergei Kornilov  
Reviewed-by: Alena Rybakina, Andrei Lepikhov  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/entry_timestamp.out
M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements–1.10–1.11.sql
M contrib/pg_stat_statements/pg_stat_statements.c
A contrib/pg_stat_statements/sql/entry_timestamp.sql
M contrib/pg_stat_statements/sql/oldextversions.sql
M doc/src/sgml/pgstatstatements.sgml

Add NOT NULL checking of pg_stat_statements_reset() in tests

commit   : 6ab1dbd26bbf307055d805feaaca16dc3e750d36    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 02:50:59 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 02:50:59 +0200    

Click here for diff

This is preliminary patch.  It adds NOT NULL checking for the result of  
pg_stat_statements_reset() function. It is needed for upcoming patch  
"Track statement entry timestamp" that will change the result type of  
this function to the timestamp of a reset performed.  
  
Discussion: https://postgr.es/m/flat/72e80e7b160a6eb189df9ef6f068cce3765d37f8.camel%40moonset.ru  
Author: Andrei Zubkov  
Reviewed-by: Julien Rouhaud, Hayato Kuroda, Yuki Seino, Chengxi Sun  
Reviewed-by: Anton Melnikov, Darren Rush, Michael Paquier, Sergei Kornilov  
Reviewed-by: Alena Rybakina, Andrei Lepikhov  

M contrib/pg_stat_statements/expected/cursors.out
M contrib/pg_stat_statements/expected/dml.out
M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/expected/planning.out
M contrib/pg_stat_statements/expected/select.out
M contrib/pg_stat_statements/expected/user_activity.out
M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/expected/wal.out
M contrib/pg_stat_statements/sql/cursors.sql
M contrib/pg_stat_statements/sql/dml.sql
M contrib/pg_stat_statements/sql/level_tracking.sql
M contrib/pg_stat_statements/sql/planning.sql
M contrib/pg_stat_statements/sql/select.sql
M contrib/pg_stat_statements/sql/user_activity.sql
M contrib/pg_stat_statements/sql/utility.sql
M contrib/pg_stat_statements/sql/wal.sql

Fix race condition with BIO methods initialization in libpq with threads

commit   : 01eca6a913c4997c17e1569898f14cf611bff647    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Nov 2023 09:40:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Nov 2023 09:40:44 +0900    

Click here for diff

The libpq code in charge of creating per-connection SSL objects was  
prone to a race condition when loading the custom BIO methods needed by  
my_SSL_set_fd().  As BIO methods are stored as a static variable, the  
initialization of a connection could fail because it could be possible  
to have one thread refer to my_bio_methods while it is being manipulated  
by a second concurrent thread.  
  
This error has been introduced by 8bb14cdd33de, that has removed  
ssl_config_mutex around the call of my_SSL_set_fd(), that itself sets  
the custom BIO methods used in libpq.  Like previously, the BIO method  
initialization is now protected by the existing ssl_config_mutex, itself  
initialized earlier for WIN32.  
  
While on it, document that my_bio_methods is protected by  
ssl_config_mutex, as this can be easy to miss.  
  
Reported-by: Willi Mann  
Author: Willi Mann, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Display length and bounds histograms in pg_stats

commit   : bc3c8db8ae2f899cfd65edce99fe9cf65caf1ed7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 01:30:39 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 01:30:39 +0200    

Click here for diff

Values corresponding to STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM and  
STATISTIC_KIND_BOUNDS_HISTOGRAM were not exposed to pg_stats when these  
slot kinds were introduced in 918eee0c49.  
  
This commit adds the missing fields to pg_stats.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/flat/[email protected]  
Author: Egor Rogov, Soumyadeep Chakraborty  
Reviewed-by: Tomas Vondra, Justin Pryzby, Jian He  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Update comments for pg_statistic catalog table

commit   : 441c8a31349105590e778fe7dd1db0d0c89299df    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 01:29:56 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 27 Nov 2023 01:29:56 +0200    

Click here for diff

Make a reminder that pg_stats view needs to be modified whenever a new slot  
kind is added.  To prevent situations like 918eee0c49 when pg_stats was  
forgotten to be updated.  
  
Also, revise the comment that only non-null, non-empty rows are considered  
for the range length histogram.  
  
Discussion: https://postgr.es/m/flat/[email protected]  
Author: Egor Rogov, Soumyadeep Chakraborty  
Reviewed-by: Tomas Vondra, Justin Pryzby, Jian He  

M src/include/catalog/pg_statistic.h

Doc: list AT TIME ZONE and COLLATE in operator precedence table.

commit   : 3558f120f8697e63d97145706151778bb176ba7b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Nov 2023 16:40:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Nov 2023 16:40:22 -0500    

Click here for diff

These constructs have precedence, but we forgot to list them.  
In HEAD, mention AT LOCAL as well as AT TIME ZONE.  
  
Per gripe from Shay Rojansky.  
  
Discussion: https://postgr.es/m/CADT4RqBPdbsZW7HS1jJP319TMRHs1hzUiP=iRJYR6UqgHCrgNQ@mail.gmail.com  

M doc/src/sgml/syntax.sgml
M src/backend/parser/gram.y

Fix brin.c indentation issues introduced by c1ec02be1d

commit   : b2caf7c0e1ebada614b6aa3004d826080a07e7e4    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 26 Nov 2023 21:35:32 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 26 Nov 2023 21:35:32 +0100    

Click here for diff

Per buildfarm member koel.  

M src/backend/access/brin/brin.c
M src/tools/pgindent/typedefs.list

Use fipshash in brin_multi test

commit   : 86b64bafc19c4c60136a4038d2a8d1e6eecc59f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Nov 2023 22:18:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Nov 2023 22:18:53 +0100    

Click here for diff

This fixes some md5() calls that snuck in in 0457109344 after we had  
removed them all in 208bf364a9.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Reuse BrinDesc and BrinRevmap in brininsert

commit   : c1ec02be1d79eac95160dea7ced32ace84664617    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 25 Nov 2023 20:27:04 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 25 Nov 2023 20:27:04 +0100    

Click here for diff

The brininsert code used to initialize (and destroy) BrinDesc and  
BrinRevmap for each tuple, which is not free. This patch initializes  
these structures only once, and reuses them for all inserts in the same  
command. The data is passed through indexInfo->ii_AmCache.  
  
This also introduces an optional AM callback "aminsertcleanup" that  
allows performing custom cleanup in case simply pfree-ing ii_AmCache is  
not sufficient (which is the case when the cache contains TupleDesc,  
Buffers, and so on).  
  
Author: Soumyadeep Chakraborty  
Reviewed-by: Alvaro Herrera, Matthias van de Meent, Tomas Vondra  
Discussion: https://postgr.es/m/CAE-ML%2B9r2%3DaO1wwji1sBN9gvPz2xRAtFUGfnffpd0ZqyuzjamA%40mail.gmail.com  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/executor/execIndexing.c
M src/include/access/amapi.h
M src/include/access/brin_internal.h
M src/include/access/genam.h

C comment: add header to pg_test_fsync.c

commit   : 6ec8262a02a84470a6a5c936e51f6cb641cebce1    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Nov 2023 11:04:46 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Nov 2023 11:04:46 -0500    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/CAB7nPqT1c9WrUw4+eSGF_-ru7ERBOC50a4r3tS1s-yT4OaYsLg@mail.gmail.com  
  
Author: Michael Paquier  
  
Backpatch-through: master  

M src/bin/pg_test_fsync/pg_test_fsync.c

C comment: clarify that WAL files can be _recycled_ or removed

commit   : 8d981341a552e31244f2e9992e143b56bf0292fc    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Nov 2023 10:48:18 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Nov 2023 10:48:18 -0500    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/CAB7nPqSDdF0heotQU3gsepgqx+9c+6KjLd3R6aNYH7KKfDd2ig@mail.gmail.com  
  
Author: Michael Paquier  
  
Backpatch-through: master  

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

Use SECS_PER_HOUR macro in tzparser.c, instead of constants

commit   : 79588d3c8d08b8653dfc523d6ae5168652c6ff8a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 22:36:23 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 22:36:23 -0500    

Click here for diff

Reported-by: CharSyam  
  
Discussion: https://postgr.es/m/CAMrLSE5j_aWfoBDMrSvk14oBKSy+-2cjzNNH_FciirA7Kwo9TA@mail.gmail.com  
  
Author: CharSyam  
  
Backpatch-through: master  

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

doc: gin_page_opaque_info() must be a _compressed_ GIN page

commit   : 9890a855ae82d2185c6dcd98f0071a0c889cacc3    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 22:02:07 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 22:02:07 -0500    

Click here for diff

Reported-by: Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1xvzQxTAiYNM2PWJ6snMTPh3u3Ammbwss7mvAShS2Ohww@mail.gmail.com  
  
Author: Jeff Janes  
  
Backpatch-through: master  

M doc/src/sgml/pageinspect.sgml

doc: improve ALTER TABLE "offical constraint" wording

commit   : 712dc2338b23196edd94619f43f24d23139cc0a9    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 20:07:14 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 20:07:14 -0500    

Click here for diff

Reported-by: Josh Kupershmidt  
  
Discussion: https://postgr.es/m/CAK3UJRF=KY_nx_TRQq+t6jOrtS2rry79ktkzPiMDhFx_K=dZAg@mail.gmail.com  
  
Author: Josh Kupershmidt  
  
Backpatch-through: master  

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

Doc: un-break PDF build.

commit   : 798394c6ccdada517c3508047a865d9994bfe25f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2023 20:02:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2023 20:02:53 -0500    

Click here for diff

Oversight in 5c4c7efad: gotta adjust the cell height for removal of  
an entry.  Per buildfarm.  

M doc/src/sgml/gin.sgml

gitignore generated file targets-meson.sgml.

commit   : 1a0796b9279b1cbbb3d1ede9b06d930d49e57a6c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2023 19:51:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2023 19:51:03 -0500    

Click here for diff

Oversight in 07cb29737.  

M doc/src/sgml/.gitignore

modify segno. for pg_walfile_name() and pg_walfile_name_offset()

commit   : 344afc77690b4cef2605420d67c1d1ceb28760cc    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 19:44:09 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 19:44:09 -0500    

Click here for diff

Previously these functions returned the previous segment number if the  
LSN was on a segment boundary.  We now always return the current segment  
number for an LSN.  
  
Docs updated to reflect this change.  Regression tests added, author  
Andres Freund.  
  
Also mentioned in thread https://postgr.es/m/flat/20220204225057.GA1535307%40nathanxps13#d964275c9540d8395e138efc0a75f7e8  
  
BACKWARD INCOMPATIBILITY  
  
Reported-by: Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Kyotaro Horiguchi  
  
Backpatch-through: master  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

doc: remove documentation for deprecated @@@ operator

commit   : 5c4c7efaddd4ddd70176dadf3097efcacf811adf    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 18:01:56 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 18:01:56 -0500    

Click here for diff

Reported-by: Kyotaro HORIGUCHI  
  
Discussion: https://postgr.es/m/CAF4Au4wmUsZRVhR+ySpvabRfB_1D1fnrPY9TRAKO2DEbi4Cpgg@mail.gmail.com  
  
Co-authored-by: Oleg Bartunov  
  
Backpatch-through: master  

M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml

doc: mention vacuum's removal of commit timestamp information

commit   : 49d7e713d93033f6b8c8b37e8bb2a8362c2dec52    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 17:56:28 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 17:56:28 -0500    

Click here for diff

Reported-by: Kyotaro HORIGUCHI  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Kyotaro HORIGUCHI  
  
Backpatch-through: 16  

M doc/src/sgml/func.sgml

Fix whitespace.

commit   : 6631363a5992a81d7bbcecaba68886564ad701ba    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 25 Nov 2023 10:39:32 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 25 Nov 2023 10:39:32 +1300    

Click here for diff

Use tabs instead of spaces for new paragraph, like existing paragraphs.  

M src/port/pqsignal.c

Improve comments about pqsignal().

commit   : 262454be9a62d69d7523c0c88c7d07d5971a0fa0    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 25 Nov 2023 09:41:33 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 25 Nov 2023 09:41:33 +1300    

Click here for diff

Explain where pqsignal() came from, what problem it originally solved  
without assuming the reader is familiar with historical Unixen, why we  
still need it, what it does for us now, and the key differences in  
frontend code on Windows.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BRst1h3uo%2BXRgdRVnWHBa4mmj5gFbmCzZr73s-Fh_5JA%40mail.gmail.com  

M src/port/pqsignal.c

doc: add docs for age(xid) and mxid_age(xid)

commit   : 48b5aa31437a161356fb8ec820b81b7b67cf04c2    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 14:36:00 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Nov 2023 14:36:00 -0500    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f_OQpz7rpe-KJmskVxbU06buiXbfonxG3JLB+nGCJ5E=g@mail.gmail.com  
  
Backpatch-through: 16  

M doc/src/sgml/func.sgml

Fix timing-dependent failure in GSSAPI data transmission.

commit   : d053a879bb360fb72c46de2a013e741d3f7c9e8d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Nov 2023 13:30:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Nov 2023 13:30:18 -0500    

Click here for diff

When using GSSAPI encryption in non-blocking mode, libpq sometimes  
failed with "GSSAPI caller failed to retransmit all data needing  
to be retried".  The cause is that pqPutMsgEnd rounds its transmit  
request down to an even multiple of 8K, and sometimes that can lead  
to not requesting a write of data that was requested to be written  
(but reported as not written) earlier.  That can upset pg_GSS_write's  
logic for dealing with not-yet-written data, since it's possible  
the data in question had already been incorporated into an encrypted  
packet that we weren't able to send during the previous call.  
  
We could fix this with a one-or-two-line hack to disable pqPutMsgEnd's  
round-down behavior, but that seems like making the caller work around  
a behavior that pg_GSS_write shouldn't expose in this way.  Instead,  
adjust pg_GSS_write to never report a partial write: it either  
reports a complete write, or reflects the failure of the lower-level  
pqsecure_raw_write call.  The requirement still exists for the caller  
to present at least as much data as on the previous call, but with  
the caller-visible write start point not moving there is no temptation  
for it to present less.  We lose some ability to reclaim buffer space  
early, but I doubt that that will make much difference in practice.  
  
This also gets rid of a rather dubious assumption that "any  
interesting failure condition (from pqsecure_raw_write) will recur  
on the next try".  We've not seen failure reports traceable to that,  
but I've never trusted it particularly and am glad to remove it.  
  
Make the same adjustments to the equivalent backend routine  
be_gssapi_write().  It is probable that there's no bug on the backend  
side, since we don't have a notion of nonblock mode there; but we  
should keep the logic the same to ease future maintenance.  
  
Per bug #18210 from Lars Kanis.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h

Use ResourceOwner to track WaitEventSets.

commit   : 50c67c2019ab9ade8aa8768bfe604cd802fe8591    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Nov 2023 13:31:36 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Nov 2023 13:31:36 +0200    

Click here for diff

A WaitEventSet holds file descriptors or event handles (on Windows).  
If FreeWaitEventSet is not called, those fds or handles are leaked.  
Use ResourceOwners to track WaitEventSets, to clean those up  
automatically on error.  
  
This was a live bug in async Append nodes, if a FDW's  
ForeignAsyncRequest function failed. (In back branches, I will apply a  
more localized fix for that based on PG_TRY-PG_FINALLY.)  
  
The added test doesn't check for leaking resources, so it passed even  
before this commit. But at least it covers the code path.  
  
In the passing, fix misleading comment on what the 'nevents' argument  
to WaitEventSetWait means.  
  
Report by Alexander Lakhin, analysis and suggestion for the fix by  
Tom Lane. Fixes bug #17828.  
  
Reviewed-by: Alexander Lakhin, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/nodeAppend.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/storage/ipc/latch.c
M src/include/storage/latch.h
M src/include/utils/resowner.h

C comment: fix typos with unnecessary apostrophes

commit   : 414e75540f058b23377219586abb3008507f7099    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Nov 2023 23:41:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Nov 2023 23:41:15 -0500    

Click here for diff

Reported-by: Vinayak Pokale  
  
Discussion: https://postgr.es/m/CAEySZvh7gPTOqMhuKOBXEt=qF_1BCvFQB4MAJ4yaTPJHxgX_zw@mail.gmail.com  
  
Author: Vinayak Pokale  
  
Backpatch-through: master  

M src/backend/commands/sequence.c

doc: remove double-negative in REFRESH MATERIALIZED ... CONCURR

commit   : 1db5300015a778f51a26a8a0614fe7fcb6323c17    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Nov 2023 16:40:10 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Nov 2023 16:40:10 -0500    

Click here for diff

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

M doc/src/sgml/ref/refresh_materialized_view.sgml

Fix the initial sync tables with no columns.

commit   : eeb0ebad79d9350305d9e111fbac76e20fa4b2fe    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Nov 2023 11:44:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Nov 2023 11:44:14 +0530    

Click here for diff

The copy command formed for initial sync was using parenthesis for tables  
with no columns leading to syntax error. This patch avoids adding  
parenthesis for such tables.  
  
Reported-by: Justin G  
Author: Vignesh C  
Reviewed-by: Peter Smith, Amit Kapila  
Backpatch-through: 15  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/001_rep_changes.pl

Stop the search once the slot for replication origin is found.

commit   : ff68cc6f3bf08546802216e0b9d28ad1d4be7e70    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Nov 2023 08:39:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Nov 2023 08:39:24 +0530    

Click here for diff

In replorigin_session_setup(), we were needlessly looping for  
max_replication_slots even after finding an existing slot for the origin.  
This shouldn't hurt us much except for probably large values of  
max_replication_slots.  
  
Author: Antonin Houska  
Discussion: http://postgr.es/m/2694.1700471273@antos  

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

doc: FreeBSD uses camcontrol identify, not atacontrol, for cache

commit   : cf359a053524210099c413099f36004c62ebcee0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 Nov 2023 20:09:20 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 Nov 2023 20:09:20 -0500    

Click here for diff

This is for IDE drive cache control, same as SCSI (already documented  
properly).  
  
Reported-by: John Ekins  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: John Ekins  
  
Backpatch-through: 12  

M doc/src/sgml/wal.sgml

Fix query checking consistency of table amhandlers in opr_sanity.sql

commit   : 2f30226624b0645913ea832c15b10b0de43bc7c4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Nov 2023 09:32:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Nov 2023 09:32:06 +0900    

Click here for diff

As written, the query checked for an access method of type 's', which is  
not an AM type supported in the core code.  
  
Error introduced by 8586bf7ed888.  As this query is not checking what it  
should, backpatch all the way down.  
  
Reviewed-by: Aleksander Alekseev  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

doc: vacuum_cost_limit controls when vacuum_cost_delay happens

commit   : 3af101ce8be8eeb0e8adc61e293b5d12989f68be    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 Nov 2023 15:32:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 Nov 2023 15:32:04 -0500    

Click here for diff

Mention this relationship.  
  
Reported-by: Martín Marqués  
  
Discussion: https://postgr.es/m/CABeG9LtsAVP4waKngUYo-HAiiowcb8xEjQvDDfhX_nFi5SJ4jw@mail.gmail.com  
  
Author: Martín Marqués  
  
Backpatch-through: master  

M doc/src/sgml/config.sgml

Remove unneeded assignments in for loop header

commit   : afc3b0143c89405540461f306137ab6a9671c3bb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Nov 2023 16:10:27 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Nov 2023 16:10:27 +0100    

Click here for diff

The last use of this variable in the loop body was removed by commit  
93df658a0189.  

M src/fe_utils/print.c

Avoid overflow in fe_utils' printTable()

commit   : 24ea53dcfab7fe463c0cf56095e9fe5d23cdb748    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Nov 2023 14:55:29 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Nov 2023 14:55:29 +0100    

Click here for diff

The original code would miscalculate the total number of cells when the  
table to print has more than ~4 billion cells, leading to an unnecessary  
error.  Repair by changing some computations to be 64-bits wide.  Add  
some necessary overflow checks.  
  
Author: Hongxu Ma <[email protected]>  
Discussion: https://postgr.es/m/TYBP286MB0351B057B101C90D7C1239E6B4E2A@TYBP286MB0351.JPNP286.PROD.OUTLOOK.COM  

M src/fe_utils/print.c
M src/include/fe_utils/print.h

Simplify some logic in CreateReplicationSlot()

commit   : e83aa9f92fdd88c2912cc43a61fd9f59f4c8f4d3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Nov 2023 13:55:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Nov 2023 13:55:01 +0900    

Click here for diff

This refactoring reduces the code in charge of creating replication  
slots from two "if" block to a single one, making it slightly cleaner.  
  
This change is possible since 1d04a59be31b, that has removed the  
intermediate code that existed between the two "if" blocks in charge of  
initializing the output message buffer.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PtnJzqKT41Zt8pChRzba=QgCqjtfYvcf84NMj3VFJoKfw@mail.gmail.com  

M src/backend/replication/walsender.c

Log messages for replication slot acquisition and release.

commit   : 7c3fb505b14e86581b6a052075a294c78c91b123    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 21 Nov 2023 07:59:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 21 Nov 2023 07:59:53 +0530    

Click here for diff

This commit log messages (at LOG level when log_replication_commands is  
set, otherwise at DEBUG1 level) when walsenders acquire and release  
replication slots. These messages help to know the lifetime of a  
replication slot - one can know how long a streaming standby, logical  
subscriber, or replication slot consumer is down. These messages will be  
useful on production servers to debug and analyze inactive replication  
slots.  
  
Note that these messages are emitted only for walsenders but not for  
backends. This is because walsenders are the ones that typically hold  
replication slots for longer durations, unlike backends which hold them  
for executing replication related functions.  
  
Author: Bharath Rupireddy  
Reviewed-by: Peter Smith, Amit Kapila, Alvaro Herrera  
Discussion: http://postgr.es/m/CALj2ACX17G7F-jeLt+7KhJ6YxVeRwR8Zk0rDh4VnT546o0UpTQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/replication/slot.c

meson: Document build targets, add 'help' target

commit   : 07cb29737a4ea9bd28e436eecb4016c3202e3928    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    

Click here for diff

Currently important build targets are somewhat hard to discover. This commit  
documents important meson build targets in the sgml documentation. But it's  
awkward to have to lookup build targets in the docs when hacking, so this also  
adds a 'help' target, printing out the same information. To avoid having to  
duplicate information in two places, generate both docbook and interactive  
docs from a single source.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/generate-targets-meson.pl
M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
A doc/src/sgml/targets-meson.txt
M meson.build

meson: Add 'world' target

commit   : 6614cfb43c8281feef5c4563ddc36ab04914014e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    

Click here for diff

We have this for make as well.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

docs: meson: Change what 'docs' target builds

commit   : 9e5b2a091fd0d672b7b2ff8afcfc9e9a6e9a5ac8    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    

Click here for diff

This undoes the change in what the 'docs' target builds 969509c3f2e. Tom was  
concerned with having a target to just build the html docs, which a prior  
commit now provided explicitly.  
  
A subsequent commit will overhaul the documentation for the documentation  
targets.  
  
While at it, move all target in doc/src/sgml/Makefile up to just after the  
default "html" target, and add a comment explaining "all" is *not* the default  
target.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M doc/src/sgml/meson.build

meson: docs: Add {html,man} targets, rename install-doc-*

commit   : ddcab2a0329511e8872b62f2c77e5fa33547c277    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Nov 2023 17:46:40 -0800    

Click here for diff

We have toplevel html, man targets in the autoconf build as well. It'd be odd  
to have an 'html' target but have the install target be 'install-doc-html',  
thus rename the install targets to match.  
  
Reviewed-by: Christoph Berg <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/meson.build

Optimize check_search_path() by using SearchPathCache.

commit   : ad57c2a7c58665c14236a999435d37ba59eb7fc4    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 20 Nov 2023 15:53:42 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 20 Nov 2023 15:53:42 -0800    

Click here for diff

A hash lookup is faster than re-validating the string, particularly  
because we use SplitIdentifierString() for validation.  
  
Important when search_path changes frequently.  
  
Discussion: https://postgr.es/m/04c8592dbd694e4114a3ed87139a7a04e4363030.camel%40j-davis.com  

M src/backend/catalog/namespace.c

Be more paranoid about OOM in search_path cache.

commit   : 8efa301532c8c93938e04451a74754c91b0b760d    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 20 Nov 2023 15:21:30 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 20 Nov 2023 15:21:30 -0800    

Click here for diff

Recent commit f26c2368dc introduced a search_path cache, but left some  
potential out-of-memory hazards. Simplify the code and make it safer  
against OOM.  
  
This change reintroduces one list_copy(), losing a small amount of the  
performance gained in f26c2368dc. A future change may optimize away  
the list_copy() again if it can be done in a safer way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c

Prevent overflow for block number in buffile.c

commit   : 3650e7a3933166b40f7f9043bd91f45d3467c74d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 20 Nov 2023 09:14:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 20 Nov 2023 09:14:53 +0900    

Click here for diff

As coded, the start block calculated by BufFileAppend() would overflow  
once more than 16k files are used with a default block size.  This issue  
existed before b1e5c9fa9ac4, but there's no reason not to be clean about  
it.  
  
Per report from Coverity, with a fix suggested by Tom Lane.  

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

Lock table in DROP STATISTICS

commit   : 28f84f72fbafe3bef675d3a176eb53177f4a9433    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 19 Nov 2023 21:03:29 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 19 Nov 2023 21:03:29 +0100    

Click here for diff

The DROP STATISTICS code failed to properly lock the table, leading to  
  
  ERROR:  tuple concurrently deleted  
  
when executed concurrently with ANALYZE.  
  
Fixed by modifying RemoveStatisticsById() to acquire the same lock as  
ANALYZE. This function is called only by DROP STATISTICS, as ANALYZE  
calls RemoveStatisticsDataById() directly.  
  
Reported by Justin Pryzby, fix by me. Backpatch through 12. The code was  
like this since it was introduced in 10, but older releases are EOL.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Tom Lane  
Backpatch-through: 12  
  
Discussion: https://postgr.es/m/ZUuk-8CfbYeq6g_u@pryzbyj2023  

M src/backend/commands/statscmds.c

Guard against overflow in interval_mul() and interval_div().

commit   : b218fbb7a35fcf31539bfad12732038fe082a2eb    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 18 Nov 2023 14:41:20 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 18 Nov 2023 14:41:20 +0000    

Click here for diff

Commits 146604ec43 and a898b409f6 added overflow checks to  
interval_mul(), but not to interval_div(), which contains almost  
identical code, and so is susceptible to the same kinds of  
overflows. In addition, those checks did not catch all possible  
overflow conditions.  
  
Add additional checks to the "cascade down" code in interval_mul(),  
and copy all the overflow checks over to the corresponding code in  
interval_div(), so that they both generate "interval out of range"  
errors, rather than returning bogus results.  
  
Given that these errors are relatively easy to hit, back-patch to all  
supported branches.  
  
Per bug #18200 from Alexander Lakhin, and subsequent investigation.  
  
Discussion: https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org  

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

doc: improve description of privileges for MERGE and update glossary.

commit   : 4bc8f29088f8a2e9c89e6c0819337c4c8bf5f20a    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 18 Nov 2023 12:41:23 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 18 Nov 2023 12:41:23 +0000    

Click here for diff

On the MERGE page, the description of the privileges required could be  
taken to imply that the SELECT privilege is required on all columns of  
the data source, whereas actually it is only required on the columns  
referred to by conditions or expressions in the MERGE command. Re-word  
it to make that a little clearer, and mention expressions as well as  
conditions.  
  
Also, add a glossary entry for MERGE, and nearby on the glossary page,  
mention MERGE in the list of commands that cannot update a  
materialized view.  
  
Noted by Jian He. Patch by me, reviewed by Jian He.  
  
Discussion: https://postgr.es/m/CACJufxHuSoRXKwr0MtSFLXuT2nFVWcVfEWhxg7qdP9h%2Bs3a%2BUw%40mail.gmail.com  

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

meson: Fix missing dependency from install-quiet to sepgsql.sql

commit   : 823eb3db1c50a6b8a89ebedc1db96b14de140183    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 16:29:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 16:29:48 -0800    

Click here for diff

This could lead to an error like  
  
ERROR: File 'contrib/sepgsql/sepgsql.sql' could not be found  
  
Backpatch: 16-, where meson was added  

M contrib/sepgsql/meson.build

simplehash: preserve consistency in case of OOM.

commit   : b282fa88df78a05643d2df84a2b8e81cd9c1705d    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 17 Nov 2023 13:58:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 17 Nov 2023 13:58:16 -0800    

Click here for diff

Compute size first, then allocate, then update the structure.  
  
Previously, an out-of-memory when growing could leave the hashtable in  
an inconsistent state.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Andres Freund  
Reviewed-by: Gurjeet Singh  

M src/include/lib/simplehash.h

docs: Fix standalone INSTALL, broken in 06c70849fb2

commit   : a268a51de692c462e641a58ac842bbb0ac1e43ea    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 13:35:17 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 13:35:17 -0800    

Click here for diff

We should probably check that INSTALL can be generated in CI.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

doc: update query section to show LIMIT/OFFSET like SELECT

commit   : 8127e6e8ada675f5212e8ffac8cfb9ebaa0fe845    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 17 Nov 2023 16:46:43 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 17 Nov 2023 16:46:43 -0500    

Click here for diff

The parameter names were slightly better in SELECT, so make them match.  
  
Reported-by: Euler Taveira  
  
Discussion: https://postgr.es/m/CAHE3wgh-EYuAbLG1VS3QTHii1TgWS31h-fYEgrdda7oTOuskOQ@mail.gmail.com  
  
Backpatch-through: master  

M doc/src/sgml/queries.sgml

Release lock on heap buffer before vacuuming FSM

commit   : b2e237afddc56a4826121169a693412d8683d940    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 11:02:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 11:02:52 -0800    

Click here for diff

When there are no indexes on a table, we vacuum each heap block after  
pruning it and then update the freespace map. Periodically, we also  
vacuum the freespace map. This was done while unnecessarily holding a  
lock on the heap page. Release the lock before calling  
FreeSpaceMapVacuumRange() and, while we're at it, ensure the range  
includes the heap block we just vacuumed.  
  
There are no known deadlocks or other similar issues, therefore don't  
backpatch. It's certainly not good to do all this work under a lock, but it's  
not frequently reached, making it not worth the risk of backpatching.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_YiL%3D44GvGnt1dpYouDSSoV7wzxVoXs8m3p311rp-TVQQ%40mail.gmail.com  

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

Extract column statistics from CTE references, if possible.

commit   : f7816aec23eed1dc1da5f9a53cb6507d30b7f0a2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2023 14:36:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2023 14:36:23 -0500    

Click here for diff

examine_simple_variable() left this as an unimplemented case years  
ago, with the result that plans for queries involving un-flattened  
CTEs might be much stupider than necessary.  It's not hard to extend  
the existing logic for RTE_SUBQUERY cases to also be able to drill  
down into CTEs, so let's do that.  
  
There was some discussion of whether this patch breaks the idea  
of a MATERIALIZED CTE being an optimization fence.  We concluded  
it's okay, because we already allow the outer planner level to  
see the estimated width and rowcount of the CTE result, and  
letting it see column statistics too seems fairly equivalent.  
Basically, what we expect of the optimization fence is that the  
outer query should not affect the plan chosen for the CTE query.  
Once that plan is chosen, it's okay for the outer planner level  
to make use of whatever information we have about it.  
  
Jian Guo and Tom Lane, per complaint from Hans Buschmann  
  
Discussion: https://postgr.es/m/[email protected]  

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

docs: Document --with-selinux/-Dselinux options centrally

commit   : 06c70849fb26ac431a722b1d10cffe1c65e728a4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 10:23:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 10:23:02 -0800    

Click here for diff

Previously --with-selinux was documented only in the in the sepgsql  
documentation and there was no corresponding documentation for meson. There  
are further improvements that could be made, but this change seems worthwhile  
even on its own.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/sepgsql.sgml

meson: Change default of 'selinux' feature option to auto

commit   : c04f3de3dca3b54e16d7774885c8b64f90ca259b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 10:23:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Nov 2023 10:23:02 -0800    

Click here for diff

There is really no reason for selinux to behave differently than other  
options.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson_options.txt

Allow tests to pass in OpenSSL FIPS mode (rest)

commit   : 3c44e7d8d4fe3381736c4b4daff4be5ff3d1466e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    

Click here for diff

This adds alternative expected files for various tests.  
  
In src/test/regress/sql/password.sql, we make a small change to the  
test so that the CREATE ROLE still succeeds even if the ALTER ROLE  
that attempts to set a password might fail.  That way, the roles are  
available for the rest of the test file in either case.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/dbbd927f-ef1f-c9a1-4ec6-c759778ac852%40enterprisedb.com  

A contrib/passwordcheck/expected/passwordcheck_1.out
A contrib/uuid-ossp/expected/uuid_ossp_1.out
A src/test/regress/expected/md5_1.out
M src/test/regress/expected/password.out
A src/test/regress/expected/password_1.out
M src/test/regress/sql/password.sql

Don't specify number of dimensions in cases where we don't know it.

commit   : 8d5573b92e66075c20f327d93d46a24095739a58    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2023 11:29:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2023 11:29:42 -0500    

Click here for diff

A few places in array_in() and plperl would report a misleading value  
(always MAXDIM+1) for the number of dimensions in the input, because  
we'd error out as soon as that was clearly too large rather than  
scanning the entire input.  There doesn't seem to be much value in  
offering the true number, at least not enough to justify the extra  
complication involved in trying to get it.  So just remove that  
parenthetical remark.  We already have other places that do it  
like that, anyway.  
  
Per suggestions from Alexander Lakhin and Heikki Linnakangas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/arrayfuncs.c
M src/pl/plperl/expected/plperl_array.out
M src/pl/plperl/plperl.c

Allow tests to pass in OpenSSL FIPS mode (TAP tests)

commit   : 284cbaea7c4b89ce8685a148baeaf1d7896a900e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    

Click here for diff

Some tests using md5 authentication have to be skipped.  In other  
cases, we can rewrite the tests to use a different authentication  
method.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/dbbd927f-ef1f-c9a1-4ec6-c759778ac852%40enterprisedb.com  

M src/test/authentication/t/001_password.pl
M src/test/ssl/t/002_scram.pl

pgcrypto: Allow tests to pass in OpenSSL FIPS mode

commit   : 795592865c96b58016a883ac6390c985f140918d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Nov 2023 14:40:13 +0100    

Click here for diff

This adds several alternative expected files for when MD5 and 3DES are  
not available.  This is similar to the alternative expected files for  
when the legacy provider is disabled.  In fact, running the pgcrypto  
tests in FIPS mode makes use of some of these existing alternative  
expected files as well (e.g., for blowfish).  
  
These new expected files currently cover the FIPS mode provided by  
OpenSSL 3.x as well as the modified OpenSSL 3.x from Red Hat (e.g.,  
Fedora 38), but not the modified OpenSSL 1.x from Red Hat (e.g.,  
Fedora 35).  (The latter will have some error message wording  
differences.)  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/dbbd927f-ef1f-c9a1-4ec6-c759778ac852%40enterprisedb.com  

A contrib/pgcrypto/expected/3des_1.out
A contrib/pgcrypto/expected/crypt-md5_1.out
A contrib/pgcrypto/expected/hmac-md5_1.out
A contrib/pgcrypto/expected/md5_1.out
A contrib/pgcrypto/expected/pgp-encrypt-md5_1.out

Change logtape/tuplestore code to use int64 for block numbers

commit   : b1e5c9fa9ac4399895bf312398c5d441baba0c3b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Nov 2023 11:20:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Nov 2023 11:20:53 +0900    

Click here for diff

The code previously relied on "long" as type to track block numbers,  
which would be 4 bytes in all Windows builds or any 32-bit builds.  This  
limited the code to be able to handle up to 16TB of data with the  
default block size of 8kB, like during a CLUSTER.  This code now relies  
on a more portable int64, which should be more than enough for at least  
the next 20 years to come.  
  
This issue has been reported back in 2017, but nothing was done about it  
back then, so here we go now.  
  
Reported-by: Peter Geoghegan  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAH2-WznCscXnWmnj=STC0aSa7QG+BRedDnZsP=Jo_R9GUZvUrg@mail.gmail.com  

M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/include/storage/buffile.h
M src/include/utils/logtape.h

Remove NOT_USED BufFileTellBlock() from buffile.c

commit   : c99c7a4871187a8bcf717147ff08e05a49e678d5    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Nov 2023 10:46:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Nov 2023 10:46:50 +0900    

Click here for diff

This routine has been marked as NOT_USED since 20ad43b576d9 from 2000,  
and a patch is planned to switch the logtape/tuplestore APIs to rely on  
int64 rather than long for the block nunbers, which is more portable.  
  
Keeping it is more confusing than anything at this stage, so let's get  
rid of it entirely.  
  
Thanks for Heikki Linnakangas for the poke on this one.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgcrypto: Split off pgp-encrypt-md5 test

commit   : 3af0d17acef7538c5605afa5dd7929cfd7e38d9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2023 15:57:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2023 15:57:21 +0100    

Click here for diff

In FIPS mode, these tests will fail.  By having them in a separate  
file, it would make it easier to have an alternative output file or  
selectively disable these tests.  This isn't done here; this is just  
some preparation.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pgcrypto/Makefile
A contrib/pgcrypto/expected/pgp-encrypt-md5.out
M contrib/pgcrypto/expected/pgp-encrypt.out
M contrib/pgcrypto/meson.build
A contrib/pgcrypto/sql/pgp-encrypt-md5.sql
M contrib/pgcrypto/sql/pgp-encrypt.sql

Ensure we preprocess expressions before checking their volatility.

commit   : 743ddafc7124604c1f59b5d9f661be47a987a8d0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2023 10:05:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2023 10:05:14 -0500    

Click here for diff

contain_mutable_functions and contain_volatile_functions give  
reliable answers only after expression preprocessing (specifically  
eval_const_expressions).  Some places understand this, but some did  
not get the memo --- which is not entirely their fault, because the  
problem is documented only in places far away from those functions.  
Introduce wrapper functions that allow doing the right thing easily,  
and add commentary in hopes of preventing future mistakes from  
copy-and-paste of code that's only conditionally safe.  
  
Two actual bugs of this ilk are fixed here.  We failed to preprocess  
column GENERATED expressions before checking mutability, so that the  
code could fail to detect the use of a volatile function  
default-argument expression, or it could reject a polymorphic function  
that is actually immutable on the datatype of interest.  Likewise,  
column DEFAULT expressions weren't preprocessed before determining if  
it's safe to apply the attmissingval mechanism.  A false negative  
would just result in an unnecessary table rewrite, but a false  
positive could allow the attmissingval mechanism to be used in a case  
where it should not be, resulting in unexpected initial values in a  
new column.  
  
In passing, re-order the steps in ComputePartitionAttrs so that its  
checks for invalid column references are done before applying  
expression_planner, rather than after.  The previous coding would  
not complain if a partition expression contains a disallowed column  
reference that gets optimized away by constant folding, which seems  
to me to be a behavior we do not want.  
  
Per bug #18097 from Jim Keener.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/copyfrom.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/clauses.c
M src/include/optimizer/optimizer.h
M src/test/regress/expected/fast_default.out
M src/test/regress/expected/generated.out
M src/test/regress/sql/fast_default.sql
M src/test/regress/sql/generated.sql

Explicitly skip TAP tests under Meson if disabled

commit   : bc15a126bbab99aa12fe7138131c12d3674e2c94    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2023 08:06:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2023 08:06:12 +0100    

Click here for diff

If the tap_tests option is disabled under Meson, the TAP tests are  
currently not registered at all.  But this makes it harder to see what  
is going on, why suddently there are fewer tests than before.  
  
Instead, run testwrap with an option that marks the test as skipped.  
That way, the total list and count of tests is constant whether the  
option is enabled or not.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M meson.build
M src/tools/testwrap

Add target "slru" to pg_stat_reset_shared()

commit   : 2e8a0edc2a3321582d5da65690b0371654c7a44f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Nov 2023 15:41:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Nov 2023 15:41:34 +0900    

Click here for diff

Currently, pg_stat_reset_shared() cannot reset the counters in the view  
pg_stat_slru even if it is a type of shared stats.  This patch adds  
support for a new value in pg_stat_reset_shared(), called "slru", able  
to do that.  Note that pg_stat_reset_shared(NULL) also resets SLRU  
counters.  
  
There may be a point in removing pg_stat_reset_slru() that was  
introduced in 28cac71bd368 (v13~) as the new option overlaps with this  
function, but we would lose the ability to reset individual SLRU  
counters.  This is left for future reconsideration.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Add some completion support for CREATE TABLE .. AS

commit   : 816f10564a8671918e170a547625584d10587cf4    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Nov 2023 09:44:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Nov 2023 09:44:29 +0900    

Click here for diff

"AS" is added as a suggested keyword for CREATE TABLE for a few query  
patterns, including the case where a list of columns is given in  
parenthesis.  
  
More queries can be now completed with the keywords supported for  
queries in a CTAS, after:  
CREATE TABLE [TEMP|TEMPORARY|UNLOGGED] <name> [ (...) ] AS  
  
Author: Gilles Darold  
Reviewed-by: Jim Jones  
Discussion: https://postgr.es/m/[email protected]  

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

Fix fallback implementation for pg_atomic_test_set_flag().

commit   : 69c32b8b3535f7f367cca90a09d9557d575b270c    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 15 Nov 2023 15:04:18 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 15 Nov 2023 15:04:18 -0600    

Click here for diff

The fallback implementation of pg_atomic_test_set_flag() that uses  
atomic-exchange gives pg_atomic_exchange_u32_impl() an extra  
argument.  This issue has been present since the introduction of  
the atomics API in commit b64d92f1a5.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/20231114035439.GA1809032%40nathanxps13  
Backpatch-through: 12  

M src/include/port/atomics/generic.h

Retire MemoryContextResetAndDeleteChildren() macro.

commit   : 6a72c42fd5af7ada49584694f543eb06dddb4a87    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 15 Nov 2023 13:42:30 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 15 Nov 2023 13:42:30 -0600    

Click here for diff

As of commit eaa5808e8e, MemoryContextResetAndDeleteChildren() is  
just a backwards compatibility macro for MemoryContextReset().  Now  
that some time has passed, this macro seems more likely to create  
confusion.  
  
This commit removes the macro and replaces all remaining uses with  
calls to MemoryContextReset().  Any third-party code that use this  
macro will need to be adjusted to call MemoryContextReset()  
instead.  Since the two have behaved the same way since v9.5, such  
adjustments won't produce any behavior changes for all  
currently-supported versions of PostgreSQL.  
  
Reviewed-by: Amul Sul, Tom Lane, Alvaro Herrera, Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/20231113185950.GA1668018%40nathanxps13  

M src/backend/access/brin/brin.c
M src/backend/access/gin/ginscan.c
M src/backend/access/transam/xact.c
M src/backend/commands/analyze.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/worker.c
M src/backend/statistics/extended_stats.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/error/elog.c
M src/include/utils/memutils.h

src/test/modules/test_dsa needs a .gitignore file.

commit   : 83267b15bf0dffa6e1096608bda95b8488048bb9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Nov 2023 13:59:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Nov 2023 13:59:54 -0500    

Click here for diff

Without this, "git status" is unhappy after a check-world run.  
Oversight in 325f54033.  

A src/test/modules/test_dsa/.gitignore

doc: align column order with pg_stat_statements view

commit   : 83b4326e6098a057d3931619e387d59844e70aed    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Nov 2023 14:07:00 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Nov 2023 14:07:00 +0100    

Click here for diff

Commit 5a3423ad8e mistakenly didn't plac the new columns for JIT  
deform counters at the end to match their placement in the view.  
Fix by placing the new columns last to be consistent.  
  
Author: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/fuhxmigipmodhq3bah5iddd2ksfinrva75wqjyg2g2e647p4v7@yev2gynrnr5f  

M doc/src/sgml/pgstatstatements.sgml

Clear CurrentResourceOwner earlier in CommitTransaction.

commit   : c21e6e2fd48cdcfe7d01eed243d576c722ef8de5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:35 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:35 +0100    

Click here for diff

Alexander reported a crash with repeated create + drop database, after  
the ResourceOwner rewrite (commit b8bff07daa). That was fixed by the  
previous commit, but it nevertheless seems like a good idea clear  
CurrentResourceOwner earlier, because you're not supposed to use it  
for anything after we start releasing it.  
  
Reviewed-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/11b70743-c5f3-3910-8e5b-dd6c115ff829%40gmail.com  

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

Add test_dsa module.

commit   : 325f54033e59499cfc087932f68eec5356061640    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:31 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:31 +0100    

Click here for diff

This covers basic calls within a single backend process, and also  
calling dsa_allocate() or dsa_get_address() while in a different  
resource owners. The latter case was fixed by the previous commit.  
  
Discussion: https://www.postgresql.org/message-id/11b70743-c5f3-3910-8e5b-dd6c115ff829%40gmail.com  

M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_dsa/Makefile
A src/test/modules/test_dsa/expected/test_dsa.out
A src/test/modules/test_dsa/meson.build
A src/test/modules/test_dsa/sql/test_dsa.sql
A src/test/modules/test_dsa/test_dsa–1.0.sql
A src/test/modules/test_dsa/test_dsa.c
A src/test/modules/test_dsa/test_dsa.control

Fix dsa.c with different resource owners.

commit   : a8b330ffb6f71db8ef306a7110dade6ca64cf773    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:28 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Nov 2023 10:34:28 +0100    

Click here for diff

The comments in dsa.c suggested that areas were owned by resource  
owners, but it was not in fact tracked explicitly. The DSM attachments  
held by the dsa were owned by resource owners, but not the area  
itself.  That led to confusion if you used one resource owner to  
attach or create the area, but then switched to a different resource  
owner before allocating or even just accessing the allocations in the  
area with dsa_get_address(). The additional DSM segments associated  
with the area would get owned by a different resource owner than the  
initial segment.  To fix, add an explicit 'resowner' field to  
dsa_area.  It replaces the 'mapping_pinned' flag; resowner == NULL now  
indicates that the mapping is pinned.  
  
This is arguably a bug fix, but I'm not backpatching because it  
doesn't seem to be a live bug in the back branches. In 'master', it is  
a bug because commit b8bff07daa made ResourceOwners more strict so  
that you are no longer allowed to remember new resources in a  
ResourceOwner after you have started to release it. Merely accessing a  
dsa pointer might need to attach a new DSM segment, and before this  
commit it was temporarily remembered in the current owner for a very  
brief period even if the DSA was pinned. And that could happen in  
AtEOXact_PgStat(), which is called after the owner is already released.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Alexander Lakhin, Thomas Munro, Andres Freund  
Discussion: https://www.postgresql.org/message-id/11b70743-c5f3-3910-8e5b-dd6c115ff829%40gmail.com  

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

Add cache for recomputeNamespacePath().

commit   : f26c2368dcaef7519d8400ca958c4b5742cdbd46    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 14 Nov 2023 17:51:03 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 14 Nov 2023 17:51:03 -0800    

Click here for diff

When search_path is changed to something that was previously set, and  
no invalidation happened in between, use the cached list of namespace  
OIDs rather than recomputing them. This avoids syscache lookups and  
ACL checks.  
  
Important when the search_path changes frequently, such as when set in  
proconfig.  
  
An earlier version of this patch was reviewd by Nathan Bossart. This  
version simplifies a few things and is safer in case of OOM.  
  
Discussion: https://www.postgresql.org/message-id/abf4ce8804e0e05dff8c1725ae6a8ed28b7d66e0.camel%40j-davis.com  
Reviewed-by: Nathan Bossart  

M src/backend/catalog/namespace.c

doc: Improve description of targets for pg_stat_reset_shared()

commit   : 7f6bc3b356787e5dbc0d371c9c53cb125c20cd6d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Nov 2023 09:41:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Nov 2023 09:41:10 +0900    

Click here for diff

This commit changes the documentation so as the supported targets are  
documented with itemized list, making it easier to understand the view a  
given target affects.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Change how a base backup decides which files have checksums.

commit   : 025584a168a4b3002e19350bb8db0ebf1fd10235    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Nov 2023 10:51:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Nov 2023 10:51:05 -0500    

Click here for diff

Previously, it thought that any plain file located under global, base,  
or a tablespace directory had checksums unless it was in a short list  
of excluded files. Now, it thinks that files in those directories have  
checksums if parse_filename_for_nontemp_relation says that they are  
relation files. (Temporary relation files don't matter because they're  
excluded from the backup anyway.)  
  
This changes the behavior if you have stray files not managed by  
PostgreSQL in the relevant directories. Previously, you'd get some  
kind of checksum-related complaint if such files existed, assuming  
that the cluster had checksums enabled and that the base backup  
wasn't run with NOVERIFY_CHECKSUMS. Now, you won't get those  
complaints any more. That seems like an improvement to me, because  
those files were presumably not created by PostgreSQL and so there  
is no reason to think that they would be checksummed like a  
PostgreSQL relation file. (If we want to complain about such files,  
we should complain about them existing at all, not just about their  
checksums.)  
  
The point of this change is to make the code more consistent.  
sendDir() was already calling parse_filename_for_nontemp_relation()  
as part of an effort to determine which files to include in the  
backup. So, it already had the information about whether a certain  
file was a relation file. sendFile() then used a separate method,  
embodied in is_checksummed_file(), to make what is essentially  
the same determination. It's better not to make the same decision  
using two different methods, especially in closely-related code.  
  
Patch by me. Reviewed by Dilip Kumar and Álvaro Herrera. Thanks  
also to Jakub Wartak and Peter Eisentraut for comments, suggestions,  
and testing on the larger patch set of which this is a part.  
  
Discussion: http://postgr.es/m/CAFiTN-snhaKkWhi2Gz5i3cZeKefun6sYL==wBoqqnTXxX4_mFA@mail.gmail.com  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/backup/basebackup.c

Support +/- infinity in the interval data type.

commit   : 519fc1bd9e9d7b408903e44f55f83f6db30742b7    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 14 Nov 2023 10:58:49 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 14 Nov 2023 10:58:49 +0000    

Click here for diff

This adds support for infinity to the interval data type, using the  
same input/output representation as the other date/time data types  
that support infinity. This allows various arithmetic operations on  
infinite dates, timestamps and intervals.  
  
The new values are represented by setting all fields of the interval  
to INT32/64_MIN for -infinity, and INT32/64_MAX for +infinity. This  
ensures that they compare as less/greater than all other interval  
values, without the need for any special-case comparison code.  
  
Note that, since those 2 values were formerly accepted as legal finite  
intervals, pg_upgrade and dump/restore from an old database will turn  
them from finite to infinite intervals. That seems OK, since those  
exact values should be extremely rare in practice, and they are  
outside the documented range supported by the interval type, which  
gives us a certain amount of leeway.  
  
Bump catalog version.  
  
Joseph Koshakow, Jian He, and Ashutosh Bapat, reviewed by me.  
  
Discussion: https://postgr.es/m/CAAvxfHea4%2BsPybKK7agDYOMo9N-Z3J6ZXf3BOM79pFsFNcRjwA%40mail.gmail.com  

M contrib/btree_gin/btree_gin.c
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/datatype/timestamp.h
M src/test/regress/expected/brin_multi.out
M src/test/regress/expected/horology.out
M src/test/regress/expected/interval.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/expected/window.out
M src/test/regress/sql/brin_multi.sql
M src/test/regress/sql/horology.sql
M src/test/regress/sql/interval.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql
M src/test/regress/sql/window.sql
M src/tools/pgindent/typedefs.list

doc: Update note about Bison and Flex build requirements

commit   : b41b1a7f490093643ce2080d1cf9323e24423eb8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 11:00:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 11:00:49 +0100    

Click here for diff

Updating the Windows-specific chapter was forgotten by 721856ff24.  

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

Fix capitalization of "Tcl"

commit   : e7814b40d02582238b14d838c2458825d9170178    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 10:44:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 10:44:44 +0100    

Click here for diff

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/xact.sgml
M src/pl/tcl/pltcl.c

Fix whitespace

commit   : 43071777be134bb471f316fea66d928e6c40e37f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 10:41:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 10:41:17 +0100    

Click here for diff

M doc/src/sgml/func.sgml

Replace Gen_dummy_probes.sed with Gen_dummy_probes.pl

commit   : 3849fe7c2ba7758eee5f1f524147a3620b677fb3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 09:47:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Nov 2023 09:47:07 +0100    

Click here for diff

To generate a dummy probes.h file when dtrace is not available, we had  
two different scripts: A sed version, which is the original version,  
and a Perl version, which was generated by s2p.  This split was  
necessary because Perl was not a mandatory build dependency on Unix,  
but sed was not guaranteed to be available on Windows.  
  
(The Meson build system used the sed version even on Windows, which  
was probably incorrect and probably would have had to be fixed before  
elevating that build system from experimental status.)  
  
As of 721856ff24, Perl is a required build dependency, so this split  
is no longer necessary.  We can just use the Perl script in all build  
environments and remove a whole bunch of infrastructure to keep the  
two variants in sync.  
  
The new Gen_dummy_probes.pl is not the version generated by s2p but a  
new implementation written by hand by adapting the sed version to Perl  
syntax.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M .gitattributes
M src/backend/utils/Gen_dummy_probes.pl
D src/backend/utils/Gen_dummy_probes.pl.prolog
D src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Makefile
D src/backend/utils/README.Gen_dummy_probes
M src/include/utils/meson.build
M src/tools/msvc/Solution.pm

Allow new role 'regress_dump_login_role' to log in under SSPI.

commit   : 1e3f461e825fe61f741b291c91b30967739a90d0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2023 00:31:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2023 00:31:39 -0500    

Click here for diff

Semi-blind attempt to fix a70f2a57f to work on Windows,  
along the same lines as 5253519b2.  Per buildfarm.  

M src/test/modules/test_pg_dump/t/001_base.pl

Add support for pg_stat_reset_slru without argument

commit   : e5cca6288a4098cf731599b5977b0f6714ba0ac6    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Nov 2023 09:50:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Nov 2023 09:50:52 +0900    

Click here for diff

pg_stat_reset_slru currently requires an input argument, either:  
- NULL to reset the SLRU counters of everything.  
- A specific value to reset a single SLRU cache.  
  
This commit adds support for a new pattern: pg_stat_reset_slru without  
any argument works the same way as pg_stat_reset_slru(NULL), relying on  
a DEFAULT in the function definition to handle this case.  This makes  
the function more consistent with 23c8c0c8f472.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy  
Reviewed-by: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CALj2ACW1VizYg01EeH_cA-7qA+4NzWVAoZ5Lw9_XYO1RRHAZbA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_functions.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Don't try to dump RLS policies or security labels for extension objects.

commit   : a70f2a57f233244c0a780829baf48c624187d456    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 17:04:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 17:04:10 -0500    

Click here for diff

checkExtensionMembership() set the DUMP_COMPONENT_SECLABEL and  
DUMP_COMPONENT_POLICY flags for extension member objects, even though  
we lack any infrastructure for tracking extensions' initial settings  
of these properties.  This is not OK.  The result was that a dump  
would always include commands to set these properties for extension  
objects that have them, with at least three negative consequences:  
  
1. The restoring user might not have privilege to set these properties  
on these objects.  
  
2. The properties might be incorrect/irrelevant for the version of the  
extension that's installed in the destination database.  
  
3. The dump itself might fail, in the case of RLS properties attached  
to extension tables that the dumping user lacks privilege to LOCK.  
(That's because we must get at least AccessShareLock to ensure that  
we don't fail while trying to decompile the RLS expressions.)  
  
When and if somebody cares to invent initial-state infrastructure for  
extensions' RLS policies and security labels, we could think about  
finding another way around problem #3.  But in the absence of such  
infrastructure, this whole thing is just wrong and we shouldn't do it.  
  
(Note: this applies only to ordinary dumps; binary-upgrade dumps  
still dump and restore extension member objects separately, with  
all properties.)  
  
Tom Lane and Jacob Champion.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_pg_dump/test_pg_dump–1.0.sql

doc: clarify handling of ts_headline() operators & extra words

commit   : 24943fba465b467d9fc70ce1eb82ee255f6992de    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:35:55 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:35:55 -0500    

Click here for diff

Reported-by: Ngigi Waithaka & Alex Malek  
  
Bug: 15172  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16  

M doc/src/sgml/textsearch.sgml

psql: improve description consistency of \dTS data types

commit   : f279241b09aa3cf4c6162f74dc8b5cc99ebcd196    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:26:59 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:26:59 -0500    

Click here for diff

This was done particularly for geometric data types.  
  
Reported-by: Christoph Berg  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Kyotaro Horiguchi  
  
Backpatch-through: master  

M doc/src/sgml/datatype.sgml
M src/include/catalog/pg_type.dat

doc: clarify handling of range upper/lower/upper_inf/lower_inf()

commit   : 7539a1b2fc839f45a95f66a42939db13629e79a9    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:08:01 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 16:08:01 -0500    

Click here for diff

Clarify handling of infinite range bounds.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Laurenz Albe  
  
Backpatch-through: 16  

M doc/src/sgml/func.sgml

Improve default and empty privilege outputs in psql.

commit   : d1379ebf4c2d3d399e739966dbfa34e92a53b727    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 15:41:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 15:41:27 -0500    

Click here for diff

Default privileges are represented as NULL::aclitem[] in catalog ACL  
columns, while revoking all privileges leaves an empty aclitem[].  
These two cases used to produce identical output in psql meta-commands  
like \dp.  Using something like "\pset null '(default)'" as a  
workaround for spotting the difference did not work, because null  
values were always displayed as empty strings by describe.c's  
meta-commands.  
  
This patch improves that with two changes:  
  
1. Print "(none)" for empty privileges so that the user is able to  
   distinguish them from default privileges, even without special  
   workarounds.  
  
2. Remove the special handling of null values in describe.c,  
   so that "\pset null" is honored like everywhere else.  
   (This affects all output from these commands, not only ACLs.)  
  
The privileges shown by \dconfig+ and \ddp as well as the column  
privileges shown by \dp are not affected by change #1, because the  
respective aclitem[] is reset to NULL or deleted from the catalog  
instead of leaving an empty array.  
  
Erik Wienhold and Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M src/bin/psql/describe.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

doc: move ROW IS NULL examples to a different chapter

commit   : bd86407892126d8c950dd90e6016ea6d0450bd19    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 15:20:54 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 15:20:54 -0500    

Click here for diff

Also add examples.  
  
Reported-by: Wolfgang Walther  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml

doc: clarify that pg_global can _only_ be used for system tabs.

commit   : 8680bae8463a0b213893ca6a1c5bb2c2530e823c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:53:38 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:53:38 -0500    

Click here for diff

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

M doc/src/sgml/manage-ag.sgml

Adjust file_fdw regression tests for acc95f29ef FREEZE commit

commit   : e61a82c949353d9684d037a9a404fbb26b651535    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:44:39 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:44:39 -0500    

Click here for diff

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

M contrib/file_fdw/expected/file_fdw.out

doc: restructure ALTER DEFAULT PRIVILEGES

commit   : 151a0ee76dc7204b858d84f128e6f819f1393040    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:27:38 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 14:27:38 -0500    

Click here for diff

Clarify that default privileges are not inherited and reorder  
paragraphs.  This is a follow up to a recent ALTER DEFAULT PRIVILEGES  
doc patch.  
  
Reported-by: Sanjay Minni  
  
Diagnosed-by: AMpxBo=M35hcH1g4Vg=KRJ0-77FOJcvdrdiVF5KSOAdOG-LvKQ@mail.gmail.com  
  
Co-authored-by: Laurenz Albe  
  
Backpatch-through: 16  

M doc/src/sgml/ref/alter_default_privileges.sgml

Improve readability and error detection of array_in().

commit   : 83472de606db42a1e1f59ab2c3d0e5ae0b95e739    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 13:01:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 13:01:47 -0500    

Click here for diff

Rewrite array_in() and its subroutines so that we make only one  
pass over the input text, rather than two.  This requires  
potentially re-pallocing the working arrays values[] and nulls[]  
larger than our initial guess, but that cost will hopefully be made  
up by avoiding duplicate parsing.  In any case this coding seems  
much clearer and more straightforward than what we had before.  
  
This also fixes array_in() to reject non-rectangular input (that is,  
different brace depths in different parts of the input) more reliably  
than before, and to give a better error message when it does so.  
This is analogous to the plpython and plperl fixes in 0553528e7 and  
f47004add.  Like those PLs, we now accept input such as '{{},{}}'  
as a valid representation of an empty array, which we did not before.  
  
Additionally, reject explicit array subscripts that are outside the  
integer range (previously you just got whatever atoi() converted  
them to), and make some other minor improvements in error reporting.  
  
Although this is arguably a bug fix, it's also a behavioral change  
that might trip somebody up, so no back-patch.  
  
Tom Lane, Heikki Linnakangas, and Jian He.  Thanks to Alexander Lakhin  
for the initial report and for review/testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/array.sgml
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/include/utils/array.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql
M src/tools/pgindent/typedefs.list

doc: correct description of libpq's PQsetnonblocking() mode

commit   : 57d6a198c9f62c5379cdb6e85e956be2257979c7    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 13:01:08 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 13:01:08 -0500    

Click here for diff

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

M doc/src/sgml/libpq.sgml

Add error about the use of FREEZE in COPY TO

commit   : acc95f29efd4f8aa60eb72a838bfd3c979fb1c5b    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 12:53:03 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 12:53:03 -0500    

Click here for diff

Also clarify some other error wording.  
  
Reported-by: Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/test/regress/expected/copy2.out

doc: remove RUNAS instructions for pg_upgrade on Windows

commit   : 103ed24e311770510e2faf56a24cb27d297219de    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 12:40:38 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Nov 2023 12:40:38 -0500    

Click here for diff

None of our other tools have such a recommendation.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwbpqP_DB8WhthnwbsUOT_qB=AK3PpBMmmMsYvENQFHhEg@mail.gmail.com  
  
Backpatch-through: master  

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

Don't release index root page pin in ginFindParents().

commit   : 5c62ecf6ec3c912c85a8292a9ad0daa8c0777088    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 11:44:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2023 11:44:35 -0500    

Click here for diff

It's clearly stated in the comments that ginFindParents() must keep  
the pin on the index's root page that's associated with the topmost  
GinBtreeStack item.  However, the code path for the case that the  
desired downlink has been pushed down to the next index level  
ignored this proviso, and would release the pin anyway if we were  
still examining the root level.  That led to an assertion failure  
or "buffer NNNN is not owned by resource owner" error later, when  
we try to release the pin again at the end of the insertion.  
  
This is quite hard to reproduce, since it can only happen if an  
index root page split occurs concurrently with our own insertion.  
Thanks to Jeff Janes for finding a test case that triggers it  
often enough to allow investigation.  
  
This has been there since the beginning of GIN, so back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/CAMkU=1yCAKtv86dMrD__Ja-7KzjE=uMeKX8y__cx5W-OEWy2ow@mail.gmail.com  

M src/backend/access/gin/ginbtree.c

doc: Add missing semicolon in example

commit   : c3fd6a10fc520158e381d0296316be387b5b8da7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 13 Nov 2023 14:13:03 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 13 Nov 2023 14:13:03 +0100    

Click here for diff

One of the examples on the SELECT page was missing a semicolon from  
a listing which has the look and feel of being a psql session. This  
adds the missing semicolon and also removes the newline between the  
query and results to match the other examples nearby.  
  
Backpatch to all supported branches to avoid backpatching issues on  
this page.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

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

Remove incorrect file reference in comment.

commit   : 06e8e71e7ffdaa50556f946c080a22040b8a4784    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 13 Nov 2023 19:05:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 13 Nov 2023 19:05:00 +0900    

Click here for diff

Commit b7eda3e0e moved XidInMVCCSnapshot() from tqual.c into snapmgr.c,  
but follow-up commit c91560def incorrectly updated this reference.  We  
could fix it, but as pointed out by Daniel Gustafsson, 1) the reader can  
easily find the file that contains the definition of that function, e.g.  
by grepping, and 2) this kind of reference is prone to going stale; so  
let's just remove it.  
  
Back-patch to all supported branches.  
  
Reviewed by Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/CAPmGK145VdKkPBLWS2urwhgsfidbSexwY-9zCL6xSUJH%2BBTUUg%40mail.gmail.com  

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

Use REGBUF_NO_CHANGE at one more place in the hash index.

commit   : 861f86beea1c241943a3ef000e789f18bbc8b7e8    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Nov 2023 14:08:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Nov 2023 14:08:26 +0530    

Click here for diff

Commit 00d7fb5e2e started to use REGBUF_NO_CHANGE at a few places in the  
code where we register the buffer before marking it dirty but missed  
updating one of the code flows in the hash index where we free the overflow  
page without any live tuples on it.  
  
Author: Amit Kapila and Hayato Kuroda  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashovfl.c
M src/test/regress/expected/hash_index.out
M src/test/regress/sql/hash_index.sql

Extend sendFileWithContent() to handle custom content length in basebackup.c

commit   : 7606175991f8ed5ae36eecf6951cb89dcfb2156e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Nov 2023 08:26:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Nov 2023 08:26:44 +0900    

Click here for diff

sendFileWithContent() previously got the content length by using  
strlen(), assuming that the content given is always a string.  Some  
patches are under discussion to pass binary contents to a base backup  
stream, where an arbitrary length needs to be given by the caller  
instead.  
  
The patch extends sendFileWithContent() to be able to handle this case,  
where len < 0 can be used to indicate an arbitrary length rather than  
rely on strlen() for the content length.  
  
A comment in sendFileWithContent() mentioned the backup_label file.  
However, this routine is used by more file types, like the tablespace  
map, so adjust it in passing.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/backup/basebackup.c

Add ability to reset all shared stats types in pg_stat_reset_shared()

commit   : 23c8c0c8f4721db693ef908c22f7cf754e6852a9    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 12 Nov 2023 16:43:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 12 Nov 2023 16:43:12 +0900    

Click here for diff

Currently, pg_stat_reset_shared() can use an argument to specify the  
target of statistics to reset, doing nothing for NULL as it is strict.  
  
This patch adds to pg_stat_reset_shared() the possibility to reset all  
the stats types already handled in this function rather than do nothing  
if the argument value given is NULL or if nothing is specified  
(proisstrict is switched to false).  Like previously, SLRUs are not  
included in what gets reset.  
  
The idea to use NULL or no argument to control if all the shared stats  
already covered by this function should be reset has been proposed by  
Andres Freund.  
  
Bump catalog version.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier, Bharath Rupireddy,  
Matthias van de Meent  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix inconsistencies for queries on pg_class in type_sanity.sql

commit   : a9f19c1349c22819038842a0debba2c86b4832b8    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 12 Nov 2023 10:06:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 12 Nov 2023 10:06:51 +0900    

Click here for diff

Three queries did not consider partitioned indexes and tables, and  
surrounding comments have not been updated in a while.  
  
Like 4b9fbd6be442, this is only cosmetic currently as no such relkinds  
exist at this stage of the regression tests, but running these queries  
on existing clusters could lead to incorrect results.  
  
Author: Jian He, Michael Paquier  
Discussion: https://postgr.es/m/CACJufxGsB1ciahkNDccyxhw-Pfp_-_y+Wx+1BOdRyVVxKojAbg@mail.gmail.com  

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

Fix how SJE checks against PHVs

commit   : b7f315c9d7d839dda847b10d170ffec7c3f4dbba    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Nov 2023 22:46:46 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Nov 2023 22:46:46 +0200    

Click here for diff

It seems that a PHV evaluated/needed at or below the self join should not have  
a problem if we remove the self join.  But this requires further investigation.  
For now, we just do not remove self joins if the rel to be removed is laterally  
referenced by PHVs.  
  
Discussion: https://postgr.es/m/CAMbWs4-ns73VF9gi37q61G3dS6Xuos+HtryMaBh37WQn=BsaJw@mail.gmail.com  
Author: Richard Guo  

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

Fix whitespace

commit   : eb81e8e7902f63c4d292638edc8b7e92b766a692    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Nov 2023 11:56:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Nov 2023 11:56:52 +0100    

Click here for diff

Fix trailing whitespace from commit 322f55bdbd.  

M doc/src/sgml/postgres.sgml

Prohibit max_slot_wal_keep_size to value other than -1 during upgrade.

commit   : 8bfb231b43d7f6058041483f2b823dd52eac7bf8    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 10 Nov 2023 08:45:01 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 10 Nov 2023 08:45:01 +0530    

Click here for diff

We don't want existing slots in the old cluster to get invalidated during  
the upgrade. During an upgrade, we set this variable to -1 via the command  
line in an attempt to prevent such invalidations, but users have ways to  
override it. This patch ensures the value is not overridden by the user.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Peter Smith, Alvaro Herrera  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/slot.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h

doc: fix wording describing the checkpoint_flush_after GUC

commit   : 5ba1ac99a8d8623604d3152be8fd9a201ba5240b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 Nov 2023 17:51:19 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 Nov 2023 17:51:19 -0500    

Click here for diff

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

M doc/src/sgml/wal.sgml

doc: remove unnecessary comma in postgres-fdw

commit   : 80e278e436a7ad5cb4724d8b8ef39e79e4c3f5e6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 Nov 2023 16:44:39 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 Nov 2023 16:44:39 -0500    

Click here for diff

Backpatch-through: master  

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

Fix computation of varnullingrels when const-folding field selection.

commit   : 36f5594c0fe694600c07c803324b51fcfbea4079    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2023 15:46:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2023 15:46:16 -0500    

Click here for diff

We can simplify FieldSelect on a whole-row Var into a plain Var  
for the selected field.  However, we should copy the whole-row Var's  
varnullingrels when we do so, because the new Var is clearly nullable  
by exactly the same rels as the original.  Failure to do this led to  
errors like "wrong varnullingrels (b) (expected (b 3)) for Var 2/2".  
  
Richard Guo, per bug #18184 from Marian Krucina.  Back-patch to  
v16 where varnullingrels was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

meson: Install missing example files

commit   : b630d9d6c82aeb540c92faf220b837cc71a1416c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2023 15:05:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2023 15:05:58 +0100    

Click here for diff

Install the example files from contrib/spi/, to match makefiles.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/meson.build
M contrib/spi/meson.build
M meson.build

meson: Fix doc installation path computation

commit   : 7b8399819b9b1a409b11ebfb4027aed56747f923    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2023 15:05:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2023 15:05:58 +0100    

Click here for diff

This applies the logic from 8f6858064b (append "postgresql" to some  
installation paths if it does not already contain "pgsql" or  
"postgres") also to the doc installation directory.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M meson.build

Fix the way SJE removes references from PHVs

commit   : b44a1708abe306831073cf88bb0ba6a11e68daee    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 9 Nov 2023 14:06:11 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 9 Nov 2023 14:06:11 +0200    

Click here for diff

Add missing replacement of relids in phv->phexpr.  Also, remove extra  
replace_relid() over phv->phrels.  
  
Reported-by:  Zuming Jiang  
Bug: #18187  
Discussion: https://postgr.es/m/flat/18187-831da249cbd2ff8e%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

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

Avoid integer overflow hazard in interval_time().

commit   : 3850d4dec1d91c4fdce274f42986840444d5593e    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 12:10:14 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 12:10:14 +0000    

Click here for diff

When casting an interval to a time, the original code suffered from  
64-bit integer overflow for inputs with a sufficiently large negative  
"time" field, leading to bogus results.  
  
Fix by rewriting the algorithm in a simpler form, that more obviously  
cannot overflow. While at it, improve the test coverage to include  
negative interval inputs.  
  
Discussion: https://postgr.es/m/CAEZATCXoUKHkcuq4q63hkiPsKZJd0kZWzgKtU%2BNT0aU4wbf_Pw%40mail.gmail.com  

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

Fix AFTER ROW trigger execution in MERGE cross-partition update.

commit   : a4f7d33a904fcd4da7a12d249416dd2c5c5f2c1c    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 11:23:42 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 11:23:42 +0000    

Click here for diff

When executing a MERGE UPDATE action, if the UPDATE is turned into a  
cross-partition DELETE then INSERT, do not attempt to invoke AFTER  
UPDATE ROW triggers, or any of the other post-update actions in  
ExecUpdateEpilogue().  
  
For consistency with a plain UPDATE command, such triggers should not  
be fired (and typically fail anyway), and similarly, other post-update  
actions, such as WCO/RLS checks should not be executed, and might also  
lead to unexpected failures.  
  
Therefore, as with ExecUpdate(), make ExecMergeMatched() return  
immediately if ExecUpdateAct() reports that a cross-partition update  
was done, to be sure that no further processing is done for that  
tuple.  
  
Back-patch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCWjBgagyNZs02vgDF0DvASYj-iHTFtXG2-nP3orZhmtcw%40mail.gmail.com  

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

Ensure we use the correct spelling of "ensure"

commit   : 10d34fefc2ab3c12b03772744c24000c44b7a550    
  
author   : David Rowley <[email protected]>    
date     : Fri, 10 Nov 2023 00:15:54 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 10 Nov 2023 00:15:54 +1300    

Click here for diff

We seem to have accidentally used "insure" in a few places.  Correct  
that.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=Q@mail.gmail.com  
Backpatch-through: 12, oldest supported version  

M src/backend/access/heap/hio.c
M src/backend/utils/misc/guc_tables.c
M src/include/storage/buf_internals.h
M src/tools/pg_bsd_indent/indent.c

Fix corner-case 64-bit integer subtraction bug on some platforms.

commit   : 0e3e8fbd3a8b1660b02a5bb032dc1f50e1d66b19    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 09:50:23 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 9 Nov 2023 09:50:23 +0000    

Click here for diff

When computing "0 - INT64_MIN", most platforms would report an  
overflow error, which is correct. However, platforms without integer  
overflow builtins or 128-bit integers would fail to spot the overflow,  
and incorrectly return INT64_MIN.  
  
Back-patch to all supported branches.  
  
Patch be me. Thanks to Jian He for initial investigation, and Laurenz  
Albe and Tom Lane for review.  
  
Discussion: https://postgr.es/m/CAEZATCUNK-AZSD0jVdgkk0N%3DNcAXBWeAEX-QU9AnJPensikmdQ%40mail.gmail.com  

M src/include/common/int.h
M src/test/regress/expected/int8.out
M src/test/regress/sql/int8.sql

Fix uninitialized slot array access during the upgrade.

commit   : a7db71ed2787e7dbf2c41473a2b7df2fcb55abd0    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 9 Nov 2023 09:26:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 9 Nov 2023 09:26:40 +0530    

Click here for diff

Commit 29d0a77fa introduced fetching slot information from the old cluster  
but didn't initialize the required array in all the code paths. So when  
trying to access the array in verbose mode for the new cluster, it leads  
to an uninitialized memory access.  
  
Author: Vignesh C  
Discussion: http://postgr.es/m/CALDaNm1tntGP5=CtMz=v+k3_PGv7kE9t6iWSgX-QiurAaFkhZw@mail.gmail.com  

M src/bin/pg_upgrade/info.c

pg_stat_statements: Remove duplicated tests for SET statements

commit   : 108161bcb9cc6df45ed9200ca935c63b2cad4666    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Nov 2023 10:04:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Nov 2023 10:04:31 +0900    

Click here for diff

This looks like a copy-paste mistake introduced in de2aca288569, that  
has added checks for more patterns of SET statements while ignoring the  
original test block that existed.  
  
Backpatch down to where this has been introduced, as this shaves some  
cycles.  
  
Author: Sergei Kornilov  
Discussion: https://postgr.es/m/5689421699428803@mail-sendbernar-production-main-46.myt.yp-c.yandex.net  
Backpatch-through: 16  

M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/sql/utility.sql

Fix bug in the new ResourceOwner implementation.

commit   : 8f4a1ab471e6a258881e3d7f5883705714cde7e1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Nov 2023 01:33:14 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Nov 2023 01:33:14 +0200    

Click here for diff

When the hash table is in use, ResoureOwnerSort() moves any elements  
from the small fixed-size array to the hash table, and sorts it. When  
the hash table is not in use, it sorts the elements in the small  
fixed-size array directly. However, ResourceOwnerSort() and  
ResourceOwnerReleaseAll() had different idea on when the hash table is  
in use: ResourceOwnerSort() checked owner->nhash != 0, and  
ResourceOwnerReleaseAll() checked owner->hash != NULL. If the hash  
table was allocated but was currently empty, you hit an assertion  
failure.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/utils/resowner/resowner.c

doc:: simplify introductory text

commit   : 322f55bdbd018bf18a0c5605c7bc592c625dc263    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:48:43 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:48:43 -0500    

Click here for diff

Reported-by: Joshua D. Drake  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Joshua D. Drake  
  
Backpatch-through: master  

M doc/src/sgml/postgres.sgml

commit   : 0ccb657a3378f6a9b760a2f25dd6f26cb726cf57    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:36:18 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:36:18 -0500    

Click here for diff

Reported-by: Daniel Westermann  
  
Discussion: https://postgr.es/m/DB6PR0902MB2184F7965C9EA9070ACFCA43D2A80@DB6PR0902MB2184.eurprd09.prod.outlook.com  
  
Backpatch-through: master  

M README

doc: change "system" to "cluster" where appropriate

commit   : 3a236fc9f39eb9eb39c1a66f7263590be3d2ed45    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:16:20 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:16:20 -0500    

Click here for diff

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

M doc/src/sgml/config.sgml

doc: mention that ANALYZE does block DDL

commit   : 53015c8afae30176853bed90061672981d0ed72c    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:04:42 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Nov 2023 16:04:42 -0500    

Click here for diff

Reported-by: Aramaki Zyake  
  
Discussion: https://postgr.es/m/156628723253.1296.7377373462603881976%40wrigleys.postgresql.org  
  
Author: Aramaki Zyake  
  
Backpatch-through: master  

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

Check stack depth in new recursive functions

commit   : b0f7dd915bca6243f3daf52a81b8d0682a38ee3b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Nov 2023 18:44:54 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Nov 2023 18:44:54 +0100    

Click here for diff

Commit b0e96f311985 introduced a bunch of recursive functions, but  
failed to make them check for stack depth.  This can cause the backend  
to crash when operating on inheritance hierarchies several thousands  
deep.  Protect the code by adding the missing stack depth checks.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix some issues with tracking nesting level in pg_stat_statements.

commit   : 76db9cb6368eb553ec334fe05e1258f2439bf07f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2023 12:01:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2023 12:01:28 -0500    

Click here for diff

When we decide that we don't want to track execution time of a  
specific planner or ProcessUtility call, we still have to increment  
the nesting depth, or we'll make the wrong determination of whether  
we are at top level when considering nested statements.  (PREPARE  
and EXECUTE are exceptions, for reasons explained in the code.)  
  
Counting planner nesting depth separately from executor nesting depth  
was a mistake: it causes us to make the wrong determination of whether  
we are at top level when considering nested statements that get  
executed during planning (as a result of constant-folding of  
functions, for example).  Merge those counters into one.  
  
In passing, get rid of the PGSS_HANDLED_UTILITY macro in favor of  
explicitly listing statement types.  It seems somewhat coincidental  
that PREPARE and EXECUTE are handled alike in each of the places where  
that was used: the reasoning tends to be different for each one.  
Thus, the macro seems as likely to encourage future bugs as prevent  
them, since it's quite unclear whether any future statement type that  
might need special-casing here would also need the same choices at  
each spot.  
  
Sergei Kornilov, Julien Rouhaud, and Tom Lane, per bug #17552 from  
Maxim Boguk.  This is pretty clearly a bug fix, but it's also a  
behavioral change that might surprise somebody, so no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Call pqPipelineFlush from PQsendFlushRequest

commit   : 1a5594b95762a3c1d3a670881ee7f3c5679a1642    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Nov 2023 16:44:08 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Nov 2023 16:44:08 +0100    

Click here for diff

When PQsendFlushRequest() was added by commit 69cf1d5429d4, we argued  
against adding a PQflush() call in it[1].  This is still the right  
decision: if the user wants a flush to occur, they can just call that.  
However, we failed to realize that the message bytes could still be  
given to the kernel for transmitting when this can be made without  
blocking.  That's what pqPipelineFlush() does, and it is done for every  
single other message type sent by libpq, so do that.  
  
(When the socket is in blocking mode this may indeed block, but that's  
what all the other libpq message-sending routines do, too.)  
  
[1] https://www.postgresql.org/message-id/202106252352.5ca4byasfun5%40alvherre.pgsql  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQTxZRevRWkKodE-SnJk1Yfm4eKT+8E4Cyq3MJ9YKTnNew@mail.gmail.com  

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

Change pgcrypto to use the new ResourceOwner mechanism.

commit   : cd694f60dc975e9fe41e8643ca6f0629283d102e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:55 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:55 +0200    

Click here for diff

This is a nice example of how extensions can now use ResourceOwners to  
track extension-specific resource kinds  
  
Reviewed-by: Peter Eisentraut, Andres Freund  
Discussion: https://www.postgresql.org/message-id/d746cead-a1ef-7efe-fb47-933311e876a3%40iki.fi  

M contrib/pgcrypto/openssl.c

Use a faster hash function in resource owners.

commit   : 954e43564d9920f0a98e3b750e0c74bb035410f5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:52 +0200    

Click here for diff

This buys back some of the performance loss that we otherwise saw from the  
previous commit.  
  
Reviewed-by: Aleksander Alekseev, Michael Paquier, Julien Rouhaud  
Reviewed-by: Kyotaro Horiguchi, Hayato Kuroda, Álvaro Herrera, Zhihong Yu  
Reviewed-by: Peter Eisentraut, Andres Freund  
Discussion: https://www.postgresql.org/message-id/d746cead-a1ef-7efe-fb47-933311e876a3%40iki.fi  

M src/backend/utils/resowner/resowner.c
M src/include/common/hashfn.h

Make ResourceOwners more easily extensible.

commit   : b8bff07daa85c837a2747b4d35cd5a27e73fb7b2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:50 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:50 +0200    

Click here for diff

Instead of having a separate array/hash for each resource kind, use a  
single array and hash to hold all kinds of resources. This makes it  
possible to introduce new resource "kinds" without having to modify  
the ResourceOwnerData struct. In particular, this makes it possible  
for extensions to register custom resource kinds.  
  
The old approach was to have a small array of resources of each kind,  
and if it fills up, switch to a hash table. The new approach also uses  
an array and a hash, but now the array and the hash are used at the  
same time. The array is used to hold the recently added resources, and  
when it fills up, they are moved to the hash. This keeps the access to  
recent entries fast, even when there are a lot of long-held resources.  
  
All the resource-specific ResourceOwnerEnlarge*(),  
ResourceOwnerRemember*(), and ResourceOwnerForget*() functions have  
been replaced with three generic functions that take resource kind as  
argument. For convenience, we still define resource-specific wrapper  
macros around the generic functions with the old names, but they are  
now defined in the source files that use those resource kinds.  
  
The release callback no longer needs to call ResourceOwnerForget on  
the resource being released. ResourceOwnerRelease unregisters the  
resource from the owner before calling the callback. That needed some  
changes in bufmgr.c and some other files, where releasing the  
resources previously always called ResourceOwnerForget.  
  
Each resource kind specifies a release priority, and  
ResourceOwnerReleaseAll releases the resources in priority order. To  
make that possible, we have to restrict what you can do between  
phases. After calling ResourceOwnerRelease(), you are no longer  
allowed to remember any more resources in it or to forget any  
previously remembered resources by calling ResourceOwnerForget.  There  
was one case where that was done previously. At subtransaction commit,  
AtEOSubXact_Inval() would handle the invalidation messages and call  
RelationFlushRelation(), which temporarily increased the reference  
count on the relation being flushed. We now switch to the parent  
subtransaction's resource owner before calling AtEOSubXact_Inval(), so  
that there is a valid ResourceOwner to temporarily hold that relcache  
reference.  
  
Other end-of-xact routines make similar calls to AtEOXact_Inval()  
between release phases, but I didn't see any regression test failures  
from those, so I'm not sure if they could reach a codepath that needs  
remembering extra resources.  
  
There were two exceptions to how the resource leak WARNINGs on commit  
were printed previously: llvmjit silently released the context without  
printing the warning, and a leaked buffer io triggered a PANIC. Now  
everything prints a WARNING, including those cases.  
  
Add tests in src/test/modules/test_resowner.  
  
Reviewed-by: Aleksander Alekseev, Michael Paquier, Julien Rouhaud  
Reviewed-by: Kyotaro Horiguchi, Hayato Kuroda, Álvaro Herrera, Zhihong Yu  
Reviewed-by: Peter Eisentraut, Andres Freund  
Discussion: https://www.postgresql.org/message-id/cbfabeb0-cd3c-e951-a572-19b365ed314d%40iki.fi  

M src/backend/access/common/tupdesc.c
M src/backend/access/transam/xact.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/resowner/README
M src/backend/utils/resowner/resowner.c
M src/backend/utils/time/snapmgr.c
M src/common/cryptohash_openssl.c
M src/common/hmac_openssl.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/utils/catcache.h
M src/include/utils/plancache.h
M src/include/utils/resowner.h
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_handler.c
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_resowner/.gitignore
A src/test/modules/test_resowner/Makefile
A src/test/modules/test_resowner/expected/test_resowner.out
A src/test/modules/test_resowner/meson.build
A src/test/modules/test_resowner/sql/test_resowner.sql
A src/test/modules/test_resowner/test_resowner–1.0.sql
A src/test/modules/test_resowner/test_resowner.control
A src/test/modules/test_resowner/test_resowner_basic.c
A src/test/modules/test_resowner/test_resowner_many.c
M src/tools/pgindent/typedefs.list

Move a few ResourceOwnerEnlarge() calls for safety and clarity.

commit   : b70c2143bbbe291fe2b444150772972fa53972f1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:46 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Nov 2023 13:30:46 +0200    

Click here for diff

These are functions where a lot of things happen between the  
ResourceOwnerEnlarge and ResourceOwnerRemember calls. It's important  
that there are no unrelated ResourceOwnerRemember calls in the code in  
between, otherwise the reserved entry might be used up by the  
intervening ResourceOwnerRemember and not be available at the intended  
ResourceOwnerRemember call anymore. I don't see any bugs here, but the  
longer the code path between the calls is, the harder it is to verify.  
  
In bufmgr.c, there is a function similar to ResourceOwnerEnlarge,  
ReservePrivateRefCountEntry(), to ensure that the private refcount  
array has enough space. The ReservePrivateRefCountEntry() calls were  
made at different places than the ResourceOwnerEnlargeBuffers()  
calls. Move the ResourceOwnerEnlargeBuffers() and  
ReservePrivateRefCountEntry() calls together for consistency.  
  
Reviewed-by: Aleksander Alekseev, Michael Paquier, Julien Rouhaud  
Reviewed-by: Kyotaro Horiguchi, Hayato Kuroda, Álvaro Herrera, Zhihong Yu  
Reviewed-by: Peter Eisentraut, Andres Freund  
Discussion: https://www.postgresql.org/message-id/cbfabeb0-cd3c-e951-a572-19b365ed314d%40iki.fi  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/cache/catcache.c

Don't install ldap_password_func in meson

commit   : e9f075f9a15593fe31c610e15cfc71a5fa281ede    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Nov 2023 11:27:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Nov 2023 11:27:28 +0100    

Click here for diff

It should be handled as a test module per commit b6a0d469ca.  

M src/test/modules/ldap_password_func/meson.build

Fix use of OPENSSL in SSL tests if command is not found

commit   : b64c8b01c275f802372b6860793737219fe2fd62    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Nov 2023 17:29:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Nov 2023 17:29:02 +0900    

Click here for diff

`openssl` is an optional dependency in the meson build as it may not be  
installed in an environment even if SSL libraries are around.  The meson  
scripts assume that, but the SSL tests thought that it was a hard  
dependency, causing a meson installation to fail if `openssl` could not  
be found.  Like similar tests that depend on external commands, and to  
be consistent with ./configure for the SSL tests, this commit makes the  
command existence optional in the tests.  
  
Author: Tristan Partin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/test/ssl/meson.build

Enlarge assertion in bloom_init() for false_positive_rate

commit   : 1b2c6b756eaae5203af887973b306882fb477836    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Nov 2023 14:06:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Nov 2023 14:06:26 +0900    

Click here for diff

false_positive_rate is a parameter that can be set with the bloom  
opclass in BRIN, and setting it to a value of exactly 0.25 would trigger  
an assertion in the first INSERT done on the index with value set.  
  
The assertion changed here relied on BLOOM_{MIN|MAX}_FALSE_POSITIVE_RATE  
that are somewhat arbitrary values, and specifying an out-of-range value  
would also trigger a failure when defining such an index.  So, as-is,  
the assertion was just doubling on the min-max check of the reloption.  
This is now enlarged to check that it is a correct percentage value,  
instead, based on a suggestion by Tom Lane.  
  
Author: Alexander Lakhin  
Reviewed-by: Tom Lane, Shihao Zhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

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

Stop including parsenodes.h in plannodes.h

commit   : 615f5f6faa0fb659c4e20e1d2137a869cd33058b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Nov 2023 19:26:39 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Nov 2023 19:26:39 +0100    

Click here for diff

I added it by mistake in commit 7103ebb7aae8.  To clean up, struct  
MergeAction needs to be moved to primnodes.h from parsenodes.h.  (This  
forces us to also move OverridingKind to primnodes.h).  
  
Having to add parsenodes.h to bootstrap.h as fallout is a bit  
surprising, since nothing nominally needs it there.  However, per  
comments in bootscanner.l, it is needed so that YYSTYPE can be declared.  
I think this only started with commit dac048f71ebb, but I didn't  
actually verify that.  
  
In passing, stop including parsenodes.h in tcopprot.h.  Nothing needs it  
there.  
  
Per discussion on a patch by Ashutosh Bapat.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/windowfuncs.c
M src/include/bootstrap/bootstrap.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/tcop/tcopprot.h

citext: Allow tests to pass in OpenSSL FIPS mode

commit   : 3c551ebede46194237f82062b54b92e474b5c743    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Nov 2023 07:58:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Nov 2023 07:58:14 +0100    

Click here for diff

citext doesn't define an md5() function, so the value of using it in  
its tests is dubious.  At best this shows in an indirect way that the  
cast from citext to text works.  Avoid the issue and remove the test.  
  
Discussion: https://www.postgresql.org/message-id/flat/dbbd927f-ef1f-c9a1-4ec6-c759778ac852%40enterprisedb.com  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

Fix the test 003_logical_slots.

commit   : 8af917be6badf0b50759fd7d9ca4e3e7977dd486    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 7 Nov 2023 11:32:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 7 Nov 2023 11:32:33 +0530    

Click here for diff

pg_upgrade test 003_logical_slots was leaving files like  
delete_old_cluster.sh in the source directory for VPATH and meson builds.  
The fix is to change the directory to tmp_check before running the test as  
is done in the similar test in 002_pg_upgrade.  
  
Reported-by: Peter Eisentraut, Andrew Dunstan  
Author: Hayato Kuroda based on a suggestion by Andrew Dunstan  
Reviewed-by: Peter Smith, Hou Zhijie  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/TYAPR01MB5866D7B89DC5688256D980C2F5A9A@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/003_logical_slots.pl

Reorder two functions in inval.c

commit   : c2bdd2c5b1d48a7e39e1a8d5e1d90b731b53c4c9    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 Nov 2023 11:55:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 Nov 2023 11:55:13 +0900    

Click here for diff

This file separates public and static functions with a separator  
comment, but two routines were not defined in a location reflecting  
that, so reorder them.  
  
Author: Aleksander Alekseev  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAJ7c6TMX2dd0g91UKvcC+CVygKQYJkKJq1+ZzT4rOK42+b53=w@mail.gmail.com  

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

Make use of initReadOnlyStringInfo() in more places

commit   : ac7d6f5f831e4dd83d891b95560d514b2d722d98    
  
author   : David Rowley <[email protected]>    
date     : Tue, 7 Nov 2023 11:16:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 7 Nov 2023 11:16:43 +1300    

Click here for diff

f0efa5aec introduced the concept of "read-only" StringInfos which makes  
use of an existing, possibly not NUL terminated, buffer.  
  
Here we adjust two places that make use of StringInfos to receive data  
to avoid using appendBinaryStringInfo() in cases where a NUL termination  
character is not required.  This saves a possible palloc() and saves  
having to needlessly memcpy() from one buffer to another.  
  
Here we adjust two places which were using appendBinaryStringInfo().  
Neither of these cases seem particularly performance-critical.  In the  
case of XLogWalRcvProcessMsg(), the appendBinaryStringInfo() was only  
appending 24 bytes.  The change made here does mean that we can get rid  
of the incoming_message global variable and make that local instead.  
  
The apply_spooled_messages() case applies in logical decoding when  
applying (possibly large) changes which have been serialized to a file.  
  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAApHDvoxYUDHwqPf-ShvchsERf1RzmkGoLwg63JNvHCkDCuyKQ@mail.gmail.com  

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

Detect integer overflow while computing new array dimensions.

commit   : 18b585155a891784ca8985f595ebc0dde94e0d43    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2023 10:56:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2023 10:56:43 -0500    

Click here for diff

array_set_element() and related functions allow an array to be  
enlarged by assigning to subscripts outside the current array bounds.  
While these places were careful to check that the new bounds are  
allowable, they neglected to consider the risk of integer overflow  
in computing the new bounds.  In edge cases, we could compute new  
bounds that are invalid but get past the subsequent checks,  
allowing bad things to happen.  Memory stomps that are potentially  
exploitable for arbitrary code execution are possible, and so is  
disclosure of server memory.  
  
To fix, perform the hazardous computations using overflow-detecting  
arithmetic routines, which fortunately exist in all still-supported  
branches.  
  
The test cases added for this generate (after patching) errors that  
mention the value of MaxArraySize, which is platform-dependent.  
Rather than introduce multiple expected-files, use psql's VERBOSITY  
parameter to suppress the printing of the message text.  v11 psql  
lacks that parameter, so omit the tests in that branch.  
  
Our thanks to Pedro Gallegos for reporting this problem.  
  
Security: CVE-2023-5869  

M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/include/utils/array.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Compute aggregate argument types correctly in transformAggregateCall().

commit   : 3b0776fde56763c549df35ce9750f3399bc710b2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2023 10:38:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2023 10:38:00 -0500    

Click here for diff

transformAggregateCall() captures the datatypes of the aggregate's  
arguments immediately to construct the Aggref.aggargtypes list.  
This seems reasonable because the arguments have already been  
transformed --- but there is an edge case where they haven't been.  
Specifically, if we have an unknown-type literal in an ANY argument  
position, nothing will have been done with it earlier.  But if we  
also have DISTINCT, then addTargetToGroupList() converts the literal  
to "text" type, resulting in the aggargtypes list not matching the  
actual runtime type of the argument.  The end result is that the  
aggregate tries to interpret a "text" value as being of type  
"unknown", that is a zero-terminated C string.  If the text value  
contains no zero bytes, this could result in disclosure of server  
memory following the text literal value.  
  
To fix, move the collection of the aggargtypes list to the end  
of transformAggregateCall(), after DISTINCT has been handled.  
This requires slightly more code, but not a great deal.  
  
Our thanks to Jingzhou Fu for reporting this problem.  
  
Security: CVE-2023-5868  

M src/backend/parser/parse_agg.c
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Remove distprep

commit   : 721856ff24b3722ce8e894e5a32c9c063cd48455    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 14:51:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 14:51:52 +0100    

Click here for diff

A PostgreSQL release tarball contains a number of prebuilt files, in  
particular files produced by bison, flex, perl, and well as html and  
man documentation.  We have done this consistent with established  
practice at the time to not require these tools for building from a  
tarball.  Some of these tools were hard to get, or get the right  
version of, from time to time, and shipping the prebuilt output was a  
convenience to users.  
  
Now this has at least two problems:  
  
One, we have to make the build system(s) work in two modes: Building  
from a git checkout and building from a tarball.  This is pretty  
complicated, but it works so far for autoconf/make.  It does not  
currently work for meson; you can currently only build with meson from  
a git checkout.  Making meson builds work from a tarball seems very  
difficult or impossible.  One particular problem is that since meson  
requires a separate build directory, we cannot make the build update  
files like gram.h in the source tree.  So if you were to build from a  
tarball and update gram.y, you will have a gram.h in the source tree  
and one in the build tree, but the way things work is that the  
compiler will always use the one in the source tree.  So you cannot,  
for example, make any gram.y changes when building from a tarball.  
This seems impossible to fix in a non-horrible way.  
  
Second, there is increased interest nowadays in precisely tracking the  
origin of software.  We can reasonably track contributions into the  
git tree, and users can reasonably track the path from a tarball to  
packages and downloads and installs.  But what happens between the git  
tree and the tarball is obscure and in some cases non-reproducible.  
  
The solution for both of these issues is to get rid of the step that  
adds prebuilt files to the tarball.  The tarball now only contains  
what is in the git tree (*).  Getting the additional build  
dependencies is no longer a problem nowadays, and the complications to  
keep these dual build modes working are significant.  And of course we  
want to get the meson build system working universally.  
  
This commit removes the make distprep target altogether.  The make  
dist target continues to do its job, it just doesn't call distprep  
anymore.  
  
(*) - The tarball also contains the INSTALL file that is built at make  
dist time, but not by distprep.  This is unchanged for now.  
  
The make maintainer-clean target, whose job it is to remove the  
prebuilt files in addition to what make distclean does, is now just an  
alias to make distprep.  (In practice, it is probably obsolete given  
that git clean is available.)  
  
The following programs are now hard build requirements in configure  
(they were already required by meson.build):  
  
- bison  
- flex  
- perl  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M GNUmakefile.in
M config/perl.m4
M config/programs.m4
M configure
M contrib/cube/Makefile
M contrib/fuzzystrmatch/Makefile
M contrib/seg/Makefile
M doc/Makefile
M doc/src/Makefile
M doc/src/sgml/Makefile
M doc/src/sgml/installation.sgml
M doc/src/sgml/sourcerepo.sgml
M meson.build
M src/Makefile
M src/Makefile.global.in
M src/backend/Makefile
M src/backend/bootstrap/Makefile
M src/backend/catalog/Makefile
M src/backend/jit/llvm/Makefile
M src/backend/nls.mk
M src/backend/nodes/Makefile
M src/backend/parser/Makefile
M src/backend/port/Makefile
M src/backend/replication/Makefile
M src/backend/replication/libpqwalreceiver/Makefile
M src/backend/replication/pgoutput/Makefile
M src/backend/snowball/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/adt/Makefile
M src/backend/utils/mb/Makefile
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/conversion_procs/proc.mk
M src/backend/utils/misc/Makefile
M src/bin/initdb/Makefile
M src/bin/pg_amcheck/Makefile
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_basebackup/Makefile
M src/bin/pg_checksums/Makefile
M src/bin/pg_config/Makefile
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_dump/Makefile
M src/bin/pg_resetwal/Makefile
M src/bin/pg_rewind/Makefile
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_timing/Makefile
M src/bin/pg_upgrade/Makefile
M src/bin/pg_verifybackup/Makefile
M src/bin/pg_waldump/Makefile
M src/bin/pgbench/Makefile
M src/bin/psql/Makefile
M src/bin/scripts/Makefile
M src/common/Makefile
M src/common/unicode/Makefile
M src/fe_utils/Makefile
M src/include/Makefile
M src/interfaces/ecpg/Makefile
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/include/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/test/Makefile
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/test/Makefile
M src/makefiles/pgxs.mk
M src/nls-global.mk
M src/pl/plperl/GNUmakefile
M src/pl/plpgsql/src/Makefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile
M src/port/Makefile
M src/test/authentication/Makefile
M src/test/examples/Makefile
M src/test/icu/Makefile
M src/test/isolation/Makefile
M src/test/kerberos/Makefile
M src/test/ldap/Makefile
M src/test/locale/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/ssl/Makefile
M src/test/ssl/sslfiles.mk
M src/test/subscription/Makefile
M src/timezone/Makefile
M src/tools/ifaddrs/Makefile
M src/tools/pg_bsd_indent/Makefile

Set GUC "is_superuser" in all processes that set AuthenticatedUserId.

commit   : b72de09a1b8e55774b70add4de0f8c59cef6cf6f    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2023 06:14:13 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2023 06:14:13 -0800    

Click here for diff

It was always false in single-user mode, in autovacuum workers, and in  
background workers.  This had no specifically-identified security  
consequences, but non-core code or future work might make it  
security-relevant.  Back-patch to v11 (all supported versions).  
  
Jelte Fennema-Nio.  Reported by Jelte Fennema-Nio.  

M src/backend/utils/init/miscinit.c

Ban role pg_signal_backend from more superuser backend types.

commit   : 3a9b18b3095366cd0c4305441d426d04572d88c1    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2023 06:14:13 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2023 06:14:13 -0800    

Click here for diff

Documentation says it cannot signal "a backend owned by a superuser".  
On the contrary, it could signal background workers, including the  
logical replication launcher.  It could signal autovacuum workers and  
the autovacuum launcher.  Block all that.  Signaling autovacuum workers  
and those two launchers doesn't stall progress beyond what one could  
achieve other ways.  If a cluster uses a non-core extension with a  
background worker that does not auto-restart, this could create a denial  
of service with respect to that background worker.  A background worker  
with bugs in its code for responding to terminations or cancellations  
could experience those bugs at a time the pg_signal_backend member  
chooses.  Back-patch to v11 (all supported versions).  
  
Reviewed by Jelte Fennema-Nio.  Reported by Hemanth Sandrana and  
Mahendrakar Srinivasarao.  
  
Security: CVE-2023-5870  

M src/backend/storage/ipc/signalfuncs.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Add XMLText function (SQL/XML X038)

commit   : 526fe0d79914b2dfcfd79effd1ab26ff62469248    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 6 Nov 2023 09:38:29 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 6 Nov 2023 09:38:29 +0100    

Click here for diff

This function implements the standard XMLTest function, which  
converts text into xml text nodes. It uses the libxml2 function  
xmlEncodeSpecialChars to escape predefined entities (&"<>), so  
that those do not cause any conflict when concatenating the text  
node output with existing xml documents.  
  
This also adds a note in  features.sgml about not supporting  
XML(SEQUENCE). The SQL specification defines a RETURNING clause  
to a set of XML functions, where RETURNING CONTENT or RETURNING  
SEQUENCE can be defined. Since PostgreSQL doesn't support  
XML(SEQUENCE) all of these functions operate with an  
implicit RETURNING CONTENT.  
  
Author: Jim Jones <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/utils/adt/xml.c
M src/include/catalog/pg_proc.dat
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

pg_resetwal: Add more tests and test coverage

commit   : 7b5275eec3a50d55f5750357b8a223cf5f0bb59f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 09:05:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 09:05:17 +0100    

Click here for diff

pg_resetwal had poor test coverage.  There are some TAP tests, but  
they all run with -n, so they don't actually test the full  
functionality.  (There is a non-dry-run call of pg_resetwal in the  
recovery test suite, but that is incidental.)  
  
This adds a bunch of more tests to test all the different options and  
scenarios.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl

doc: pg_resetwal: Add comments how the multipliers are derived

commit   : 6ceec8a1fe7a5028b29bbfe402f645f6fea5fb90    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 08:17:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Nov 2023 08:17:54 +0100    

Click here for diff

Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pg_resetwal.sgml

Fix allocation of UniqueRelInfo

commit   : 93c85db3b5b8d8d15b10b4c66a0e6961028470d4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 6 Nov 2023 10:02:52 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 6 Nov 2023 10:02:52 +0200    

Click here for diff

Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_STsG1PKQBuvQC8W4sPo3KvML3=jOTjKLUYQuK3g8cpQ@mail.gmail.com  

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

More consistent behavior of GetDataDirectoryCreatePerm on Windows

commit   : 2c7c6c417fe655ab3fd4ca7f68ec22c913a2fe80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Nov 2023 21:59:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Nov 2023 21:59:04 +0100    

Click here for diff

On Windows, GetDataDirectoryCreatePerm() just did nothing.  The way  
the code in some callers is structured, this is the first function  
that tries to access the data directory.  So it also ends up the place  
that is responsible for reporting that a data directory does not exist  
or similar.  Therefore, on Windows, these scenarios end up on  
potentially completely different code paths.  
  
To unify this, to make testing more consistent across platforms, have  
GetDataDirectoryCreatePerm() run the stat() call on Windows as well,  
even though it won't do anything with the result.  That way, file  
system errors are reporting to callers in the same way as on  
non-Windows.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/15a59bca-0383-183c-9383-0446da9b87e1%40eisentraut.org  

M src/common/file_perm.c

Try again to fix the MSVC build

commit   : 151ffcf6d8c1a527fa3abc27b1a13c0d43be494e    
  
author   : David Rowley <[email protected]>    
date     : Sat, 4 Nov 2023 15:41:16 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 4 Nov 2023 15:41:16 +1300    

Click here for diff

My last attempt in 39c959ef2 mistakenly conditionally added the missing  
file based on some unrelated condition.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGLovvAXim9Fytn=jxks9s=JhP5=8Oyy0cbxGG-ggALJtg@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm

Fix usage of the parse tree for estimate_num_groups() in set operations

commit   : ec63622c03ff7be36d32c08aaa7d853856451488    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 4 Nov 2023 03:30:18 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 4 Nov 2023 03:30:18 +0200    

Click here for diff

recurse_set_operations() uses the parse tree for the group number estimation,  
because of the "varno 0" hack.  At the same time 2489d76c49 made root->parse  
and corresponding parent_root->simple_rte_array[]->subquery distinct copies  
of the parse tree, while d3d55ce571 introduced self-join removal replacing  
relid of removed relation only in one of the copies.  
  
The present commit fixes this bug by making recurse_set_operations() call  
estimate_num_groups() with the copy of the parse tree processed by self-join  
removal.  
  
In future, we may think about maintaining just one copy of the parse tree  
and/or keeping removed relids as aliases.  
  
Reported-by: Zuming Jiang  
Bug: #18170  
Discussion: https://postgr.es/m/flat/18170-f1d17bf9a0d58b24%40postgresql.org  
Author: Richard Guo, Alexander Korotkov  
Reviewed-by: Andrei Lepikhov  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

meson: docs: Install all manpages, not just ones in man1

commit   : a237a07d5351d7bb0afc6e0c41410d52915e47c8    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 3 Nov 2023 11:46:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 3 Nov 2023 11:46:52 -0700    

Click here for diff

In f13eb16485f I made a mistake leading to only man1 being installed. I will  
report a bug suggesting that meson warn about mistakes of this sort.  
  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the meson build was introduced  

M doc/src/sgml/meson.build

doc: move HBA reload instructions above the syntax details

commit   : d594e0daf79f9e55d5308074d1ef801e9da285ac    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 14:03:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 14:03:22 -0400    

Click here for diff

Reported-by: John <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

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

doc: \copy can get data values \. and end-of-input confused

commit   : 42d3125adae176cb7dcf7a4d896a78e615f6bbb4    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:57:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:57:59 -0400    

Click here for diff

Reported-by: Svante Richter  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

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

doc: CREATE DATABASE doesn't copy db-level perms. from template

commit   : d391f6dcc377b961628510ee7049d78032816ac0    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:39:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:39:50 -0400    

Click here for diff

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

M doc/src/sgml/manage-ag.sgml

doc: mention ORDER BY for some aggregates, add ORDER BY examples

commit   : 77513529420253626e41df967d54e76510782c64    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:05:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 13:05:27 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAKFQuwb+4SWnfrfQKB-UM1P1x97Xk+ybSar4xM32XGLd=fq9bA@mail.gmail.com  
  
Co-authored-by: David G. Johnston  
  
Backpatch-through: master  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml

Doc: update CREATE RULE ref page's hoary discussion of views.

commit   : 95a610b0970d887a4733633a14f29a537129f160    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2023 11:48:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2023 11:48:23 -0400    

Click here for diff

This text left one with the impression that an ON SELECT rule could  
be attached to a plain table, which has not been true since commit  
264c06820 (meaning the text was already misleading when written,  
evidently by me in 96bd67f61).  However, it didn't get really bad  
until b23cd185f removed the convert-a-table-to-a-view logic, which  
had made it possible for scripts that thought they were attaching  
ON SELECTs to tables to still work.  
  
Rewrite into a form that makes it clear that an ON SELECT rule  
is better regarded as an implementation detail of a view.  
Pre-v16, point out that adding ON SELECT to a table actually  
converts it to a view.  
  
Per bug #18178 from Joshua Uyehara.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_rule.sgml

doc: ALTER DEFAULT PRIVILEGES does not affect inherited roles

commit   : a8510a7d96b9d0e7f1937801f9340bd02c539b7f    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 09:51:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 3 Nov 2023 09:51:53 -0400    

Click here for diff

Reported-by: Jordi Gutiérrez Hermoso  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/ref/alter_default_privileges.sgml

Add missing unicode_category.c to MSVC build scripts

commit   : 39c959ef25bd9cdd966ee024ab14f8f4214bb276    
  
author   : David Rowley <[email protected]>    
date     : Fri, 3 Nov 2023 20:12:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 3 Nov 2023 20:12:36 +1300    

Click here for diff

Fixes MSVC build failure introduced by a02b37fc0  

M src/tools/msvc/Mkvcbuild.pm

Stabilize postgres_fdw tests on 32-bit machines

commit   : b690e5facb4fbd2600dc477cfe64415538d306cc    
  
author   : David Rowley <[email protected]>    
date     : Fri, 3 Nov 2023 12:35:37 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 3 Nov 2023 12:35:37 +1300    

Click here for diff

cac169d68 adjusted DEFAULT_FDW_TUPLE_COST and that seems to have caused  
a test to become unstable on 32-bit machines.  
  
4b14e1871 tried to fix this as originally the plan was flipping between  
a Nested Loop and Hash Join.  That commit forced the Nested Loop, but  
there's still flexibility to push or not push the sort to the remote  
server and 32-bit seems to prefer to push and on 64-bit, the costs  
prefer not to.  
  
Here let's just turn off enable_sort to significantly encourage the sort  
to take place on the remote server.  
  
Reported-by: Michael Paquier, Richard Guo  
Discussion: https://postgr.es/m/[email protected]  

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

Make GetConfigOption/GetConfigOptionResetString return "" for NULL.

commit   : 0bc726d95a305ca923b1f284159f40f0d5cf5725    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2023 11:53:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2023 11:53:36 -0400    

Click here for diff

As per the preceding commit, GUC APIs generally expose NULL-valued  
string variables as empty strings.  Extend that policy to  
GetConfigOption() and GetConfigOptionResetString(), eliminating  
a crash hazard for unwary callers, as well as a fundamental  
ambiguity in GetConfigOption()'s API.  
  
No back-patch, since this is an API change and conceivably somebody  
somewhere is depending on this corner case.  
  
Xing Guo, Aleksander Alekseev, Tom Lane  
  
Discussion: https://postgr.es/m/CACpMh+AyDx5YUpPaAgzVwC1d8zfOL4JoD-uyFDnNSa1z0EsDQQ@mail.gmail.com  

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

Be more wary about NULL values for GUC string variables.

commit   : 7704a1a72e879daaefa1742916e01505edd2ce47    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2023 11:47:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2023 11:47:33 -0400    

Click here for diff

get_explain_guc_options() crashed if a string GUC marked GUC_EXPLAIN  
has a NULL boot_val.  Nosing around found a couple of other places  
that seemed insufficiently cautious about NULL string values, although  
those are likely unreachable in practice.  Add some commentary  
defining the expectations for NULL values of string variables,  
in hopes of forestalling future additions of more such bugs.  
  
Xing Guo, Aleksander Alekseev, Tom Lane  
  
Discussion: https://postgr.es/m/CACpMh+AyDx5YUpPaAgzVwC1d8zfOL4JoD-uyFDnNSa1z0EsDQQ@mail.gmail.com  

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

Attempt to stabilize postgres_fdw tests

commit   : 4b14e18714e10ac930ca53938fc6fa1a4fda50c7    
  
author   : David Rowley <[email protected]>    
date     : Thu, 2 Nov 2023 23:16:34 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 2 Nov 2023 23:16:34 +1300    

Click here for diff

cac169d68 adjusted DEFAULT_FDW_TUPLE_COST and that seems to have caused  
a test to become unstable on 32-bit machines.  Try to make it stable  
again.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Additional unicode primitive functions.

commit   : a02b37fc083239a07f1ac02951d208235efb218b    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 1 Nov 2023 22:47:06 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 1 Nov 2023 22:47:06 -0700    

Click here for diff

Introduce unicode_version(), icu_unicode_version(), and  
unicode_assigned().  
  
The latter requires introducing a new lookup table for the Unicode  
General Category, which is generated along with the other Unicode  
lookup tables.  
  
Discussion: https://postgr.es/m/CA+TgmoYzYR-yhU6k1XFCADeyj=Oyz2PkVsa3iKv+keM8wp-F_A@mail.gmail.com  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/varlena.c
M src/common/Makefile
M src/common/meson.build
M src/common/unicode/Makefile
A src/common/unicode/category_test.c
A src/common/unicode/generate-unicode_category_table.pl
A src/common/unicode/generate-unicode_version.pl
M src/common/unicode/meson.build
M src/common/unicode/norm_test.c
A src/common/unicode_category.c
M src/include/catalog/pg_proc.dat
A src/include/common/unicode_category.h
A src/include/common/unicode_category_table.h
A src/include/common/unicode_version.h
M src/test/icu/t/010_database.pl
M src/test/regress/expected/unicode.out
M src/test/regress/sql/unicode.sql

Prevent startup of logical replication launcher during pg_upgrade

commit   : 7021d3b1766420ac4968fa0ff81873e81b7fd641    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 14:34:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 14:34:51 +0900    

Click here for diff

The logical replication launcher may start apply workers during an  
upgrade.  This could be the cause of corruptions on a new cluster if  
these are able to apply changes before the physical files are copied  
over to the new cluster.  
  
The chance of being able to do so is small as pg_upgrade uses its own  
port and unix domain directory (the latter is customizable with  
--socketdir), but just preventing the launcher to start is safer at the  
end, because we are then sure that no changes will be applied.  Like  
29d0a77fa660 for max_slot_wal_keep_size, this is only set when a cluster  
uses v17 or newer.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm2g9ZKf=y8X6z6MsLCuh8WwU-=Q6pLj35NFi2M5BZNS_A@mail.gmail.com  

M src/bin/pg_upgrade/server.c

Fix 003_check_guc.pl when loading modules with custom GUCs

commit   : 40d5e5981cc0fa81710dc2399b063a522c36fd68    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 12:38:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 12:38:05 +0900    

Click here for diff

The test missed that custom GUCs need to be ignored from the list of  
parameters that can exist in postgresql.conf.sample.  This caused the  
test to fail on a server where such a module is loaded, when using  
EXTRA_INSTALL and TEMP_CONFIG, for instance.  
  
Author: Anton A. Melnikov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/test/modules/test_misc/t/003_check_guc.pl

Increase DEFAULT_FDW_TUPLE_COST from 0.01 to 0.2

commit   : cac169d686eddb277880a0d8a760ac3007b4846a    
  
author   : David Rowley <[email protected]>    
date     : Thu, 2 Nov 2023 14:30:15 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 2 Nov 2023 14:30:15 +1300    

Click here for diff

0.01 was unrealistically low as it's the same as the default  
cpu_tuple_cost and 10x cheaper than the default parallel_tuple_cost.  
It's hard to imagine a situation where fetching a tuple from a foreign  
server would be cheaper than fetching one from a parallel worker.  
  
After some experimentation on a loopback server, somewhere between 0.15  
and 0.3 seems more realistic.  Here we split the difference and set it  
to 0.2.  
  
This will cause operations that reduce the number of tuples (e.g.  
aggregation) to be more likely to take place on the foreign server.  
  
Adjusting this causes some plan changes in the postgres_fdw regression  
tests.  This is because penalizing each Path with the additional tuple  
costs causes some dilution of the costs of the other operations being  
charged for and results in various paths appearing to be closer to the  
same costs such that add_path's STD_FUZZ_FACTOR is more likely to see two  
paths as costing (fuzzily) the same.  This isn't ideal, but it shouldn't  
be reason enough to use artificially low costs.  
  
Discussion: https://postgr.es/m/CAApHDvopVjjfh5c1Ed2HRvDdfom2dEpMwwiu5-f1AnmYprJngA@mail.gmail.com  

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

doc: Replace reference to ERRCODE_RAISE_EXCEPTION by "raise_exception"

commit   : 4210b55f598534db9d52c4535b7dcc777dda75a6    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 07:33:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Nov 2023 07:33:02 +0900    

Click here for diff

This part of the documentation refers to exceptions as handled by  
PL/pgSQL, and using the internal error code is confusing.  
  
Per thinko in 66bde49d96a9.  
  
Reported-by: Euler Taveira, Bruce Momjian  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/plpgsql.sgml

doc: add reference to wire protocol details

commit   : 783e816666c7e70bc79c10aa14dd3d56c61dd483    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 1 Nov 2023 13:57:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 1 Nov 2023 13:57:04 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Author: Li Japin  
  
Backpatch-through: master  

M doc/src/sgml/protocol.sgml

Fix function name in comment

commit   : 0f852cccd96c6dafd7d23fb4ab073df8d370eb94    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Nov 2023 11:46:30 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Nov 2023 11:46:30 +0100    

Click here for diff

The name of the function resulting from the macro expansion was  
incorrectly stated.  
  
Backpatch to 16 where it was introduced.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v16  

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

commit   : fe705ef6fc1d1b4b48aea94a1dd2835a6630dacf    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Nov 2023 14:54:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Nov 2023 14:54:13 +0900    

Click here for diff

The documentation includes a section describing how to define custom  
LWLocks in extensions using the shmem hooks.  However, it has never  
mentioned the second, more flexible method based on the following  
routines:  
- LWLockNewTrancheId() to allocate a tranche ID.  
- LWLockRegisterTranche() to associate a name to a tranche ID.  
- LWLockInitialize() to initialize a LWLock with a tranche ID.  
  
autoprewarm.c is the only example of extension in the tree that  
allocates a LWLock this way.  
  
This commit adds some documentation about all that.  While on it, a  
comment is added about the need of AddinShmemInitLock.  This is required  
especially for EXEC_BACKEND builds (aka Windows, normally), as per a  
remark from Alexander, because backends can execute shmem initialization  
paths concurrently.  
  
Author: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/CAJ7c6TPKhFgL+54cdTD9yGpG4+sNcyJ+N1GvQqAxgWENAOa3VA@mail.gmail.com  

M doc/src/sgml/xfunc.sgml

doc: add missing word to sentence about Paris

commit   : 6ec62b779907e2fa49283a7d1dbd761fb64675f1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 13:18:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 13:18:42 -0400    

Click here for diff

Reported-by: Tang <[email protected]>  
  
Discussion: https://postgr.es/m/OS0PR01MB6113393560A1DF115ADFB153FB2D9@OS0PR01MB6113.jpnprd01.prod.outlook.com  
  
Backpatch-through: master  

M doc/src/sgml/datetime.sgml

C comment: mention why no setting lasterrno in dir_existsfile()

commit   : 3fdc1d269345cac24275613f4d6b799e195d95a0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:59:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:59:14 -0400    

Click here for diff

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

M src/bin/pg_basebackup/walmethods.c

C comment: improve statistics computation comment example

commit   : b706172d22a29962c42c90f2c3c704c2a4141660    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:42:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:42:02 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAKFQuwbD672Sc0EXv0ifx3pzfQ5UAEpiAeaBGKz_Ox-4d2NGCA@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: master  

M doc/src/sgml/planstats.sgml

C comment: adjust statistics mention

commit   : 741ed2065c65b14c2edfc93c83fc8f8f5c033bfc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:02:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 11:02:04 -0400    

Click here for diff

No need to talk about the statistics collector.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Álvaro Herrera  
  
Backpatch-through: master  

M src/include/catalog/pg_statistic.h

doc: improve ALTER SYSTEM description of value list quoting

commit   : 87cf7b63c4b2e9e647cc9929051538a4f592ef3f    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 10:21:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 10:21:32 -0400    

Click here for diff

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

M doc/src/sgml/ref/alter_system.sgml

doc: improve bpchar and character type length details

commit   : b69db5173678223686e4669ab07d5ea907da2535    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 10:13:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 10:13:11 -0400    

Click here for diff

Reported-by: Jeff Davis  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Jeff Davis, adjustments by me  
  
Backpatch-through: 16  

M doc/src/sgml/datatype.sgml

doc: add function argument and query parameter limits

commit   : 4a6286fd939e84b894f074586e522b7102fc53c5    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 09:23:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 09:23:09 -0400    

Click here for diff

Also reorder entries and add commas.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwYeNPxeocV3_0+Zx=_Xwvg+sNyEMdzyG5s2E2e0hZLQhg@mail.gmail.com  
  
Author: David G. Johnston (partial)  
  
Backpatch-through: 12  

M doc/src/sgml/limits.sgml

doc: 1-byte varlena headers can be used for user PLAIN storage

commit   : 989adace3f19010f21009477afb5b50e1a4dd3c6    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 09:10:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 09:10:35 -0400    

Click here for diff

This also updates some C comments.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/167336599095.2667301.15497893107226841625@wrigleys.postgresql.org  
  
Author: Laurenz Albe (doc patch)  
  
Backpatch-through: 11  

M doc/src/sgml/storage.sgml
M src/backend/access/common/heaptuple.c
M src/backend/utils/adt/rangetypes.c

improve alignment of postgresql.conf comments

commit   : 75e700db45141d073e671f7c7b4aacee1ebc629a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 08:51:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Oct 2023 08:51:12 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAHut+Ps5MdQ1b4jp9rd63zfE2X25mV58y1W+hm2v53svtGDxBQ@mail.gmail.com  
  
Author: Peter Smith  
  
Backpatch-through: master  

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

Adjust the order of the prechecks in pgrowlocks()

commit   : 73635b6d63b5e12ea5f8b44a0154440654819820    
  
author   : David Rowley <[email protected]>    
date     : Tue, 31 Oct 2023 16:42:08 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 31 Oct 2023 16:42:08 +1300    

Click here for diff

4b8266415 added a precheck to pgrowlocks() to ensure the given object's  
pg_class.relam is HEAP_TABLE_AM_OID, however, that check was put before  
another check which was checking if the given object was a partitioned  
table.  Since the pg_class.relam is always InvalidOid for partitioned  
tables, if pgrowlocks() was called passing a partitioned table, then the  
"only heap AM is supported" error would be raised instead of the intended  
error about the given object being a partitioned table.  
  
Here we simply move the pg_class.relam check to after the check that  
verifies that we are in fact working with a normal (non-partitioned)  
table.  
  
Reported-by: jian he  
Discussion: https://postgr.es/m/CACJufxFaSp_WguFCf0X98951zFVX+dXFnF1mxAb-G3g1HiHOow@mail.gmail.com  
Backpatch-through: 12, where 4b8266415 was introduced.  

M contrib/pgrowlocks/pgrowlocks.c

Diagnose !indisvalid in more SQL functions.

commit   : 13503eb5905b51d22d86a3c2065c241a61cedd44    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 30 Oct 2023 14:46:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 30 Oct 2023 14:46:05 -0700    

Click here for diff

pgstatindex failed with ERRCODE_DATA_CORRUPTED, of the "can't-happen"  
class XX.  The other functions succeeded on an empty index; they might  
have malfunctioned if the failed index build left torn I/O or other  
complex state.  Report an ERROR in statistics functions pgstatindex,  
pgstatginindex, pgstathashindex, and pgstattuple.  Report DEBUG1 and  
skip all index I/O in maintenance functions brin_desummarize_range,  
brin_summarize_new_values, brin_summarize_range, and  
gin_clean_pending_list.  Back-patch to v11 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginfast.c

amcheck: Distinguish interrupted page deletion from corruption.

commit   : 6ec9e9975eff5260651d84ed8bcfd8ecb08e5fbb    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 30 Oct 2023 14:46:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 30 Oct 2023 14:46:05 -0700    

Click here for diff

This prevents false-positive reports about "the first child of leftmost  
target page is not leftmost of its level", "block %u is not leftmost"  
and "left link/right link pair".  They appeared if amcheck ran before  
VACUUM cleaned things, after a cluster exited recovery between the  
first-stage and second-stage WAL records of a deletion.  Back-patch to  
v11 (all supported versions).  
  
Reviewed by Peter Geoghegan.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/Makefile
M contrib/amcheck/meson.build
A contrib/amcheck/t/005_pitr.pl
M contrib/amcheck/verify_nbtree.c

pgindent run to fix commits de64268561 and 5ae2087202a

commit   : 56b30e266eaa74f38bdda45067c9a5a63cd24c75    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 30 Oct 2023 14:52:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 30 Oct 2023 14:52:35 -0400    

Click here for diff

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

M src/backend/postmaster/postmaster.c
M src/bin/pg_amcheck/pg_amcheck.c

Fill in more of ObjectProperty

commit   : 0c60e8ba80e03491b028204a19a9dca6d216df91    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Oct 2023 06:08:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Oct 2023 06:08:53 -0400    

Click here for diff

Fill in .objtype field where an appropriate value exists.  
  
These cases are currently not used (see also comments at  
get_object_type()), but we might as well fill in what's possible in  
case additional uses arise.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/objectaddress.c

Add STREAM_START/STREAM_STOP for transactional messages during decoding.

commit   : 57891c256c345451b91ddb67a8e2a9c5eca9ae1c    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Oct 2023 14:36:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Oct 2023 14:36:21 +0530    

Click here for diff

In test_decoding module, when skip_empty_xacts option was specified, add  
stream_start/stop for streaming transactional messages. This makes the  
handling of transactional messages stream consistent irrespective of  
whether skip_empty_xacts option was specified.  
  
Commit 26dd0284b9 made a similar change for non-streaming messages but  
forgot to update the streaming cases.  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila  
Discussion: http://postgr.es/m/OS0PR01MB5716AEBD2988F8F5E9D5985794DFA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M contrib/test_decoding/expected/stream.out
M contrib/test_decoding/expected/twophase_stream.out
M contrib/test_decoding/test_decoding.c

Fix indentation in contrib/amcheck/verify_nbtree.c

commit   : 675fed4df5db4e78d40a0ce9cb785cfba9fa480f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 30 Oct 2023 10:34:15 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 30 Oct 2023 10:34:15 +0200    

Click here for diff

Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/ZT9YoDPEQBUMrIHg%40paquier.xyz  

M contrib/amcheck/verify_nbtree.c

Expand regression tests for pg_stat_reset_shared()

commit   : 5b2147d9fcc1f3d09701c548ebebf55cad0d403d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 17:19:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 17:19:24 +0900    

Click here for diff

This commit adds coverage for the stats reset of recovery_prefetch, and  
for the case where an invalid value is given in input of the function.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACW9Uk7x61oSix9qK0xR4Jhy3cgg6pobQ-Q3GNsUbFrn8A@mail.gmail.com  

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

Delay recovery mode LOG after reading backup_label and/or checkpoint record

commit   : dc5bd38894373e6806289e3aca26e7fafa5f6f95    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 15:28:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 15:28:20 +0900    

Click here for diff

When beginning recovery, a LOG is displayed by the startup process to  
show which recovery mode will be used depending on the .signal file(s)  
set in the data folder, like "standby mode", recovery up to a given  
target type and value, or archive recovery.  
  
A different patch is under discussion to simplify the startup code by  
requiring the presence of recovery.signal and/or standby.signal when a  
backup_label file is read.  Delaying a bit this LOG ensures that the  
correct recovery mode would be reported, and putting it at this position  
does not make it lose its value.  
  
While on it, this commit adds a few comments documenting a bit more the  
initial recovery steps and their dependencies, and fixes an incorrect  
comment format.  This introduces no behavior changes.  
  
Extracted from a larger patch by me.  
  
Reviewed-by: David Steele, Bowen Shi  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : c4ede4fdfb9c7c3480a8139ac706498ffcf35fb6    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Oct 2023 10:46:31 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Oct 2023 10:46:31 +0530    

Click here for diff

Commit 536f410111 added links in the ALTER SUBSCRIPTION command page. The  
link names used were slightly different from what other logical  
replication commands like CREATE SUBSCRIPTION/PUBLICATION have but were  
consistent with other docs. This patch changes the link names for all the  
parameters to have 'params' word in the CREATE SUBSCRIPTION/PUBLICATION  
pages.  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila  
Discussion: http://postgr.es/m/CAHut%2BPu2S4RdzYKR7H5_E7QYWyq5hB0hL4EFrYbP91Qso62jeg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/system-views.sgml

Mention standby.signal in FATALs for checkpoint record missing at recovery

commit   : 1ffdc03c21ae78981b93297ae977841b59793eb7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 13:56:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 13:56:02 +0900    

Click here for diff

When beginning recovery from a base backup by reading a backup_label  
file, it may be possible that no checkpoint record is available  
depending on the method used when the case backup was taken, which would  
prevent recovery from beginning.  In this case, the FATAL messages  
issued, initially added by c900c15269f0f, mentioned recovery.signal as  
an option to do recovery but not standby.signal.  Let's add it as an  
available option, for clarity.  
  
Per suggestion from Bowen Shi, extracted from a larger patch by me.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CAM_vCudkSjr7NsNKSdjwtfAm9dbzepY6beZ5DP177POKy8=2aw@mail.gmail.com  

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

Introduce pg_stat_checkpointer

commit   : 96f052613f35d07d001c8dd2f284ca8d95f82d1b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 09:47:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 09:47:16 +0900    

Click here for diff

Historically, the statistics of the checkpointer have been always part  
of pg_stat_bgwriter.  This commit removes a few columns from  
pg_stat_bgwriter, and introduces pg_stat_checkpointer with equivalent,  
renamed columns (plus a new one for the reset timestamp):  
- checkpoints_timed -> num_timed  
- checkpoints_req -> num_requested  
- checkpoint_write_time -> write_time  
- checkpoint_sync_time -> sync_time  
- buffers_checkpoint -> buffers_written  
  
The fields of PgStat_CheckpointerStats and its SQL functions are renamed  
to match with the new field names, for consistency.  Note that  
background writer and checkpointer have been split into two different  
processes in commits 806a2aee3791 and bf405ba8e460.  The pgstat  
structures were already split, making this change straight-forward.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACVxX2ii=66RypXRweZe2EsBRiPMj0aHfRfHUeXJcC7kHg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/checkpointer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/recovery/t/029_stats_restart.pl
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

commit   : bf01e1ba963aed17449c70fed03c4ae74cce3926    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 08:23:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Oct 2023 08:23:39 +0900    

Click here for diff

This commit refactors find_tabstat_entry() so as transaction counters  
for inserted, updated and deleted tuples are included in the result  
returned.   If a shared entry is found for a relation, its result is now  
a copy of the PgStat_TableStatus entry retrieved from shared memory.  
This idea has been proposed by Andres Freund.  
  
While on it, the following SQL functions, used in system views, are  
refactored with macros, in the same spirit as 83a1a1b56645, reducing the  
amount of code:  
- pg_stat_get_xact_tuples_deleted()  
- pg_stat_get_xact_tuples_inserted()  
- pg_stat_get_xact_tuples_updated()  
  
There is now only one caller of find_tabstat_entry() in the tree.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Fix instable 006_login_trigger.pl test

commit   : 06be01eb266bdb24efd931ad10ee6a1de26271b4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 30 Oct 2023 01:23:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 30 Oct 2023 01:23:53 +0300    

Click here for diff

Handling of login trigger FATAL error could cause a timing-dependant panic of  
IPC::Run.  This commit excludes checks which involves handling of such errors.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/2268825.1698618066%40sss.pgh.pa.us  

M src/test/authentication/t/006_login_trigger.pl

Teach pg_dump about the new pg_subscription.subrunasowner option.

commit   : 5ba4cc309095eb1a947961e66b9c5156efc8ffca    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Oct 2023 12:56:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Oct 2023 12:56:24 -0400    

Click here for diff

Among numerous other oversights, commit 482675987 neglected to fix  
pg_dump to dump this new subscription option.  Since the new default  
is "false" while the previous behavior corresponds to "true", this  
would cause legacy subscriptions to silently change behavior during  
dump/reload or pg_upgrade.  That seems like a bad idea.  Even if it  
was intended, failing to preserve the option once set in a new  
installation is certainly not OK.  
  
While here, reorder associated stanzas in pg_dump to match the  
field order in pg_subscription, in hopes of reducing the impression  
that all this code was written with the aid of a dartboard.  
  
Back-patch to v16 where this new field was added.  
  
Philip Warner (cosmetic tweaks by me)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Guard against overflow in make_interval().

commit   : b2d55447a563036579d6777f64a7483dceeab6ea    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 29 Oct 2023 15:46:04 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 29 Oct 2023 15:46:04 +0000    

Click here for diff

The original code did very little to guard against integer or floating  
point overflow when computing the interval's fields.  Detect any such  
overflows and error out, rather than silently returning bogus results.  
  
Joseph Koshakow, reviewed by Ashutosh Bapat and me.  
  
Discussion: https://postgr.es/m/CAAvxfHcm1TPwH_zaGWuFoL8pZBestbRZTU6Z%3D-RvAdSXTPbKfg%40mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/include/datatype/timestamp.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

btree_gin: Fix calculation of leftmost interval value.

commit   : 849172ff4883d44168f96f39d3fde96d0aa34c99    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 29 Oct 2023 11:14:37 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 29 Oct 2023 11:14:37 +0000    

Click here for diff

Formerly, the value computed by leftmostvalue_interval() was a long  
way short of the minimum possible interval value.  As a result, an  
index scan on a GIN index on an interval column with < or <= operators  
would miss large negative interval values.  
  
Fix by setting all fields of the leftmost interval to their minimum  
values, ensuring that the result is less than any other possible  
interval.  Since this only affects index searches, no index rebuild is  
necessary.  
  
Back-patch to all supported branches.  
  
Dean Rasheed, reviewed by Heikki Linnakangas.  
  
Discussion: https://postgr.es/m/CAEZATCV80%2BgOfF8ehNUUfaKBZgZMDfCfL-g1HhWGb6kC3rpDfw%40mail.gmail.com  

M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/expected/interval.out
M contrib/btree_gin/sql/interval.sql

Fix intra-query memory leak when a SRF returns zero rows.

commit   : 237f8765dfd9149471d37f3754d15cef888338a8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2023 14:04:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2023 14:04:42 -0400    

Click here for diff

When looping around after finding that the set-returning function  
returned zero rows for the current input tuple, ExecProjectSet  
neglected to reset either of the two memory contexts it's  
responsible for cleaning out.  Typically this wouldn't cause much  
problem, because once the SRF does return at least one row, the  
contexts would get reset on the next call.  However, if the SRF  
returns no rows for many input tuples in succession, quite a lot  
of memory could be transiently consumed.  
  
To fix, make sure we reset both contexts while looping around.  
  
Per bug #18172 from Sergei Kornilov.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeProjectSet.c

commit   : 4d42b4edc6def25cab63894a2d351d597606492d    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Oct 2023 14:02:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Oct 2023 14:02:46 -0400    

Click here for diff

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

M doc/src/sgml/intro.sgml

doc: comment wording improvement

commit   : de64268561606b62e69e81b9c07ac2eab93c85ea    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Oct 2023 12:58:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Oct 2023 12:58:32 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAEG8a3L7UoZXH1VmzpV-VDkex2kt68nWKuW1WiohoT=RrzYKWA@mail.gmail.com  
  
Author: Junwang Zhao  
  
Backpatch-through: master  

M src/backend/postmaster/postmaster.c

Remove PHOT from our default timezone abbreviations list.

commit   : 5fd3e06f6ad1035da71124a79208242cd915ba2e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2023 11:54:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2023 11:54:40 -0400    

Click here for diff

Debian recently decided to split out a bunch of "obsolete" timezone  
names into a new tzdata-legacy package, which isn't installed by  
default.  One of these zone names is Pacific/Enderbury, and that  
breaks our regression tests (on --with-system-tzdata builds)  
because our default timezone abbreviations list defines PHOT as  
Pacific/Enderbury.  
  
Pacific/Enderbury got renamed to Pacific/Kanton in tzdata 2021b,  
so that in distros that still have this entry it's just a symlink  
to Pacific/Kanton anyway.  So one answer would be to redefine PHOT  
as Pacific/Kanton.  However, then things would fail if the  
installed tzdata predates 2021b, which is recent enough that that  
seems like a real problem.  
  
Instead, let's just remove PHOT from the default list.  That seems  
likely to affect nobody in the real world, because (a) it was an  
abbreviation that the tzdb crew made up in the first place, with  
no evidence of real-world usage, and (b) the total human population  
of the Phoenix Islands is less than two dozen persons, per Wikipedia.  
If anyone does use this zone abbreviation they can easily put it back  
via a custom abbreviations file.  
  
We'll keep PHOT in the Pacific.txt reference file, but change it  
to Pacific/Kanton there, as that definition seems more likely to  
be useful to future readers of that file.  
  
Per report from Victor Wagner.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Allow relkind 'I' in type_sanity test.

commit   : 4b9fbd6be442cf36910fb34308e0edfd43f2dbdf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2023 21:50:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2023 21:50:44 -0400    

Click here for diff

This is cosmetic at present, since no partitioned indexes have  
been created yet at the stage of the regression tests when  
type_sanity runs.  But it's confusing that this list of allowed  
values doesn't match reality, so fix it.  
  
Noted by Jian He.  
  
Discussion: https://postgr.es/m/CACJufxHhr58q-YoBeqnY5P-u8Xe2X5sMtsr3LYE1nQDwdqjB4w@mail.gmail.com  

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

doc: improve text around consistency of statistics values

commit   : 05ce730978c9ee2d48599ffeaada98f69bd3be42    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 21:24:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 21:24:55 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAKFQuwZ4CXtTyR19vFbd9WwmW-4BvgAenmF2CfUpx0LWwRPGYg@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: master  

M doc/src/sgml/maintenance.sgml

doc: improve config syncfs wording

commit   : eb544d7fd966ce8718573ffeb17dfe6d0952e642    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 21:11:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 21:11:48 -0400    

Click here for diff

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

M doc/src/sgml/config.sgml

Clarify the result order of unnest(multirange).

commit   : d014e6cb188664d053cbed87130416617226b373    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 27 Oct 2023 15:21:42 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 27 Oct 2023 15:21:42 -0700    

Click here for diff

It is best not to mention the storage order, because that is  
an implementation detail and has confused at least one user,  
who assumed that the storage order is the order in which the  
constituent ranges were written in SQL.  
  
Since the sorting order is explained at the beginning of the  
page, it should be sufficient to say that the ranges are  
returned in ascending order.  
  
Author: Laurenz Albe  
Reviewed-by: Daniel Fredouille  
Discussion: https://postgr.es/m/169627213477.3727338.17653654241633692682%40wrigleys.postgresql.org  

M doc/src/sgml/func.sgml

commit   : 12cf3ac7f328ac439a8eca2bfb7771fb6a4f3aa3    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 19:05:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 19:05:25 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAEG8a3LZHTR5S+OPZCbZvECwsqdbx=pBRFZZyDjKaAtgoALOQQ@mail.gmail.com  
  
Author: Junwang Zhao  
  
Backpatch-through: master  

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

doc: wording improvements

commit   : a978565ffcec3ea31c0827fe1dcc524163bdbdfa    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 17:23:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 17:23:09 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Author: Ekaterina Kiryanova  
  
Backpatch-through: master  

M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/pgbench.sgml

Teach contrib/amcheck to check the unique constraint violation

commit   : 5ae2087202af9fd804c8b8d76954bdd8bdf31e51    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 28 Oct 2023 00:21:23 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 28 Oct 2023 00:21:23 +0300    

Click here for diff

Add the 'checkunique' argument to bt_index_check() and bt_index_parent_check().  
When the flag is specified the procedures will check the unique constraint  
violation for unique indexes.  Only one heap entry for all equal keys in  
the index should be visible (including posting list entries).  Report an error  
otherwise.  
  
pg_amcheck called with the --checkunique option will do the same check for all  
the indexes it checks.  
  
Author: Anastasia Lubennikova <[email protected]>  
Author: Pavel Borisov <[email protected]>  
Author: Maxim Orlov <[email protected]>  
Reviewed-by: Mark Dilger <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://postgr.es/m/CALT9ZEHRn5xAM5boga0qnrCmPV52bScEK2QnQ1HmUZDD301JEg%40mail.gmail.com  

M contrib/amcheck/Makefile
A contrib/amcheck/amcheck–1.3–1.4.sql
M contrib/amcheck/amcheck.control
M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/meson.build
M contrib/amcheck/sql/check_btree.sql
A contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/ref/pg_amcheck.sgml
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl

Split event_trigger_login test from event_trigger test

commit   : 8b62b441fffd26f0bfaa5bed2c11898ed1345f62    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 23:50:07 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 23:50:07 +0300    

Click here for diff

That allows to still run event_trigger test in parallel with oidjoins test,  
and save ~50ms of tests runtime.  
  
Discussion: https://postgr.es/m/202310271047.mnwkql6nhbwi%40alvherre.pgsql  
Author: Alvaro Herrera, Alexander Korotkov  

M src/test/regress/expected/event_trigger.out
A src/test/regress/expected/event_trigger_login.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/event_trigger.sql
A src/test/regress/sql/event_trigger_login.sql

Fix minmax-multi distance for extreme interval values

commit   : c6cf6d353c2865d82356ac86358622a101fde8ca    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:44 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:44 +0200    

Click here for diff

When calculating distance for interval values, the code mostly mimicked  
interval_mi, i.e. it built a new interval value for the difference.  
That however does not work for sufficiently distant interval values,  
when the difference overflows the interval range.  
  
Instead, we can calculate the distance directly, without constructing  
the intermediate (and unnecessary) interval value.  
  
Backpatch to 14, where minmax-multi indexes were introduced.  
  
Reported-by: Dean Rasheed  
Reviewed-by: Ashutosh Bapat, Dean Rasheed  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

Fix minmax-multi on infinite date/timestamp values

commit   : 8da86d62a11269e926765c0d6ef6f532b2b8b749    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:28 +0200    

Click here for diff

Make sure that infinite values in date/timestamp columns are treated as  
if in infinite distance. Infinite values should not be merged with other  
values, leaving them as outliers. The code however returned distance 0  
in this case, so that infinite values were merged first. While this does  
not break the index (i.e. it still produces correct query results), it  
may make it much less efficient.  
  
We don't need explicit handling of infinite date/timestamp values when  
calculating distances, because those values are represented as extreme  
but regular values (e.g. INT64_MIN/MAX for the timestamp type).  
  
We don't need an exact distance, just a value that is much larger than  
distanced between regular values. With the added cast to double values,  
we can simply subtract the values.  
  
The regression test queries a value in the "gap" and checks the range  
was properly eliminated by the BRIN index.  
  
This only affects minmax-multi indexes on timestamp/date columns with  
infinite values, which is not very common in practice. The affected  
indexes may need to be rebuilt.  
  
Backpatch to 14, where minmax-multi indexes were introduced.  
  
Reported-by: Ashutosh Bapat  
Reviewed-by: Ashutosh Bapat, Dean Rasheed  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

Fix calculation in brin_minmax_multi_distance_date

commit   : 394d51731495794655f95b5580adb757d7a9bbe2    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:57:11 +0200    

Click here for diff

When calculating the distance between date values, make sure to subtract  
them in the right order, i.e. (larger - smaller).  
  
The distance is used to determine which values to merge, and is expected  
to be a positive value. The code unfortunately did the subtraction in  
the opposite order, i.e. (smaller - larger), thus producing negative  
values and merging values the most distant values first.  
  
The resulting index is correct (i.e. produces correct results), but may  
be significantly less efficient. This affects all minmax-multi indexes  
on date columns.  
  
Backpatch to 14, where minmax-multi indexes were introduced.  
  
Reported-by: Ashutosh Bapat  
Reviewed-by: Ashutosh Bapat, Dean Rasheed  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

Fix overflow when calculating timestamp distance in BRIN

commit   : b5489b75c6ce9517ab5f9d6f1d98bc928f6d5bd5    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:56:27 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 27 Oct 2023 17:56:27 +0200    

Click here for diff

When calculating distances for timestamp values for BRIN minmax-multi  
indexes, we need to be careful about overflows for extreme values. If  
the value overflows into a negative value, the index may be inefficient.  
  
The new regression test checks this for the timestamp type by adding a  
table with enough values to force range compaction/merging. The values  
are close to min/max, which means a risk of overflow.  
  
Fixed by converting the int64 values to double first, before calculating  
the distance. This prevents the overflow. We may lose some precision, of  
course, but that's good enough. In the worst case we build a slightly  
less efficient index, but for large distances this won't matter.  
  
This only affects minmax-multi indexes on timestamp columns, with ranges  
containing values sufficiently distant to cause an overflow. That seems  
like a fairly rare case in practice.  
  
Backpatch to 14, where minmax-multi indexes were introduced.  
  
Reported-by: Ashutosh Bapat  
Reviewed-by: Ashutosh Bapat, Dean Rasheed  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

doc: clarify logical decoding's deadlock of system tables

commit   : 16ace6f7452a968f2b5b058ccccd75db4c56ef34    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 11:35:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 11:35:47 -0400    

Click here for diff

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

M doc/src/sgml/logicaldecoding.sgml

|--- gitweb subject length limit ----------------|-email limit-| doc: fix first-person wording

commit   : 1ce00efe3cdba28882e2c7f93b4ec0aa67d9ad94    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 11:05:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Oct 2023 11:05:47 -0400    

Click here for diff

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

M doc/src/sgml/oid2name.sgml

Adjust parallel_schedule with event triggers on authenticated login

commit   : 83510534d5f3f116efa035639b9b62b8c6c4df34    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 11:30:39 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 11:30:39 +0300    

Click here for diff

Event triggers on authenticated login could catch the connection of the  
concurrent test.  In order to prevent this side effect we need to run  
the event_trigger test alone.  
  
Discussion: https://postgr.es/m/flat/CAMEv5_sS5G7K1PCV2oBx5+1NF1ZneJ6C5Z_xV_SWsZMukdFZiA@mail.gmail.com  
Author: Mikhail A. Gribkov  
Reviewed-by: Aleksander Alekseev  

M src/test/regress/parallel_schedule

Commit b195e6d482 forgot to update meson.build.

commit   : 8949b978ff49a9b72455545e9bf08f4313a1bb92    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 27 Oct 2023 13:19:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 27 Oct 2023 13:19:49 +0530    

Click here for diff

Author: Hayato Kuroda  
Discussion: http://postgr.es/m/TYCPR01MB58701BA358D80073ED1BD528F5DCA@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/meson.build

Use shorter file names in the upgrade logical slots test.

commit   : b195e6d482b8424827c7371bf34b48dacc37994e    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 27 Oct 2023 11:09:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 27 Oct 2023 11:09:45 +0530    

Click here for diff

The longer file names exceeded the Windows path limit on buildfarm animal  
fairywren.  
  
Diagnosed-by: Hou Zhijie  
Author: Hayato Kuroda  
Reviewed-by: Bharath Rupireddy  
Discussion: http://postgr.es/m/OS0PR01MB57160DF709ACD02248DB830C94DDA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/check.c
R070 src/bin/pg_upgrade/t/003_upgrade_logical_replication_slots.pl src/bin/pg_upgrade/t/003_logical_slots.pl

Make UniqueRelInfo a node

commit   : 2b26a6945545366ef0ed57b6d47ffaa337d5d56b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 05:29:48 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 27 Oct 2023 05:29:48 +0300    

Click here for diff

d3d55ce571 changed RelOptInfo.unique_for_rels from the list of Relid sets to  
the list of UniqueRelInfo's.  But it didn't make UniqueRelInfo a node.  
This commit makes UniqueRelInfo a node.  Also this commit revises some  
comments related to RelOptInfo.unique_for_rels.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/flat/1189851.1698340331%40sss.pgh.pa.us  

M src/backend/optimizer/plan/analyzejoins.c
M src/include/nodes/pathnodes.h

Remove buffers_backend and buffers_backend_fsync from pg_stat_checkpointer

commit   : 74604a37f2f9eb6e626a4ff3cedd02aef5a2ad59    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Oct 2023 11:16:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Oct 2023 11:16:39 +0900    

Click here for diff

Two attributes related to checkpointer statistics are removed in this  
commit:  
- buffers_backend, that counts the number of buffers written directly by  
a backend.  
- buffers_backend_fsync, that counts the number of times a backend had  
to do fsync() by its own.  
  
These are actually not checkpointer properties but backend properties.  
Also, pg_stat_io provides a more accurate and equivalent report of these  
numbers, by tracking all the I/O stats related to backends, including  
writes and fsyncs, so storing them in pg_stat_checkpointer was  
redundant.  
  
Thanks also to Robert Haas and Amit Kapila for their input.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/checkpointer.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Optimize various aggregate deserialization functions, take 2

commit   : 0c882a298881056176a27ccc44c5c3bb7c8f308c    
  
author   : David Rowley <[email protected]>    
date     : Fri, 27 Oct 2023 10:41:55 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 27 Oct 2023 10:41:55 +1300    

Click here for diff

f0efa5aec added initReadOnlyStringInfo to allow a StringInfo to be  
initialized from an existing buffer and also relaxed the requirement  
that a StringInfo's buffer must be NUL terminated at data[len].  Now  
that we have that, there's no need for these aggregate deserial  
functions to use appendBinaryStringInfo() as that rather wastefully  
palloc'd a new buffer and memcpy'd in the bytea's buffer.  Instead, we can  
just use the bytea's buffer and point the StringInfo directly to that  
using the new initializer function.  
  
In Amdahl's law, this speeds up the serial portion of parallel  
aggregates and makes sum(numeric), avg(numeric), var_pop(numeric),  
var_samp(numeric), variance(numeric), stddev_pop(numeric),  
stddev_samp(numeric), stddev(numeric), array_agg(anyarray),  
string_agg(text) and string_agg(bytea) scale better in parallel queries.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvr%3De-YOigriSHHm324a40HPqcUhSp6pWWgjz5WwegR%3DcQ%40mail.gmail.com  

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

Add "Add trailing commas to enum definitions" to .git-blame-ignore-revs

commit   : 26f988212eada9c586223cbbf876c7eb455044d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2023 13:03:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2023 13:03:43 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/386f8c45-c8ac-4681-8add-e3b0852c1620%40eisentraut.org  

M .git-blame-ignore-revs

Avoid compiler warning in non-assert builds

commit   : 1f06b7fc6e2bc505bea046ca54a4555ca835d7c9    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 26 Oct 2023 17:12:24 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 26 Oct 2023 17:12:24 +0900    

Click here for diff

After 01575ad788e3, expand_single_inheritance_child()'s parentOID  
variable is read only in an Assert, provoking a compiler warning in  
non-assert builds.  Fix that by marking the variable with  
PG_USED_FOR_ASSERTS_ONLY.  
  
Per report and suggestion from David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvpjA_8Wxu4DCTRVAvPxC9atwMe6N%2ByvrcGsgb7mrfdpJA%40mail.gmail.com  

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

Add trailing commas to enum definitions

commit   : 611806cd726fc92989ac918eac48fd8d684869c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2023 09:16:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2023 09:16:25 +0200    

Click here for diff

Since C99, there can be a trailing comma after the last value in an  
enum definition.  A lot of new code has been introducing this style on  
the fly.  Some new patches are now taking an inconsistent approach to  
this.  Some add the last comma on the fly if they add a new last  
value, some are trying to preserve the existing style in each place,  
some are even dropping the last comma if there was one.  We could  
nudge this all in a consistent direction if we just add the trailing  
commas everywhere once.  
  
I omitted a few places where there was a fixed "last" value that will  
always stay last.  I also skipped the header files of libpq and ecpg,  
in case people want to use those with older compilers.  There were  
also a small number of cases where the enum type wasn't used anywhere  
(but the enum values were), which ended up confusing pgindent a bit,  
so I left those alone.  
  
Discussion: https://www.postgresql.org/message-id/flat/386f8c45-c8ac-4681-8add-e3b0852c1620%40eisentraut.org  

M contrib/amcheck/verify_heapam.c
M contrib/btree_gist/btree_gist.h
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pgcrypto/pgp.h
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/vacuumlo/vacuumlo.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/async.c
M src/backend/commands/copyto.c
M src/backend/commands/dbcommands.c
M src/backend/commands/user.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execIndexing.c
M src/backend/executor/functions.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/libpq/auth-scram.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_func.c
M src/backend/partitioning/partprune.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/regex/regc_pg_locale.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walreceiver.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_rewind/filemap.h
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/jsonapi.c
M src/include/access/amapi.h
M src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/heapam.h
M src/include/access/multixact.h
M src/include/access/reloptions.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/tableam.h
M src/include/access/toast_compression.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogutils.h
M src/include/backup/backup_manifest.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/pg_cast.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_init_privs.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/explain.h
M src/include/common/checksum_helper.h
M src/include/common/compression.h
M src/include/common/cryptohash.h
M src/include/common/file_utils.h
M src/include/common/jsonapi.h
M src/include/common/relpath.h
M src/include/common/saslprep.h
M src/include/executor/hashjoin.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fmgr.h
M src/include/funcapi.h
M src/include/libpq/crypt.h
M src/include/libpq/hba.h
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/lockoptions.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/queryjumble.h
M src/include/nodes/replnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/paths.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_func.h
M src/include/parser/parser.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/replication/logicalproto.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/rewriteManip.h
M src/include/storage/bufmgr.h
M src/include/storage/dsm_impl.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate_internals.h
M src/include/storage/procsignal.h
M src/include/storage/shm_mq.h
M src/include/storage/sync.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/bytea.h
M src/include/utils/elog.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hsearch.h
M src/include/utils/jsonb.h
M src/include/utils/lsyscache.h
M src/include/utils/memutils_internal.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/resowner.h
M src/include/utils/rls.h
M src/include/utils/snapshot.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/tuplesort.h
M src/include/utils/wait_event.h
M src/include/utils/xml.h
M src/interfaces/libpq/fe-auth-scram.c
M src/pl/plpgsql/src/plpgsql.h
M src/port/path.c
M src/test/isolation/isolationtester.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/regress/pg_regress.c
M src/timezone/localtime.c

Introduce the concept of read-only StringInfos

commit   : f0efa5aec19358e2282d4968a03db1db56f0ac3f    
  
author   : David Rowley <[email protected]>    
date     : Thu, 26 Oct 2023 16:31:48 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 26 Oct 2023 16:31:48 +1300    

Click here for diff

There were various places in our codebase which conjured up a StringInfo  
by manually assigning the StringInfo fields and setting the data field  
to point to some existing buffer.  There wasn't much consistency here as  
to what fields like maxlen got set to and in one location we didn't  
correctly ensure that the buffer was correctly NUL terminated at len  
bytes, as per what was documented as required in stringinfo.h  
  
Here we introduce 2 new functions to initialize StringInfos.  One allows  
callers to initialize a StringInfo passing along a buffer that is  
already allocated by palloc.  Here the StringInfo code uses this buffer  
directly rather than doing any memcpying into a new allocation.  Having  
this as a function allows us to verify the buffer is correctly NUL  
terminated.  StringInfos initialized this way can be appended to and  
reset just like any other normal StringInfo.  
  
The other new initialization function also accepts an existing buffer,  
but the given buffer does not need to be a pointer to a palloc'd chunk.  
This buffer could be a pointer pointing partway into some palloc'd chunk  
or may not even be palloc'd at all.  StringInfos initialized this way  
are deemed as "read-only".  This means that it's not possible to  
append to them or reset them.  
  
For the latter of the two new initialization functions mentioned above,  
we relax the requirement that the data buffer must be NUL terminated.  
Relaxing this requirement is convenient in a few places as it can save  
us from having to allocate an entire new buffer just to add the NUL  
terminator or save us from having to temporarily add a NUL only to have to  
put the original char back again later.  
  
Incompatibility note:  
  
Here we also forego adding the NUL in a few places where it does not  
seem to be required.  These locations are passing the given StringInfo  
into a type's receive function.  It does not seem like any of our  
built-in receive functions require this, but perhaps there's some UDT  
out there in the wild which does require this.  It is likely worthy of  
a mention in the release notes that a UDT's receive function mustn't rely  
on the input StringInfo being NUL terminated.  
  
Author: David Rowley  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAApHDvorfO3iBZ%3DxpiZvp3uHtJVLyFaPBSvcAhAq2HPLnaNSwQ%40mail.gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/rowtypes.c
M src/common/stringinfo.c
M src/include/lib/stringinfo.h

Prevent duplicate RTEPermissionInfo for plain-inheritance parents

commit   : 01575ad788e3d3e67b641d43802c8b7bf126a1a3    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 26 Oct 2023 11:53:56 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 26 Oct 2023 11:53:56 +0900    

Click here for diff

Currently, expand_single_inheritance_child() doesn't reset  
perminfoindex in a plain-inheritance parent's child RTE, because  
prior to 387f9ed0a0, the executor would use the first child RTE to  
locate the parent's RTEPermissionInfo.  That in turn causes  
add_rte_to_flat_rtable() to create an extra RTEPermissionInfo  
belonging to the parent's child RTE with the same content as the one  
belonging to the parent's original ("root") RTE.  
  
In 387f9ed0a0, we changed things so that the executor can now use the  
parent's "root" RTE for locating its RTEPermissionInfo instead of the  
child RTE, so the latter's perminfoindex need not be set anymore, so  
make it so.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Migrate logical slots to the new node during an upgrade.

commit   : 29d0a77fa6606f9c01ba17311fc452dabd3f793d    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 26 Oct 2023 06:54:16 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 26 Oct 2023 06:54:16 +0530    

Click here for diff

While reading information from the old cluster, a list of logical  
slots is fetched. At the later part of upgrading, pg_upgrade revisits the  
list and restores slots by executing pg_create_logical_replication_slot()  
on the new cluster. Migration of logical replication slots is only  
supported when the old cluster is version 17.0 or later.  
  
If the old node has invalid slots or slots with unconsumed WAL records,  
the pg_upgrade fails. These checks are needed to prevent data loss.  
  
The significant advantage of this commit is that it makes it easy to  
continue logical replication even after upgrading the publisher node.  
Previously, pg_upgrade allowed copying publications to a new node. With  
this patch, adjusting the connection string to the new publisher will  
cause the apply worker on the subscriber to connect to the new publisher  
automatically. This enables seamless continuation of logical replication,  
even after an upgrade.  
  
Author: Hayato Kuroda, Hou Zhijie  
Reviewed-by: Peter Smith, Bharath Rupireddy, Dilip Kumar, Vignesh C, Shlok Kyal  
Discussion: http://postgr.es/m/TYAPR01MB58664C81887B3AF2EB6B16E3F5939@TYAPR01MB5866.jpnprd01.prod.outlook.com  
Discussion: http://postgr.es/m/CAA4eK1+t7xYcfa0rEQw839=b2MzsfvYDPz3xbD+ZqOdP3zpKYg@mail.gmail.com  

M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c
A src/bin/pg_upgrade/t/003_upgrade_logical_replication_slots.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/logical.h
M src/tools/pgindent/typedefs.list

Doc: remove misleading info about ecpg's CONNECT/DISCONNECT DEFAULT.

commit   : bddc2f7480374023218427a0185145a127207c28    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Oct 2023 17:34:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Oct 2023 17:34:47 -0400    

Click here for diff

As far as I can see, ecpg has no notion of a "default" open  
connection.  You can do "CONNECT TO DEFAULT" but that just specifies  
letting libpq use all its default connection parameters --- the  
resulting connection is not special subsequently.  In particular,  
SET CONNECTION = DEFAULT and DISCONNECT DEFAULT simply act on a  
connection named DEFAULT, if you've made one; they do not have  
special lookup rules.  But the documentation of these commands  
makes it look like they do.  
  
Simplest fix, I think, is just to remove the paras suggesting that  
DEFAULT is special here.  
  
Also, SET CONNECTION *does* have one special lookup rule, which  
is that it recognizes CURRENT as an alias for the currently selected  
connection.  SET CONNECTION = CURRENT is a no-op, so it's pretty  
useless, but nonetheless it does something different from selecting  
a connection by name; so we'd better document it.  
  
Per report from Sylvain Frandaz.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml

Remove dead code in pg_ctl.c.

commit   : fdeb6e6a74f26e7b4504d358ffc751a6d74c08ab    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 25 Oct 2023 16:26:59 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 25 Oct 2023 16:26:59 -0500    

Click here for diff

Missed in 39969e2a1e.  
  
Author: David Steele  
Discussion: https://postgr.es/m/0c742f0c-d663-419d-b5a7-4fe867f5566c%40pgmasters.net  

M src/bin/pg_ctl/pg_ctl.c

Doc fix: Interfacing Extensions to Indexes

commit   : e9d12a5e22e02bace45dc2ba0e0dcca5b5d4fc52    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 25 Oct 2023 13:20:15 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 25 Oct 2023 13:20:15 -0700    

Click here for diff

Refer to CREATE ACCESS METHOD rather than suggesting direct changes to  
pg_am. Also corrects index-specific language that predated table  
access methods.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Yugo NAGATA <[email protected]>  

M doc/src/sgml/xindex.sgml

Fix some regression tests for d3d55ce57136

commit   : 9ba9c7074fa76787530ac0d50313e317ac7032b9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Oct 2023 14:53:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Oct 2023 14:53:14 +0300    

Click here for diff

Add missing (cost off) to explain.  

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

Remove useless self-joins

commit   : d3d55ce571369dad6e1d582f1655e5a3fbd8594a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Oct 2023 12:46:22 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Oct 2023 12:46:22 +0300    

Click here for diff

The Self Join Elimination (SJE) feature removes an inner join of a plain table  
to itself in the query tree if is proved that the join can be replaced with  
a scan without impacting the query result.  Self join and inner relation are  
replaced with the outer in query, equivalence classes, and planner info  
structures. Also, inner restrictlist moves to the outer one with removing  
duplicated clauses. Thus, this optimization reduces the length of the range  
table list (this especially makes sense for partitioned relations), reduces  
the number of restriction clauses === selectivity estimations, and potentially  
can improve total planner prediction for the query.  
  
The SJE proof is based on innerrel_is_unique machinery.  
  
We can remove a self-join when for each outer row:  
 1. At most one inner row matches the join clause.  
 2. Each matched inner row must be (physically) the same row as the outer one.  
  
In this patch we use the next approach to identify a self-join:  
 1. Collect all merge-joinable join quals which look like a.x = b.x  
 2. Add to the list above the baseretrictinfo of the inner table.  
 3. Check innerrel_is_unique() for the qual list.  If it returns false, skip  
    this pair of joining tables.  
 4. Check uniqueness, proved by the baserestrictinfo clauses. To prove  
    the possibility of self-join elimination inner and outer clauses must have  
    an exact match.  
  
The relation replacement procedure is not trivial and it is partly combined  
with the one, used to remove useless left joins.  Tests, covering this feature,  
were added to join.sql.  Some regression tests changed due to self-join removal  
logic.  
  
Discussion: https://postgr.es/m/flat/64486b0b-0404-e39e-322d-0801154901f3%40postgrespro.ru  
Author: Andrey Lepikhov, Alexander Kuzmenkov  
Reviewed-by: Tom Lane, Robert Haas, Andres Freund, Simon Riggs, Jonathan S. Katz  
Reviewed-by: David Rowley, Thomas Munro, Konstantin Knizhnik, Heikki Linnakangas  
Reviewed-by: Hywel Carver, Laurenz Albe, Ronan Dunklau, vignesh C, Zhihong Yu  
Reviewed-by: Greg Stark, Jaime Casanova, Michał Kłeczek, Alena Rybakina  
Reviewed-by: Alexander Korotkov  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planmain.c
M src/backend/utils/misc/guc_tables.c
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/equivclass.sql
M src/test/regress/sql/join.sql
M src/tools/pgindent/typedefs.list

Use snprintf instead of sprintf in pg_regress.

commit   : 8f0fd47fa33720dd09ad0ae74a8a583b9780e328    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 25 Oct 2023 10:53:11 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 25 Oct 2023 10:53:11 +0200    

Click here for diff

To avoid static analyzers sounding the alarm, move to using snprintf  
instead of sprintf. This was an oversight in 66d6086cbcbfc8dee789a6.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Add missing include dir and references to libpq for MSVC build

commit   : 673a17e31202cc47a9309e9b0b9b5fbec36080d3    
  
author   : David Rowley <[email protected]>    
date     : Wed, 25 Oct 2023 15:37:37 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 25 Oct 2023 15:37:37 +1300    

Click here for diff

66d6086cb adjusted pg_regress to require this but forgot to adjust the  
Visual Studio build script.  

M src/tools/msvc/Mkvcbuild.pm

doc: Fix some typos and grammar

commit   : cccfa08c39e194e7737d444974173e47a87b62c8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Oct 2023 09:40:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Oct 2023 09:40:55 +0900    

Click here for diff

Author: Ekaterina Kiryanova, Elena Indrupskaya, Oleg Sibiryakov, Maxim  
Yablokov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/charset.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/system-views.sgml
M doc/src/sgml/xact.sgml

Log OpenSSL version in ./configure output

commit   : 55a428a18d03f332791e15db9ed6ee51156ecd3b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Oct 2023 09:26:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Oct 2023 09:26:22 +0900    

Click here for diff

This information is useful to know when scanning buildfarm results, and  
it is already displayed in Meson.  The output of `openssl version` is  
logged, with the command retrieved from PATH.  
  
This depends on c8e4030d1bdd, so backpatch down to 16.  
  
Reviewed-by: Peter Eisentraut, Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M configure
M configure.ac

Reword memory terminology for PQresultMemorySize

commit   : d8fd08efbc660788f9e735f9dda824c64bc9bd6b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 24 Oct 2023 22:18:19 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 24 Oct 2023 22:18:19 +0200    

Click here for diff

Rather than using the generic word "space" we might as well use "memory"  
since that's precisely what we're dealing with here.  
  
This was extracted from a larger patch around terminology changes where  
the remaining hunks were rejected.  
  
Author: Gurjeet Singh <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CABwTF4UHO_NtcsOL6_XZfnpKg_0XBFKa7B-7_x5zs3MRZm3-Tg@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Speed up pg_regress server readiness testing.

commit   : 66d6086cbcbfc8dee789a69bf56d967bf9607902    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 24 Oct 2023 21:37:35 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 24 Oct 2023 21:37:35 +0200    

Click here for diff

Instead of connecting to the server with psql to check if it is ready  
for running tests, this changes pg_regress to use PQPing which avoids  
performing system() calls which are expensive on some platforms, like  
Windows. The frequency of tests is also increased in order to connect  
to the server faster.  
  
This patch is part of a larger effort to make testing consume fewer  
resources in order to be able to fit more tests into the available  
CI system constraints.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/meson.build
M src/test/isolation/Makefile
M src/test/isolation/meson.build
M src/test/regress/GNUmakefile
M src/test/regress/meson.build
M src/test/regress/pg_regress.c

Fix problems when a plain-inheritance parent table is excluded.

commit   : 387f9ed0a0832760a709d27abd630002903e3459    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2023 14:48:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2023 14:48:28 -0400    

Click here for diff

When an UPDATE/DELETE/MERGE's target table is an old-style  
inheritance tree, it's possible for the parent to get excluded  
from the plan while some children are not.  (I believe this is  
only possible if we can prove that a CHECK ... NO INHERIT  
constraint on the parent contradicts the query WHERE clause,  
so it's a very unusual case.)  In such a case, ExecInitModifyTable  
mistakenly concluded that the first surviving child is the target  
table, leading to at least two bugs:  
  
1. The wrong table's statement-level triggers would get fired.  
  
2. In v16 and up, it was possible to fail with "invalid perminfoindex  
0 in RTE with relid nnnn" due to the child RTE not having permissions  
data included in the query plan.  This was hard to reproduce reliably  
because it did not occur unless the update triggered some non-HOT  
index updates.  
  
In v14 and up, this is easy to fix by defining ModifyTable.rootRelation  
to be the parent RTE in plain inheritance as well as partitioned cases.  
  
While the wrong-triggers bug also appears in older branches, the  
relevant code in both the planner and executor is quite a bit  
different, so it would take a good deal of effort to develop and  
test a suitable patch.  Given the lack of field complaints about the  
trigger issue, I'll desist for now.  (Patching v11 for this seems  
unwise anyway, given that it will have no more releases after next  
month.)  
  
Per bug #18147 from Hans Buschmann.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Doc: indexUnchanged is strictly a hint.

commit   : 74e5ea1e002f861d499ded6562cab9e769f44781    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 24 Oct 2023 09:27:27 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 24 Oct 2023 09:27:27 -0700    

Click here for diff

Clearly spell out the limitations of aminsert()'s indexUnchanged hinting  
mechanism in the index AM documentation.  
  
Oversight in commit 9dc718bd, which added the "logically unchanged  
index" hint (which is used to trigger bottom-up index deletion).  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Tom Lane <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzmU_BQ=-H9L+bxTSMQBqHMjp1DSwGypvL0gKs+dTOfkKg@mail.gmail.com  
Backpatch: 14-, where indexUnchanged hinting was introduced.  

M doc/src/sgml/indexam.sgml

Assert that buffers are marked dirty before XLogRegisterBuffer().

commit   : 00d7fb5e2e39198387ae00af8dd18b787b6a4d63    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 23 Oct 2023 17:17:46 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 23 Oct 2023 17:17:46 -0700    

Click here for diff

Enforce the rule from transam/README in XLogRegisterBuffer(), and  
update callers to follow the rule.  
  
Hash indexes sometimes register clean pages as a part of the locking  
protocol, so provide a REGBUF_NO_CHANGE flag to support that use.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Heikki Linnakangas  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/xloginsert.h
M src/include/storage/bufmgr.h

commit   : befe9451fbf5a4b49e80f17917d8c6d8b5edad26    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Oct 2023 08:40:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Oct 2023 08:40:43 +0900    

Click here for diff

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

M doc/src/sgml/monitoring.sgml

Fix typos in wait_event.c

commit   : 9972c7de1d078d30434c16081fe0624ee3d24a61    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Oct 2023 08:05:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Oct 2023 08:05:29 +0900    

Click here for diff

Noticed while working on a different patch.  Introduced in af720b4c50a1.  

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

Change struct tablespaceinfo's oid member from 'char *' to 'Oid'

commit   : 5b36e8f078a3c68fd1c530c59c4ed961c15c7ab4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Oct 2023 15:17:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Oct 2023 15:17:26 -0400    

Click here for diff

This shouldn't change behavior except in the unusual case where  
there are file in the tablespace directory that have entirely  
numeric names but are nevertheless not possible names for a  
tablespace directory, either because their names have leading zeroes  
that shouldn't be there, or the value is actually zero, or because  
the value is too large to represent as an OID.  
  
In those cases, the directory would previously have made it into  
the list of tablespaceinfo objects and no longer will. Thus, base  
backups will now ignore such directories, instead of treating them  
as legitimate tablespace directories. Similarly, if entries for  
such tablespaces occur in a tablespace_map file, they will now  
be rejected as erroneous, instead of being honored.  
  
This is infrastructure for future work that wants to be able to  
know the tablespace of each relation that is part of a backup  
*as an OID*. By strengthening the up-front validation, we don't  
have to worry about weird cases later, and can more easily avoid  
repeated string->integer conversions.  
  
Patch by me, reviewed by David Steele.  
  
Discussion: http://postgr.es/m/CA+TgmoZNVeBzoqDL8xvr-nkaepq815jtDR4nJzPew7=3iEuM1g@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/include/backup/backup_manifest.h
M src/include/backup/basebackup.h

Refactor parse_filename_for_nontemp_relation to parse more.

commit   : 5c47c6546c413d5eb51c1626070a807026e6139d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Oct 2023 15:08:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Oct 2023 15:08:53 -0400    

Click here for diff

Instead of returning the number of characters in the RelFileNumber,  
return the RelFileNumber itself. Continue to return the fork number,  
as before, and additionally return the segment number.  
  
parse_filename_for_nontemp_relation now rejects a RelFileNumber or  
segment number that begins with a leading zero. Before, we accepted  
such cases as relation filenames, but if we continued to do so after  
this change, the function might return the same values for two  
different files (e.g. 1234.5 and 001234.5 or 1234.005) which could be  
annoying for callers. Since we don't actually ever generate filenames  
with leading zeroes in the names, any such files that we find must  
have been created by something other than PostgreSQL, and it is  
therefore reasonable to treat them as non-relation files.  
  
Along the way, change unlogged_relation_entry to store a RelFileNumber  
rather than an OID. This update should have been made in  
851f4cc75cdd8c831f1baa9a7abf8c8248b65890, but it was overlooked.  
It's trivial to make the update as part of this commit, perhaps more  
trivial than it would have been without it, so do that.  
  
Patch by me, reviewed by David Steele.  
  
Discussion: http://postgr.es/m/CA+TgmoZNVeBzoqDL8xvr-nkaepq815jtDR4nJzPew7=3iEuM1g@mail.gmail.com  

M src/backend/backup/basebackup.c
M src/backend/storage/file/reinit.c
M src/include/storage/reinit.h

Remove unnecessary break in pg_logical_replication_slot_advance()

commit   : b6f1cca9ba3d24c8fcaa9facc30c96bcc50b37aa    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Oct 2023 10:20:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Oct 2023 10:20:30 +0900    

Click here for diff

pg_logical_replication_slot_advance() included a break condition to stop  
when a targeted LSN is reached, when processing a series of WAL records  
with XLogReadRecord().  Since 38a957316d7e, it matched with the check of  
its main while loop.  This condition saved from an extra CFI check,  
actually pointless, so let's remove this condition and simplify the  
code.  
  
In passing, fix an incorrect comment.  
  
Author: Bharath Rupireddy  
Reviewed-by: Tom Lane, Gurjeet Singh  
Discussion: https://postgr.es/m/CALj2ACWfGDLQ2cy7ZKwxnJqbDkO6Yvqqrqxne5ZN4HYm=PRTGg@mail.gmail.com  

M src/backend/replication/slotfuncs.c

doc: Fix some grammar and inconsistent tags

commit   : 40ebc41576e8116b7df90d0181f1371669622ea6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Oct 2023 09:58:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Oct 2023 09:58:55 +0900    

Click here for diff

Author: Ekaterina Kiryanova, Elena Indrupskaya, Oleg Sibiryakov, Maxim  
Yablokov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/xact.sgml

Log LLVM library version in configure output.

commit   : 5e4dacb9878cf71e32950e90993afd9450dab4da    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 22 Oct 2023 14:17:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 22 Oct 2023 14:17:00 +1300    

Click here for diff

When scanning build farm results, it's useful to be able to see which  
version is in use.  For the Meson build system, this information was  
already displayed.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/4022690.1697852728%40sss.pgh.pa.us  

M config/llvm.m4
M configure

Fix min_dynamic_shared_memory on Windows.

commit   : dab889d60bac3fbf691973ca1770f2eb50547999    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 22 Oct 2023 10:04:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 22 Oct 2023 10:04:55 +1300    

Click here for diff

When min_dynamic_shared_memory is set above 0, we try to find space in a  
pre-allocated region of the main shared memory area instead of calling  
dsm_impl_XXX() routines to allocate more.  The dsm_pin_segment() and  
dsm_unpin_segment() routines had a bug: they called dsm_impl_XXX()  
routines even for main region segments.  Nobody noticed before now  
because those routines do nothing on Unix, but on Windows they'd fail  
while attempting to duplicate an invalid Windows HANDLE.  Add the  
missing gating.  
  
Back-patch to 14, where commit 84b1c63a added this feature.  Fixes  
pgsql-bugs bug #18165.  
  
Reported-by: Maxime Boyer <[email protected]>  
Tested-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/18165-bf4f525cea6e51de%40postgresql.org  

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

Allow ALTER SYSTEM to set unrecognized custom GUCs.

commit   : 2d870b4aeff174ea3b8a0837bc2065c820fb43e2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Oct 2023 13:35:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Oct 2023 13:35:19 -0400    

Click here for diff

Previously, ALTER SYSTEM failed if the target GUC wasn't present in  
the session's GUC hashtable.  That is a reasonable behavior for core  
(single-part) GUC names, and for custom GUCs for which we have loaded  
an extension that's reserved the prefix.  But it's unnecessarily  
restrictive otherwise, and it also causes inconsistent behavior:  
you can "ALTER SYSTEM SET foo.bar" only if you did "SET foo.bar"  
earlier in the session.  That's fairly silly.  
  
Hence, refactor things so that we can execute ALTER SYSTEM even  
if the variable doesn't have a GUC hashtable entry, as long as the  
name meets the custom-variable naming requirements and does not  
have a reserved prefix.  (It's safe to do this even if the  
variable belongs to an extension we currently don't have loaded.  
A bad value will at worst cause a WARNING when the extension  
does get loaded.)  
  
Also, adjust GRANT ON PARAMETER to have the same opinions about  
whether to allow an unrecognized GUC name, and to throw the  
same errors if not (it previously used a one-size-fits-all  
message for several distinguishable conditions).  By default,  
only a superuser will be allowed to do ALTER SYSTEM SET on an  
unrecognized name, but it's possible to GRANT the ability to  
do it.  
  
Patch by me, pursuant to a documentation complaint from  
Gavin Panella.  Arguably this is a bug fix, but given the  
lack of other complaints I'll refrain from back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_parameter_acl.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql

Make some error strings more generic

commit   : 36a14afc076024ba48c399f2af2d4cd1b2c39348    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Oct 2023 22:52:15 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Oct 2023 22:52:15 +0200    

Click here for diff

It's undesirable to have SQL commands or configuration options in a  
translatable error string, so take some of these out.  

M src/backend/commands/collationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c

meson: Make detection of python more robust

commit   : 41da94fd5c7418838ec7c49456b69c462013ea57    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Oct 2023 11:11:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Oct 2023 11:11:31 -0700    

Click here for diff

Previously we errored out if no python installation could be found (but we did  
handle not having enough of python installed to build plpython  
against). Presumably nobody hit this so far, as python is likely installed due  
to meson requiring python.  
  
Author: Tristan Partin <[email protected]>  
Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  
Backpatch: 16-, where meson support was added  

M meson.build

Doc: update CREATE OPERATOR's statement about => as an operator.

commit   : 52f22cd4e894ea2ff6a8c497ef4268b2726a9da9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2023 13:01:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2023 13:01:02 -0400    

Click here for diff

This doco said that use of => as an operator "is deprecated".  
It's been fully disallowed since 865f14a2d back in 9.5, but  
evidently that commit missed updating this statement.  
Do so now.  

M doc/src/sgml/ref/create_operator.sgml

Extend ALTER OPERATOR to allow setting more optimization attributes.

commit   : 2b5154beab794eae6e624c162d497df927ec9d27    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2023 12:28:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2023 12:28:38 -0400    

Click here for diff

Allow the COMMUTATOR, NEGATOR, MERGES, and HASHES attributes to be set  
by ALTER OPERATOR.  However, we don't allow COMMUTATOR/NEGATOR to be  
changed once set, nor allow the MERGES/HASHES flags to be unset once  
set.  Changes like that might invalidate plans already made, and  
dealing with the consequences seems like more trouble than it's worth.  
The main use-case we foresee for this is to allow addition of missed  
properties in extension update scripts, such as extending an existing  
operator to support hashing.  So only transitions from not-set to set  
states seem very useful.  
  
This patch also causes us to reject some incorrect cases that formerly  
resulted in inconsistent catalog state, such as trying to set the  
commutator of an operator to be some other operator that already has a  
(different) commutator.  
  
While at it, move the InvokeObjectPostCreateHook call for CREATE  
OPERATOR to not occur until after we've fixed up commutator or negator  
links as needed.  The previous ordering could only be justified by  
thinking of the OperatorUpd call as a kind of ALTER OPERATOR step;  
but we don't call InvokeObjectPostAlterHook therein.  It seems better  
to let the hook see the final state of the operator object.  
  
In the documentation, move the discussion of how to establish  
commutator pairs from xoper.sgml to the CREATE OPERATOR ref page.  
  
Tommy Pavlicek, reviewed and editorialized a bit by me  
  
Discussion: https://postgr.es/m/CAEhP-W-vGVzf4udhR5M8Bdv88UYnPrhoSkj3ieR3QNrsGQoqdg@mail.gmail.com  

M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/xoper.sgml
M src/backend/catalog/pg_operator.c
M src/backend/commands/operatorcmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_oper.c
M src/include/catalog/pg_operator.h
M src/include/parser/parse_oper.h
M src/test/regress/expected/alter_operator.out
M src/test/regress/expected/create_operator.out
M src/test/regress/sql/alter_operator.sql
M src/test/regress/sql/create_operator.sql

Remove unnecessary dependencies to wal_level=logical in TAP tests

commit   : dcd4454590e77dc90c28ce4b4a4b62369bbc03e2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 20 Oct 2023 10:09:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 20 Oct 2023 10:09:27 +0900    

Click here for diff

A couple of TAP tests make use of wal_level=logical for nodes that do  
not need to do any kind of logical decoding operations, like  
subscription nodes on which changes are only applied.  This can be  
confusing when reading these tests as setup examples, so let's remove  
this configuration where not required (contrary to two-way logical  
replication and similar more complex cases).  This simplifies the tests  
a bit, making them slightly cheaper with less WAL generated overall.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB5866946BCEB747ABE513ACC6F5D5A@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/038_save_logical_slots_shutdown.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/100_bugs.pl

During online checkpoints, insert XLOG_CHECKPOINT_REDO at redo point.

commit   : afd12774ae8957159cf77ba4b3d092691f87af53    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Oct 2023 14:47:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Oct 2023 14:47:29 -0400    

Click here for diff

This allows tools that read the WAL sequentially to identify (possible)  
redo points when they're reached, rather than only being able to  
detect them in retrospect when XLOG_CHECKPOINT_ONLINE is found, possibly  
much later in the WAL stream. There are other possible applications as  
well; see the discussion links below.  
  
Any redo location that precedes the checkpoint location should now point  
to an XLOG_CHECKPOINT_REDO record, so add a cross-check to verify this.  
  
While adjusting the code in CreateCheckPoint() for this patch, I made it  
call WALInsertLockAcquireExclusive a bit later than before, since there  
appears to be no need for it to be held while checking whether the system  
is idle, whether this is an end-of-recovery checkpoint, or what the current  
timeline is.  
  
Bump XLOG_PAGE_MAGIC.  
  
Patch by me, based in part on earlier work from Dilip Kumar. Review by  
Dilip Kumar, Amit Kapila, Andres Freund, and Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoYy-Vc6G9QKcAKNksCa29cv__czr+N9X_QCxEfQVpp_8w@mail.gmail.com  
Discussion: http://postgr.es/m/20230614194717.jyuw3okxup4cvtbt%40awork3.anarazel.de  
Discussion: http://postgr.es/m/CA+hUKG+b2ego8=YNW2Ohe9QmSiReh1-ogrv8V_WZpJTqP3O+2w@mail.gmail.com  

M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/logical/decode.c
M src/include/access/xlog_internal.h
M src/include/catalog/pg_control.h
M src/tools/pgindent/typedefs.list

Doc: modernize comment for boolin().

commit   : 8483a54b7da709c6f381f2dd06085a67ecf669ba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Oct 2023 11:31:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Oct 2023 11:31:05 -0400    

Click here for diff

Most of the behavior described by this comment was moved to  
parse_bool_with_len() some time ago.  Move what's still  
valuable there too, and drop the rest.  
  
Peter Smith  
  
Discussion: https://postgr.es/m/CAHut+PtMJURKp=U8Z=Ktp0zV40sEb1f-iEk9FvY2GQe+5ZBnwg@mail.gmail.com  

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

pg_stat_statements: Add local_blk_{read|write}_time

commit   : 5147ab1dd34ad81c169c85fa3c7d11a782a1555b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 14:03:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 14:03:31 +0900    

Click here for diff

This commit adds to pg_stat_statements the two new fields for local  
buffers introduced by 295c36c0c1fa, adding the time spent to read and  
write these blocks.  These are similar to what is done for temp and  
shared blocks.  This information available only if track_io_timing is  
enabled.  
  
Like for 5a3423ad8ee17, no version bump is required in the module.  
  
Author: Nazir Bilal Yavuz  
Reviewed-by: Robert Haas, Melanie Plageman  
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com  

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

Add local_blk_{read|write}_time I/O timing statistics for local blocks

commit   : 295c36c0c1fa7b6befd0a3525c7f109e838c9448    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 13:39:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 13:39:38 +0900    

Click here for diff

There was no I/O timing statistics for counting read and write timings  
on local blocks, contrary to the counterparts for temp and shared  
blocks.  This information is available when track_io_timing is enabled.  
  
The output of EXPLAIN is updated to show this information.  An update of  
pg_stat_statements is planned next.  
  
Author: Nazir Bilal Yavuz  
Reviewed-by: Robert Haas, Melanie Plageman  
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com  

M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/backend/utils/activity/pgstat_io.c
M src/include/executor/instrument.h
M src/test/regress/expected/explain.out

Rename I/O timing statistics columns to shared_blk_{read|write}_time

commit   : 13d00729d422c84b1764c24251abcc785ea4adb1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 11:26:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 11:26:40 +0900    

Click here for diff

These two counters, defined in BufferUsage to track respectively the  
time spent while reading and writing blocks have historically only  
tracked data related to shared buffers, when track_io_timing is enabled.  
  
An upcoming patch to add specific counters for local buffers will take  
advantage of this rename as it has come up that no data is currently  
tracked for local buffers, and tracking local and shared buffers using  
the same fields would be inconsistent with the treatment done for temp  
buffers.  Renaming the existing fields clarifies what the block type of  
each stats field is.  
  
pg_stat_statement is updated to reflect the rename.  No extension  
version bump is required as 5a3423ad8ee17 has done one, affecting v17~.  
  
Author: Nazir Bilal Yavuz  
Reviewed-by: Robert Haas, Melanie Plageman  
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/pg_stat_statements–1.10–1.11.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/pgstatstatements.sgml
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/backend/utils/activity/pgstat_io.c
M src/include/executor/instrument.h
M src/test/regress/expected/explain.out

Improve pglz_decompress's defenses against corrupt compressed data.

commit   : 9b103f861ea9d74c4c43e80c5c5dfcdc1e61f4a2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Oct 2023 20:43:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Oct 2023 20:43:17 -0400    

Click here for diff

When processing a match tag, check to see if the claimed "off"  
is more than the distance back to the output buffer start.  
If it is, then the data is corrupt, and what's more we would  
fetch from outside the buffer boundaries and potentially incur  
a SIGSEGV.  (Although the odds of that seem relatively low, given  
that "off" can't be more than 4K.)  
  
Back-patch to v13; before that, this function wasn't really  
trying to protect against bad data.  
  
Report and fix by Flavien Guedez.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/pg_lzcompress.c

Install wait_event_types.h in VPATH builds

commit   : 7fb355db142958f463f7a0415248184f7ca4503f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 09:42:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Oct 2023 09:42:46 +0900    

Click here for diff

An extra rule is needed in src/include/Makefile for VPATH builds to  
install any generated server-side include files, and wait_event_types.h  
was forgotten from the set.  
  
Issue introduced by fa88928470b5.  
  
Reported-by: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  

M src/include/Makefile

jit: Changes for LLVM 17.

commit   : 76200e5ee469e4a9db5f9514b9d0c6a31b496bff    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 18 Oct 2023 22:15:54 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 18 Oct 2023 22:15:54 +1300    

Click here for diff

Changes required by https://llvm.org/docs/NewPassManager.html.  
  
Back-patch to 12, leaving the final release of 11 unchanged, consistent  
with earlier decision not to back-patch LLVM 16 support either.  
  
Author: Dmitry Dolgov <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com  

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

jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

commit   : f90b4a846b32d3d6d2fd9d55a93735501e4c34fd    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 19 Oct 2023 03:01:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 19 Oct 2023 03:01:55 +1300    

Click here for diff

Commit 37d5babb used this C API function while adding support for LLVM  
16 and opaque pointers, but it's not available in LLVM 7 and older.  
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function  
that pre-dates LLVM 3.9, our minimum target.  
  
Back-patch to 12, like 37d5babb.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h

jit: Support opaque pointers in LLVM 16.

commit   : 37d5babb5cfa4c6795b3cb6de964ba019d3d60ab    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 18 Oct 2023 22:09:05 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 18 Oct 2023 22:09:05 +1300    

Click here for diff

Remove use of LLVMGetElementType() and provide the type of all pointers  
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM  
versions[1].  
  
 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.  
 * For LLVM == 15, we'll continue to do the same, explicitly opting  
   out of opaque pointer mode.  
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take  
   the extra type argument.  
  
The difference is hidden behind some new IR emitting wrapper functions  
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,  
except that at each site the correct type had to be provided.  
  
In some places we needed to do some extra work to get functions types,  
including some new wrappers for C++ APIs that are not yet exposed by in  
LLVM's C API, and some new "example" functions in llvmjit_types.c  
because it's no longer possible to start from the function pointer type  
and ask for the function type.  
  
Back-patch to 12, because it's a little tricker in 11 and we agreed not  
to put the latest LLVM support into the upcoming final release of 11.  
  
[1] https://llvm.org/docs/OpaquePointers.html  
  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Ronan Dunklau <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/jit/llvm/meson.build
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h

pg_upgrade: Fix test name in 002_pg_upgrade.pl

commit   : 3f9b1f26ca0eee46affcf1b0fd83c4217dec40db    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 18:23:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 18:23:25 +0900    

Click here for diff

Author: Hou Zhijie  
Discussion: https://postgr.es/m/TYAPR01MB5724A40D47E71F4717357EC694D5A@TYAPR01MB5724.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

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

Clean up some pg_dump tests

commit   : 41a284411e09a3c0a401cd5ab81fbf1802fe8021    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Oct 2023 08:03:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Oct 2023 08:03:39 +0200    

Click here for diff

1) Remove useless entries from "unlike" lists.  Runs that are not  
   listed in "like" don't need to be excluded in "unlike".  
  
2) Ensure there is always a "like" list, even if it is empty.  This  
   makes the test more self-documenting.  
  
3) Use predefined lists such as %full_runs where appropriate, instead  
   of listing all runs separately.  
  
Also add code that checks 1 and 2 automatically and dies with an error  
for violations.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Count write times when extending relation files for shared buffers

commit   : d17ffc734dad8c231ad3deee0b3670ecb99b713d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 14:54:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 14:54:33 +0900    

Click here for diff

Relation files extended by multiple blocks at a time have been counting  
the number of blocks written, but forgot to increment the write time in  
this case, as single-block write and relation extension are treated as  
two different I/O operations in the shared stats: IOOP_EXTEND vs  
IOOP_WRITE.  In this case IOOP_EXTEND was forgotten for normal  
(non-temporary) relations, still the number of blocks written was  
incremented according to the relation extend done.  
  
Write times are tracked when track_io_timing is enabled, which is not  
the case by default.  
  
Author: Nazir Bilal Yavuz  
Reviewed-by: Robert Haas, Melanie Plageman  
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com  
Backpatch-through: 16  

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

Add flush option to pg_logical_emit_message()

commit   : 173b56f1ef597251fe79d8e71a0df7586ea12549    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 11:24:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Oct 2023 11:24:59 +0900    

Click here for diff

Since its introduction, LogLogicalMessage() (via the SQL interface  
pg_logical_emit_message()) has never included a call to XLogFlush(),  
causing it to potentially lose messages on a crash when used in  
non-transactional mode.  This has come up to me as a problem while  
playing with ideas to design a test suite for what has become  
039_end_of_wal.pl introduced in bae868caf222 by Thomas Munro, because  
there are no direct ways to force a WAL flush via SQL.  
  
The default is false, to not flush messages and influence existing  
use-cases where this function could be used.  If set to true, the  
message emitted is flushed before returning back to the caller, making  
the message durable on crash.  This new option has no effect when using  
pg_logical_emit_message() in transactional mode, as the record's flush  
is guaranteed by the WAL record generated by the transaction committed.  
  
Two queries of test_decoding are tweaked to cover the new code path for  
the flush.  
  
Bump catalog version.  
  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Amit Kapila, Fujii Masao, Tung Nguyen, Tomas  
Vondra  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/messages.out
M contrib/test_decoding/sql/messages.sql
M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/message.h

Dodge a compiler bug affecting timetz_zone/timetz_izone.

commit   : 19fa977311b9da9c6c84f0108600e78213751a38    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Oct 2023 13:10:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Oct 2023 13:10:32 -0400    

Click here for diff

Use a modulo operator instead of implementing the same behavior  
with a loop.  The loop solution is doubtless microscopically  
faster for the typical case of only wrapping into the very next  
day, but maybe not so much for large interval values.  In any  
case, timetz is such a backwater that it's doubtful anybody  
would notice any performance change anyway.  
  
This avoids a compiler bug occurring in AIX's xlc, even in pretty  
late-model revisions.  
  
We did not have test coverage for the case where the initial  
result->time value is negative, so add that.  
  
For the moment, install this only in HEAD.  My plan is to  
back-patch the test case, and then the code change assuming that  
buildfarm testing proves the bug occurs in the back branches.  
(That seems pretty likely, but let's find out for sure.)  
  
Per buildfarm results from commits 97957fdba and 2f0472030.  
Thanks to Michael Paquier for the idea to use a modulo operation  
to replace the faulty loop.  
  
Discussion: https://postgr.es/m/CA+hUKGK=DOC+hE-62FKfZy=Ybt5uLkrg3zCZD-jFykM-iPn8yw@mail.gmail.com  

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

Avoid calling proc_exit() in processes forked by system().

commit   : 97550c0711972a9856b5db751539bbaf2f88884c    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 17 Oct 2023 10:41:48 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 17 Oct 2023 10:41:48 -0500    

Click here for diff

The SIGTERM handler for the startup process immediately calls  
proc_exit() for the duration of the restore_command, i.e., a call  
to system().  This system() call forks a new process to execute the  
shell command, and this child process inherits the parent's signal  
handlers.  If both the parent and child processes receive SIGTERM,  
both will attempt to call proc_exit().  This can end badly.  For  
example, both processes will try to remove themselves from the  
PGPROC shared array.  
  
To fix this problem, this commit adds a check in  
StartupProcShutdownHandler() to see whether MyProcPid == getpid().  
If they match, this is the parent process, and we can proc_exit()  
like before.  If they do not match, this is a child process, and we  
just emit a message to STDERR (in a signal safe manner) and  
_exit(), thereby skipping any problematic exit callbacks.  
  
This commit also adds checks in proc_exit(), ProcKill(), and  
AuxiliaryProcKill() that verify they are not being called within  
such child processes.  
  
Suggested-by: Andres Freund  
Reviewed-by: Thomas Munro, Andres Freund  
Discussion: https://postgr.es/m/Y9nGDSgIm83FHcad%40paquier.xyz  
Discussion: https://postgr.es/m/20230223231503.GA743455%40nathanxps13  
Backpatch-through: 11  

M src/backend/postmaster/startup.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Reword messages about impending (M)XID exhaustion.

commit   : 2406c4e34ccca697bd5a221f8375f335b5841dea    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Oct 2023 10:34:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Oct 2023 10:34:21 -0400    

Click here for diff

First, we shouldn't recommend switching to single-user mode, because  
that's terrible advice. Especially on newer versions where VACUUM  
will enter emergency mode when nearing (M)XID exhaustion, it's  
perfectly fine to just VACUUM in multi-user mode. Doing it that way  
is less disruptive and avoids disabling the safeguards that prevent  
actual wraparound, so recommend that instead.  
  
Second, be more precise about what is going to happen (when we're  
nearing the limits) or what is happening (when we actually hit them).  
The database doesn't shut down, nor does it refuse all commands. It  
refuses commands that assign whichever of XIDs and MXIDs are nearly  
exhausted.  
  
No back-patch. The existing hint that advises going to single-user  
mode is sufficiently awful advice that removing it or changing it  
might be justifiable even though we normally avoid changing  
user-facing messages in back-branches, but I (rhaas) felt that it  
was better to be more conservative and limit this fix to master  
only. Aside from the usual risk of breaking translations, people  
might be used to the existing message, or even have monitoring  
scripts that look for it.  
  
Alexander Alekseev, John Naylor, Robert Haas, reviewed at various  
times by Peter Geoghegan, Hannu Krosing, and Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoZBg95FiR9wVQPAXpGPRkacSt2okVge+PKPPFppN7sfnQ@mail.gmail.com  

M doc/src/sgml/maintenance.sgml
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c

Talk about assigning, rather than generating, new MultiXactIds.

commit   : a1a5da8cb74b7abf54a1f5fc5b5a442bb807843c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Oct 2023 10:23:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Oct 2023 10:23:31 -0400    

Click here for diff

The word "assign" is used in various places internally to describe what  
GetNewMultiXactId does, but the user-facing messages have previously  
said "generate". For consistency, standardize on "assign," which seems  
(at least to me) to be slightly clearer.  
  
Discussion: http://postgr.es/m/CA+TgmoaoE1_i3=4-7GCTtKLVZVQ2Gh6qESW2VG1OprtycxOHMA@mail.gmail.com  

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

Improve truncation of pg_serial/, removing "apparent wraparound" LOGs

commit   : d6b0c2bcb1b604e919b15a32c1aeb981bfae4d51    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 17 Oct 2023 14:36:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 17 Oct 2023 14:36:04 +0900    

Click here for diff

It is possible that the tail XID of pg_serial/ gets ahead of its head  
XID, which would cause the truncation of pg_serial/ done during  
checkpoints to show up as a "wraparound" LOG in SimpleLruTruncate(),  
which is confusing.  This also wastes a bit of disk space until the head  
page is reclaimed again.  
  
CheckPointPredicate() is changed so as the cutoff page for the  
truncation is switched to the head page if the tail XID has advanced  
beyond the head XID, rather than the tail page.  This prevents the  
confusing LOG message about a wraparound while allowing some truncation  
to be done to cut in disk space.  
  
This could be considered as a bug fix, but the original behavior is  
harmless as well, resulting only in disk space temporarily wasted, so  
no backpatch is done.  
  
Author: Sami Imseih  
Reviewed-by: Heikki Linnakangas, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Run 006_login_trigger.pl only with Unix-domain sockets

commit   : 6fcaeb0ea26b963b0ca13ce6078df4c2c3135aa3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 17 Oct 2023 08:11:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 17 Oct 2023 08:11:40 +0300    

Click here for diff

Per report from buildfarm member drongo.  
  
Reported-by: Alexander Lakhin  

M src/test/authentication/t/006_login_trigger.pl

Restart the apply worker if the privileges have been revoked.

commit   : 79243de13f4d251309d7831744e98d6b965ed4d6    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 17 Oct 2023 08:30:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 17 Oct 2023 08:30:05 +0530    

Click here for diff

Restart the apply worker if the subscription owner's superuser privileges  
have been revoked. This is required so that the subscription connection  
string gets revalidated and use the password option to connect to the  
publisher for non-superusers, if required.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: http://postgr.es/m/CALDaNm2Dxmhq08nr4P6G+24QvdBo_GAVyZ_Q1TcGYK+8NHs9xw@mail.gmail.com  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/catalog/pg_subscription.h
M src/test/subscription/t/027_nosuperuser.pl

Add regression test coverage for timetz_izone().

commit   : 2f047203074c643ae458dcf51bbb8ae45dd7e13c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2023 15:45:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2023 15:45:01 -0400    

Click here for diff

Extend the test added by commit 97957fdba so that it also covers  
timetz_izone(), that is the "AT TIME ZONE interval" case.  
This is mostly to see if xlc's apparent bug occurs there too,  
but more code coverage is always welcome.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Ensure we have a snapshot while dropping ON COMMIT DROP temp tables.

commit   : 54b208f90963cb8b48b9794a5392b2fae4b40a98    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2023 14:06:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2023 14:06:11 -0400    

Click here for diff

Dropping a temp table could entail TOAST table access to clean out  
toasted catalog entries, such as large pg_constraint.conbin strings  
for complex CHECK constraints.  If we did that via ON COMMIT DROP,  
we triggered the assertion in init_toast_snapshot(), because  
there was no provision for setting up a snapshot for the drop  
actions.  Fix that.  
  
(I assume here that the adjacent truncation actions for ON COMMIT  
DELETE ROWS don't have a similar problem: it doesn't seem like  
nontransactional truncations would need to touch any toasted fields.  
If that proves wrong, we could refactor a bit to have the same  
snapshot acquisition cover that too.)  
  
The test case added here does not fail before v15, because that  
assertion was added in 277692220 which was not back-patched.  
However, the race condition the assertion warns of surely  
exists further back, so back-patch to all supported branches.  
  
Per report from Richard Guo.  
  
Discussion: https://postgr.es/m/CAMbWs4-x26=_QxxgdJyNbiCDzvtr2WV5ZDso_v-CukKEe6cBZw@mail.gmail.com  

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

Move extra code out of the Pre/PostRestoreCommand() section.

commit   : 8fb13dd6ab5bffdbfafd8894ffcc5deb44d0c0b0    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 16 Oct 2023 12:41:55 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 16 Oct 2023 12:41:55 -0500    

Click here for diff

If SIGTERM is received within this section, the startup process  
will immediately proc_exit() in the signal handler, so it is  
inadvisable to include any more code than is required there (as  
such code is unlikely to be compatible with doing proc_exit() in a  
signal handler).  This commit moves the code recently added to this  
section (see 1b06d7bac9 and 7fed801135) to outside of the section.  
This ensures that the startup process only calls proc_exit() in its  
SIGTERM handler for the duration of the system() call, which is how  
this code worked from v8.4 to v14.  
  
Reported-by: Michael Paquier, Thomas Munro  
Analyzed-by: Andres Freund  
Suggested-by: Tom Lane  
Reviewed-by: Michael Paquier, Robert Haas, Thomas Munro, Andres Freund  
Discussion: https://postgr.es/m/Y9nGDSgIm83FHcad%40paquier.xyz  
Discussion: https://postgr.es/m/20230223231503.GA743455%40nathanxps13  
Backpatch-through: 15  

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

Update the documentation on recovering from (M)XID exhaustion.

commit   : a70bce43fbceab6bf0b49498a064c4e87cdbf72f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Oct 2023 12:57:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Oct 2023 12:57:39 -0400    

Click here for diff

The old documentation encourages entering single-user mode for no  
reason, which is a bad plan in most cases. Instead, discourage users  
from doing that, and explain the limited cases in which it may be  
desirable.  
  
The old documentation claims that running VACUUM as anyone but the  
superuser can't possibly work, which is not really true, because it  
might be that some other user has enough permissions to VACUUM all  
the tables that matter. Weaken the language just a bit.  
  
The old documentation claims that you can't run any commands  
when near XID exhaustion, which is false because you can still  
run commands that don't require an XID, like a SELECT without a  
locking clause.  
  
The old documentation doesn't clearly explain that it's a good idea  
to get rid of prepared transactons, long-running transactions, and  
replication slots that are preventing (M)XID horizon advancement.  
Spell out the steps to do that.  
  
Also, discourage the use of VACUUM FULL and VACUUM FREEZE in  
this type of scenario.  
  
Back-patch to v14. Much of this is good advice on all supported  
versions, but before 60f1f09ff44308667ef6c72fbafd68235e55ae27  
the chances of VACUUM failing in multi-user mode were much higher.  
  
Alexander Alekseev, John Naylor, Robert Haas, reviewed at various  
times by Peter Geoghegan, Hannu Krosing, and Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoYtsUDrzaHcmjFhLzTk1VEv29mO_u-MT+XWHrBJ_4nD8A@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

List 006_login_trigger.pl test for meson

commit   : 5abbd97fef6f18eef91bfed7d2057c39bd204702    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 10:38:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 10:38:33 +0300    

Click here for diff

Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA%2BhUKGLuqDUaYYhJnA1H1q5Z-k18kQHoEqZ5fiXtTi4038nspg%40mail.gmail.com  

M src/test/authentication/meson.build

worker_spi: Fix test failure with BGWORKER_BYPASS_ROLELOGINCHECK

commit   : 4922173010f102a7d56af7c97bd303b95b3f6eff    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 13:45:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 13:45:39 +0900    

Click here for diff

This is a consequence of 4817da51f69a that has bumped up  
max_worker_processes, where now the last worker started by the test  
would be able to start by itself a parallel worker because there are  
more slots available.  This did not show up before as the number of  
bgworkers reached exactly 8, as known as the previous limit, at the end  
of the test.  
  
Per report from buildfarm member crake, reproducible with  
debug_parallel_query = regress in the same fashion as fd4d93d269c0.  

M src/test/modules/worker_spi/worker_spi.c

Try to handle torn reads of pg_control in frontend.

commit   : 63a582222c6b3db2b1103ddf67a04b31a8f8e9bb    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 17:10:13 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 17:10:13 +1300    

Click here for diff

Some of our src/bin tools read the control file without any kind of  
interlocking against concurrent writes from the server.  At least ext4  
and ntfs can expose partially modified contents when you do that.  
  
For now, we'll try to tolerate this by retrying up to 10 times if the  
checksum doesn't match, until we get two reads in a row with the same  
bad checksum.  This is not guaranteed to reach the right conclusion, but  
it seems very likely to.  Thanks to Tom Lane for this suggestion.  
  
Various ideas for interlocking or atomicity were considered too  
complicated, unportable or expensive given the lack of field reports,  
but remain open for future reconsideration.  
  
Back-patch as far as 12.  It doesn't seem like a good idea to put a  
heuristic change for a very rare problem into the final release of 11.  
  
Reviewed-by: Anton A. Melnikov <[email protected]>  
Reviewed-by: David Steele <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/20221123014224.xisi44byq3cf5psi%40awork3.anarazel.de  

M src/common/controldata_utils.c

worker_spi: Bump up max_worker_processes in TAP tests

commit   : 4817da51f69ae7e965abf94aad01a4bab1404918    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 13:07:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 13:07:36 +0900    

Click here for diff

mamba has detected a failure in the last test that should start a  
bgworker while bypassing the role login check.  The buildfarm did not  
provide any information about its failure in the logs, but I suspect  
that this is caused by an exhaustion of the max_worker_processes slots  
set at 8 by default.  
  
In "normal" test runs, the number of bgworkers running at this stage of  
the test is already 7, so, if one of them spawns for example a parallel  
worker all the slots would be taken, preventing the last worker of the  
test to start.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/t/001_worker_spi.pl

Rename 005_login_trigger.pl to 006_login_trigger.pl

commit   : 1f89b73c4e053c463d75608c27ca564770fd3158    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 04:00:08 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 04:00:08 +0300    

Click here for diff

In order to avoid numbering collision with 005_sspi.pl.  

R100 src/test/authentication/t/005_login_trigger.pl src/test/authentication/t/006_login_trigger.pl

Fix role names in src/test/authentication/t/005_login_trigger.pl

commit   : 47ab5d2e2ec762c9a07b4e07f0207b8230a489c1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 03:57:43 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 03:57:43 +0300    

Click here for diff

Per buildfarm member longfin.  

M src/test/authentication/t/005_login_trigger.pl

Add a few recent commits to .git-blame-ignore-revs

commit   : 20b7708662c49af3cfceb23316f7448fa2cf797c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 09:41:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 09:41:59 +0900    

Click here for diff

Three commits need to be added compared to the last time this file was  
updated:  
- e9718b4bd3e4  
- 01529c704008  
- b6a77c6a6ccf  

M .git-blame-ignore-revs

Fix code indentation violations in e83d1b0c40cc

commit   : e9718b4bd3e4234ffd5a4907a903367fc483c843    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 09:36:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Oct 2023 09:36:31 +0900    

Click here for diff

koel has not reported this one yet, I have just bumped on it while  
looking at a different patch.  

M src/backend/commands/event_trigger.c

Fix comment from commit 22655aa231.

commit   : 01529c7040088db2718628d0814058598152bd39    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 13:23:51 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 13:23:51 +1300    

Click here for diff

Per automated complaint from BF animal koel this needed to be  
re-indented, but there was also a typo.  Back-patch to 16.  

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

Add support event triggers on authenticated login

commit   : e83d1b0c40ccda8955f1245087f0697652c4df86    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 03:16:55 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Oct 2023 03:16:55 +0300    

Click here for diff

This commit introduces trigger on login event, allowing to fire some actions  
right on the user connection.  This can be useful for logging or connection  
check purposes as well as for some personalization of environment.  Usage  
details are described in the documentation included, but shortly usage is  
the same as for other triggers: create function returning event_trigger and  
then create event trigger on login event.  
  
In order to prevent the connection time overhead when there are no triggers  
the commit introduces pg_database.dathasloginevt flag, which indicates database  
has active login triggers.  This flag is set by CREATE/ALTER EVENT TRIGGER  
command, and unset at connection time when no active triggers found.  
  
Author: Konstantin Knizhnik, Mikhail Gribkov  
Discussion: https://postgr.es/m/0d46d29f-4558-3af9-9c85-7774e14a7709%40postgrespro.ru  
Reviewed-by: Pavel Stehule, Takayuki Tsunakawa, Greg Nancarrow, Ivan Panchenko  
Reviewed-by: Daniel Gustafsson, Teodor Sigaev, Robert Haas, Andres Freund  
Reviewed-by: Tom Lane, Andrey Sokolov, Zhihong Yu, Sergey Shinderuk  
Reviewed-by: Gregory Stark, Nikita Malakhov, Ted Yu  

M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/event-trigger.sgml
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/postinit.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/commands/event_trigger.h
M src/include/miscadmin.h
M src/include/storage/lmgr.h
M src/include/tcop/cmdtaglist.h
M src/include/utils/evtcache.h
A src/test/authentication/t/005_login_trigger.pl
M src/test/recovery/t/001_stream_rep.pl
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Acquire ControlFileLock in relevant SQL functions.

commit   : c558e6fd92ffeb85d5f52e32ccbcf8a5b5eb7bf3    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 10:43:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 16 Oct 2023 10:43:47 +1300    

Click here for diff

Commit dc7d70ea added functions that read the control file, but didn't  
acquire ControlFileLock.  With unlucky timing, file systems that have  
weak interlocking like ext4 and ntfs could expose partially overwritten  
contents, and the checksum would fail.  
  
Back-patch to all supported releases.  
  
Reviewed-by: David Steele <[email protected]>  
Reviewed-by: Anton A. Melnikov <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/20221123014224.xisi44byq3cf5psi%40awork3.anarazel.de  

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

Dissociate btequalimage() from interval_ops, ending its deduplication.

commit   : 5f27b5f848a433ba54c521ccb889788b8f4d6ba7    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 14 Oct 2023 16:33:51 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 14 Oct 2023 16:33:51 -0700    

Click here for diff

Under interval_ops, some equal values are distinguishable.  One such  
pair is '24:00:00' and '1 day'.  With that being so, btequalimage()  
breaches the documented contract for the "equalimage" btree support  
function.  This can cause incorrect results from index-only scans.  
Users should REINDEX any btree indexes having interval-type columns.  
After updating, pg_amcheck will report an error for almost all such  
indexes.  This fix makes interval_ops simply omit the support function,  
like numeric_ops does.  Back-pack to v13, where btequalimage() first  
appeared.  In back branches, for the benefit of old catalog content,  
btequalimage() code will return false for type "interval".  Going  
forward, back-branch initdb will include the catalog change.  
  
Reviewed by Peter Geoghegan.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_opfamily.dat
M src/test/regress/expected/opr_sanity.out

Don't spuriously report FD_SETSIZE exhaustion on Windows.

commit   : 90ebcc32d9829204bfd15db82ece3aacd84f40d6    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 14 Oct 2023 15:54:46 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 14 Oct 2023 15:54:46 -0700    

Click here for diff

Starting on 2023-08-03, this intermittently terminated a "pgbench -C"  
test in CI.  It could affect a high-client-count "pgbench" without "-C".  
While parallel reindexdb and vacuumdb reach the same problematic check,  
sufficient client count and/or connection turnover is less plausible for  
them.  Given the lack of examples from the buildfarm or from manual  
builds, reproducing this must entail rare operating system  
configurations.  Also correct the associated error message, which was  
wrong for non-Windows.  Back-patch to v12, where the pgbench check first  
appeared.  While v11 vacuumdb has the problematic check, reaching it  
with typical vacuumdb usage is implausible.  
  
Reviewed by Thomas Munro.  
  
Discussion: https://postgr.es/m/CA+hUKG+JwvTNdcyJTriy9BbtzF1veSRQ=9M_ZKFn9_LqE7Kp7Q@mail.gmail.com  

M src/bin/pgbench/pgbench.c
M src/fe_utils/parallel_slot.c

Harden xxx_is_visible() functions against concurrent object drops.

commit   : fcdd6689d09c3950efa8a79db872f507069adb92    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2023 16:13:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2023 16:13:11 -0400    

Click here for diff

For the same reasons given in commit 403ac226d, adjust these  
functions to not assume that checking SearchSysCacheExists can  
guarantee success of a later fetch.  
  
This follows the same internal API choices made in the earlier commit:  
add a function XXXExt(oid, is_missing) and use that to eliminate  
the need for a separate existence check.  The changes are very  
straightforward, though tedious.  For the moment I just made the new  
functions static in namespace.c, but we could export them if a need  
emerges.  
  
Per bug #18014 from Alexander Lakhin.  Given the lack of hard evidence  
that there's a bug in non-debug builds, I'm content to fix this only  
in HEAD.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/include/catalog/namespace.h

Harden has_xxx_privilege() functions against concurrent object drops.

commit   : 403ac226ddd6071245b7b283861c26960ea7293f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2023 14:49:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2023 14:49:50 -0400    

Click here for diff

The versions of these functions that accept object OIDs are supposed  
to return NULL, rather than failing, if the target object has been  
dropped.  This makes it safe(r) to use them in queries that scan  
catalogs, since the functions will be applied to objects that are  
visible in the query's snapshot but might now be gone according to  
the catalog snapshot.  In most cases we implemented this by doing  
a SearchSysCacheExists test and assuming that if that succeeds, we  
can safely invoke the appropriate aclchk.c function, which will  
immediately re-fetch the same syscache entry.  It was argued that  
if the existence test succeeds then the followup fetch must succeed  
as well, for lack of any intervening AcceptInvalidationMessages call.  
  
Alexander Lakhin demonstrated that this is not so when  
CATCACHE_FORCE_RELEASE is enabled: the syscache entry will be forcibly  
dropped at the end of SearchSysCacheExists, and then it is possible  
for the catalog snapshot to get advanced while re-fetching the entry.  
Alexander's test case requires the operation to happen inside a  
parallel worker, but that seems incidental to the fundamental problem.  
What remains obscure is whether there is a way for this to happen in a  
non-debug build.  Nonetheless, CATCACHE_FORCE_RELEASE is a very useful  
test methodology, so we'd better make the code safe for it.  
  
After some discussion we concluded that the most future-proof fix  
is to give up the assumption that checking SearchSysCacheExists can  
guarantee success of a later fetch.  At best that assumption leads  
to fragile code --- for example, has_type_privilege appears broken  
for array types even if you believe the assumption holds.  And it's  
not even particularly efficient.  
  
There had already been some work towards extending the aclchk.c  
APIs to include "is_missing" output flags, so this patch extends  
that work to cover all the aclchk.c functions that are used by the  
has_xxx_privilege() functions.  (This allows getting rid of some  
ad-hoc decisions about not throwing errors in certain places in  
aclchk.c.)  
  
In passing, this fixes the has_sequence_privilege() functions to  
provide the same guarantees as their cousins: for some reason the  
SearchSysCacheExists tests never got added to those.  
  
There is more work to do to remove the unsafe coding pattern with  
SearchSysCacheExists in other places, but this is a pretty  
self-contained patch so I'll commit it separately.  
  
Per bug #18014 from Alexander Lakhin.  Given the lack of hard evidence  
that there's a bug in non-debug builds, I'm content to fix this only  
in HEAD.  (Perhaps we should clean up the has_sequence_privilege()  
oversight in the back branches, but in the absence of field complaints  
I'm not too excited about that either.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/utils/adt/acl.c
M src/include/utils/acl.h

Fix bulk table extension when copying into multiple partitions

commit   : 22655aa23132a0645fdcdce4b233a1fff0c0cf8f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2023 19:06:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2023 19:06:19 -0700    

Click here for diff

When COPYing into a partitioned table that does now permit the use of  
table_multi_insert(), we could error out with  
  ERROR: could not read block NN in file "base/...": read only 0 of 8192 bytes  
  
because BulkInsertState->next_free was not reset between partitions. This  
problem occurred only when not able to use table_multi_insert(), as a  
dedicated BulkInsertState for each partition is used in that case.  
  
The bug was introduced in 00d1e02be24, but it was hard to hit at that point,  
as commonly bulk relation extension is not used when not using  
table_multi_insert(). It became more likely after 82a4edabd27, which expanded  
the use of bulk extension.  
  
To fix the bug, reset the bulk relation extension state in BulkInsertState in  
ReleaseBulkInsertStatePin(). That was added (in b1ecb9b3fcf) to tackle a very  
similar issue.  Obviously the name is not quite correct, but there might be  
external callers, and bulk insert state needs to be reset in precisely in the  
situations that ReleaseBulkInsertStatePin() already needed to be called.  
  
Medium term the better fix likely is to disallow reusing BulkInsertState  
across relations.  
  
Add a test that, without the fix, reproduces #18130 in most  
configurations. The test also catches the problem fixed in b1ecb9b3fcf when  
run with small shared_buffers.  
  
Reported-by: Ivan Kolombet <[email protected]>  
Analyzed-by: Tom Lane <[email protected]>  
Analyzed-by: Andres Freund <[email protected]>  
Bug: #18130  
Discussion: https://postgr.es/m/18130-7a86a7356a75209d%40postgresql.org  
Discussion: https://postgr.es/m/257696.1695670946%40sss.pgh.pa.us  
Backpatch: 16-  

M src/backend/access/heap/heapam.c
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

Improve the naming in wal_sync_method code.

commit   : 8d140c58229d6224882f881d9b62ba06236e71d3    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 13 Oct 2023 15:16:45 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 13 Oct 2023 15:16:45 -0500    

Click here for diff

* sync_method is renamed to wal_sync_method.  
  
* sync_method_options[] is renamed to wal_sync_method_options[].  
  
* assign_xlog_sync_method() is renamed to assign_wal_sync_method().  
  
* The names of the available synchronization methods are now  
  prefixed with "WAL_SYNC_METHOD_" and have been moved into a  
  WalSyncMethod enum.  
  
* PLATFORM_DEFAULT_SYNC_METHOD is renamed to  
  PLATFORM_DEFAULT_WAL_SYNC_METHOD, and DEFAULT_SYNC_METHOD is  
  renamed to DEFAULT_WAL_SYNC_METHOD.  
  
These more descriptive names help distinguish the code for  
wal_sync_method from the code for DataDirSyncMethod (e.g., the  
recovery_init_sync_method configuration parameter and the  
--sync-method option provided by several frontend utilities).  This  
change also prevents name collisions between the aforementioned  
sets of code.  Since this only improves the naming of internal  
identifiers, there should be no behavior change.  
  
Author: Maxim Orlov  
Discussion: https://postgr.es/m/CACG%3DezbL1gwE7_K7sr9uqaCGkWhmvRTcTEnm3%2BX1xsRNwbXULQ%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/include/access/xlog.h
M src/include/access/xlogdefs.h
M src/include/port/freebsd.h
M src/include/port/linux.h
M src/include/utils/guc_hooks.h
M src/tools/pgindent/typedefs.list

Update oldextversions test for pg_stat_statements 1.11

commit   : c5a032e518acc259d31d5e7bd85acdea3b4e9c93    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Oct 2023 13:50:18 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Oct 2023 13:50:18 +0200    

Click here for diff

Commit 5a3423ad8e updated pg_stat_statements to 1.11 due to added  
columns in the view for jit deform counters. Fixing oldextversion  
was however missed in that commit.  This adds a test for the 1.11  
version view definition.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/CAN55FZ2Y7c2VEg4S1KDXFcaHjyF8=KZa_rMV6WOe+KwE-KE97g@mail.gmail.com  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/sql/oldextversions.sql

commit   : 536f410111fc9b4a9e052ac53826f479acfca2f5    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 13 Oct 2023 12:13:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 13 Oct 2023 12:13:46 +0530    

Click here for diff

The logical replication pages in the docs mostly have links to  
corresponding pub/sub commands whenever they are mentioned, but there were  
some omissions. This patch adds the missing links.  
  
Author: Peter Smith  
Reviewed-by: Vignesh C, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPu2S4RdzYKR7H5_E7QYWyq5hB0hL4EFrYbP91Qso62jeg%40mail.gmail.com  

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

psql: Add completion support for AT [ LOCAL | TIME ZONE ]

commit   : d16eb83aba2e0abdc809ecffd51cc00a1beab7b8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 14:19:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 14:19:07 +0900    

Click here for diff

AT TIME ZONE is completed with a list of supported timezones, something  
not needed by AT LOCAL.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Jim Jones  
Discussion: https://postgr.es/m/[email protected]  

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

Add support for AT LOCAL

commit   : 97957fdbaa429c7c582d4753b108cb1e23e1b28a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 13:01:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 13:01:37 +0900    

Click here for diff

When converting a timestamp to/from with/without time zone, the SQL  
Standard specifies an AT LOCAL variant of AT TIME ZONE which uses the  
session's time zone.  This includes three system functions able to do  
the work in the same way as the existing flavors for AT TIME ZONE,  
except that these need to be marked as stable as they depend on the  
session's TimeZone GUC.  
  
Bump catalog version.  
  
Author: Vik Fearing  
Reviewed-by: Laurenz Albe, Cary Huang, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/parser/gram.y
M src/backend/utils/adt/date.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/timestamptz.out
M src/test/regress/expected/timetz.out
M src/test/regress/sql/timestamptz.sql
M src/test/regress/sql/timetz.sql

Add wait events for checkpoint delay mechanism.

commit   : 0013ba290b6684d095d93517ff2ca1fadf79bdb9    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Oct 2023 16:43:22 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Oct 2023 16:43:22 +1300    

Click here for diff

When MyProc->delayChkptFlags is set to temporarily block phase  
transitions in a concurrent checkpoint, the checkpointer enters a  
sleep-poll loop to wait for the flag to be cleared.  We should show that  
as a wait event in the pg_stat_activity view.  
  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGL7Whi8iwKbzkbn_1fixH3Yy8aAPz7mfq6Hpj7FeJrKMg%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/utils/activity/wait_event_names.txt

doc: Mention timezone(zone, time) in section for AT TIME ZONE

commit   : 7e1f544827ec843918f189765863269ff3a1c77e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 10:55:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Oct 2023 10:55:25 +0900    

Click here for diff

timezone(zone, timestamp) is already mentioned as an equivalent of the  
two first patterns in the table describing the AT TIME ZONE variants,  
but did not mention the third case about "time" and its equivalent as an  
SQL function, so let's be consistent here.  
  
Extracted from a larger patch by the same author.  
  
Author: Vik Fearing  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Unify two isLogSwitch tests in XLogInsertRecord.

commit   : df9a3d4e99941f66f7a247eb01a48c1c2630625d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 10 Oct 2023 11:30:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 10 Oct 2023 11:30:20 -0400    

Click here for diff

An upcoming patch wants to introduce an additional special case in  
this function. To keep that as cheap as possible, minimize the amount  
of branching that we do based on whether this is an XLOG_SWITCH  
record.  
  
Additionally, and also in the interest of keeping the overhead of  
special-case code paths as low as possible, apply likely() to the  
non-XLOG_SWITCH case, since only a very tiny fraction of WAL records  
will be XLOG_SWITCH records.  
  
Patch by me, reviewed by Dilip Kumar, Amit Kapila, Andres Freund,  
and Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoYy-Vc6G9QKcAKNksCa29cv__czr+N9X_QCxEfQVpp_8w@mail.gmail.com  

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

Fix runtime partition pruning for HASH partitioned tables

commit   : d9e46dfb78abf4d3be6071b8c4495df9e1bb4706    
  
author   : David Rowley <[email protected]>    
date     : Fri, 13 Oct 2023 01:12:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 13 Oct 2023 01:12:31 +1300    

Click here for diff

This could only affect HASH partitioned tables with at least 2 partition  
key columns.  
  
If partition pruning was delayed until execution and the query contained  
an IS NULL qual on one of the partitioned keys, and some subsequent  
partitioned key was being compared to a non-Const, then this could result  
in a crash due to the incorrect keyno being used to calculate the  
stateidx for the expression evaluation code.  
  
Here we fix this by properly skipping partitioned keys which have a  
nullkey set.  Effectively, this must be the same as what's going on  
inside perform_pruning_base_step().  
  
Sergei Glukhov also provided a patch, but that's not what's being used  
here.  
  
Reported-by: Sergei Glukhov  
Reviewed-by: tender wang, Sergei Glukhov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11, where runtime partition pruning was added.  

M src/backend/executor/execPartition.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Doc: fix grammatical errors for enable_partitionwise_aggregate

commit   : dab5538f0bfc4cca76396f5d510e2df6f5350d4c    
  
author   : David Rowley <[email protected]>    
date     : Thu, 12 Oct 2023 21:15:28 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 12 Oct 2023 21:15:28 +1300    

Click here for diff

Author: Andrew Atkinson  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAG6XLEnC%3DEgq0YHRic2kWWDs4xwQnQ_kBA6qhhzAq1-pO_9Tfw%40mail.gmail.com  
Backpatch-through: 11, where enable_partitionwise_aggregate was added  

M doc/src/sgml/config.sgml

Fix incorrect step generation in HASH partition pruning

commit   : f0c409d9c7a6a92bb4a6b5812ffc5ef94b4c8ed0    
  
author   : David Rowley <[email protected]>    
date     : Thu, 12 Oct 2023 19:50:38 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 12 Oct 2023 19:50:38 +1300    

Click here for diff

get_steps_using_prefix_recurse() incorrectly assumed that it could stop  
recursive processing of the 'prefix' list when cur_keyno was one before  
the step_lastkeyno.  Since hash partition pruning can prune using IS  
NULL quals, and these IS NULL quals are not present in the 'prefix'  
list, then that logic could cause more levels of recursion than what is  
needed and lead to there being no more items in the 'prefix' list to  
process.  This would manifest itself as a crash in some code that  
expected the 'start' ListCell not to be NULL.  
  
Here we adjust the logic so that instead of stopping recursion at 1 key  
before the step_lastkeyno, we just look at the llast(prefix) item and  
ensure we only recursively process up until just before whichever the last  
key is.  This effectively allows keys to be missing in the 'prefix' list.  
  
This change does mean that step_lastkeyno is no longer needed, so we  
remove that from the static functions.  I also spent quite some time  
reading this code and testing it to try to convince myself that there  
are no other issues.  That resulted in the irresistible temptation of  
rewriting some comments, many of which were just not true or inconcise.  
  
Reported-by: Sergei Glukhov  
Reviewed-by: Sergei Glukhov, tender wang  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11, where partition pruning was introduced.  

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

Add option to bgworkers to allow the bypass of role login check

commit   : e7689190b3d58404abbafe2d3312c3268a51cca3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Oct 2023 09:24:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Oct 2023 09:24:17 +0900    

Click here for diff

This adds a new option called BGWORKER_BYPASS_ROLELOGINCHECK to the  
flags available to BackgroundWorkerInitializeConnection() and  
BackgroundWorkerInitializeConnectionByOid().  
  
This gives the possibility to bgworkers to bypass the role login check,  
making possible the use of a role that has no login rights while not  
being a superuser.  PostgresInit() gains a new flag called  
INIT_PG_OVERRIDE_ROLE_LOGIN, taking advantage of the refactoring done in  
4800a5dfb4c4.  
  
Regression tests are added to worker_spi to check the behavior of this  
new option with bgworkers.  
  
Author: Bertrand Drouvot  
Reviewed-by: Nathan Bossart, Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h
M src/include/postmaster/bgworker.h
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi.c

Reindent comment in GenericXLogFinish().

commit   : b6a77c6a6ccf698787201b001cbbbf9c89fe5715    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2023 17:14:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2023 17:14:31 -0400    

Click here for diff

Restore pgindent cleanliness, per buildfarm member koel.  

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

Fix missed optimization in relation_excluded_by_constraints().

commit   : 5d8aa8bcedae7376bd97e79052d606db4e4f8dd4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2023 12:51:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2023 12:51:38 -0400    

Click here for diff

In commit 3fc6e2d7f, I (tgl) argued that we only need to check for  
a constant-FALSE restriction clause when there's exactly one  
restriction clause, on the grounds that const-folding would have  
thrown away anything ANDed with a Const FALSE.  That's true just after  
const-folding has been applied, but subsequent processing such as  
equivalence class expansion could result in cases where a Const FALSE  
is ANDed with some other stuff.  (Compare for instance joinrels.c's  
restriction_is_constant_false.)  Hence, tweak this logic to check all  
the elements of the baserestrictinfo list, not just one; that's cheap  
enough to not be worth worrying about.  
  
There is one existing test case where this visibly improves the plan.  
There would not be any savings in runtime, but the planner effort and  
executor startup effort will be reduced, and anyway it's odd that  
we can detect related cases but not this one.  
  
Richard Guo (independently discovered by David Rowley)  
  
Discussion: https://postgr.es/m/CAMbWs4_x3-CnVVrCboS1LkEhB5V+W7sLSCabsRiG+n7+5_kqbg@mail.gmail.com  

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

Move canAcceptConnections check from ProcessStartupPacket to caller.

commit   : 16671ba6e717ea307a3f61e8ab4f866cd6834772    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Oct 2023 14:06:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Oct 2023 14:06:38 +0300    

Click here for diff

The check is not about processing the startup packet, so the calling  
function seems like a more natural place. I'm also working on a patch  
that moves 'canAcceptConnections' out of the Port struct, and this  
makes that refactoring more convenient.  
  
Reviewed-by: Tristan Partin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c

Improve some wording in pg_upgrade/IMPLEMENTATION

commit   : c7c801ef3ba067aedc0288c17fe463c4f42e5623    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Oct 2023 13:54:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Oct 2023 13:54:33 +0900    

Click here for diff

Author: Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4VFKtKrb78fBnMXwHvOu4a+-7y86siBSEety2knti2eGA@mail.gmail.com  

M src/bin/pg_upgrade/IMPLEMENTATION

Refactor InitPostgres() to use bitwise option flags

commit   : 4800a5dfb4c46d22b5d05f16c615bea6ff24a2bb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Oct 2023 12:31:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Oct 2023 12:31:49 +0900    

Click here for diff

InitPostgres() has been using a set of boolean arguments to control its  
behavior, and a patch under discussion was aiming at expanding it with a  
third one.  In preparation for expanding this area, this commit switches  
all the current boolean arguments of this routine to a single bits32  
argument instead.  Two values are currently supported for the flags:  
- INIT_PG_LOAD_SESSION_LIBS to load [session|local]_preload_libraries at  
startup.  
- INIT_PG_OVERRIDE_ALLOW_CONNS to allow connection to a database even if  
it has !datallowconn.  This is used by bgworkers.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

doc: pg_upgrade: use dynamic new cluster major version numbers

commit   : 28139037c06df7225aef189f95a8425d7990be26    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 17:12:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 17:12:00 -0400    

Click here for diff

Also update docs to use more recent old version numbers  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16  

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

doc: clarify that SSPI and GSSAPI are interchangeable

commit   : 8a6d68fc6849633a01d18d49e0c1911893ffb2b1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:51:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:51:08 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/167846222574.1803490.15815104179136215862@wrigleys.postgresql.org  
  
Backpatch-through: 11  

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

doc: Move CREATE ROLE's IN GROUP and USER to deprecated

commit   : 8e78f0a159bc43e2c1eb8b9597d59bc6c154467b    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:44:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:44:02 -0400    

Click here for diff

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

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

doc: foreign servers with pushdown need matching collation

commit   : 914599e569966a86ac131db47a5c61e47f5cdca2    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:04:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 16:04:56 -0400    

Click here for diff

Reported-by: Pete Storer  
  
Discussion: https://postgr.es/m/BL0PR05MB66283C57D72E321591AE4EB1F3CE9@BL0PR05MB6628.namprd05.prod.outlook.com  
  
Backpatch-through: 11  

M doc/src/sgml/ref/create_server.sgml

doc: add SSL configuration section reference

commit   : 2cb69f6bc539b1d06b9c81da84daf7d7504011f2    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:54:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:54:29 -0400    

Click here for diff

Reported-by: Steve Atkins  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

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

doc: clarify how the bootstrap user name is chosen

commit   : 8209605966c330451314fe7899539fa40a4123d1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:27:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:27:26 -0400    

Click here for diff

Discussion: https://postgr.es/m/167931662853.3349090.18217722739345182859@wrigleys.postgresql.org  
  
Backpatch-through: 16  

M doc/src/sgml/user-manag.sgml

doc: document the need to analyze partitioned tables

commit   : 7454502f94f6b8addff867f38aa5166eb82c79dc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:14:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 Oct 2023 15:14:19 -0400    

Click here for diff

Autovacuum does not do it.  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/maintenance.sgml

Fix bug in GenericXLogFinish().

commit   : ef74c7197c04be4c34d1b2a426a9b1935a7f3a43    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 10 Oct 2023 11:01:13 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 10 Oct 2023 11:01:13 -0700    

Click here for diff

Mark the buffers dirty before writing WAL.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Heikki Linnakangas  
Backpatch-through: 11  

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

Replace has_multiple_baserels() with a bitmap test on all_baserels.

commit   : 14661ba1a7a6b0f82b8451cbb51a5c2a11676635    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2023 13:08:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2023 13:08:29 -0400    

Click here for diff

Since we added the PlannerInfo.all_baserels set, it's not really  
necessary to grovel over the rangetable to count baserels in the  
current query.  So let's drop has_multiple_baserels() in favor  
of a bms_membership() test.  This might be microscopically  
faster, but the main point is to remove some unnecessary code.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4_8RcSbbfs1ASZLrMuL0c0EQgXWcoLTQD8swBRY_pQQiA@mail.gmail.com  

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

test_decoding: Remove unnecessary table in twophase test

commit   : 98e89740e5a816f9ef2b71b1a1b62a9aff23d194    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Oct 2023 17:49:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Oct 2023 17:49:22 +0900    

Click here for diff

The end of this test is dropping all the relations created but forgot  
about this one.  This is not critical, but let's be clean, and the test  
expects a cleanup, as documented.  
  
Author: Nishant Sharma  
Discussion: https://postgr.es/m/CADrsxdb0ueGV9nrC6s8zvXLkGUhnEjx7Ou_p5wo38TvmSvF83A@mail.gmail.com  

M contrib/test_decoding/expected/twophase.out
M contrib/test_decoding/sql/twophase.sql

pg_resetwal: Corrections around -c option

commit   : e3679bc1c31add8fa29a9dedd10fe6c563efde79    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Oct 2023 08:58:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Oct 2023 08:58:50 +0200    

Click here for diff

The present pg_resetwal code hardcodes the minimum value for -c as 2,  
which is FrozenTransactionId, but it's not clear why that is allowed.  
After some research, it was probably a mistake in the original patch.  
Change it to FirstNormalTransactionId, which matches other xid-related  
options in pg_resetwal.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d09f0e91-8757-642b-1a92-da9a52f5589a%40eisentraut.org  

M src/bin/pg_resetwal/pg_resetwal.c

Add const to values and nulls arguments

commit   : 1d91d24d9a831be0bb90ec71934f735c52456c57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Oct 2023 07:50:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Oct 2023 07:50:15 +0200    

Click here for diff

This excludes any changes that would change the external AM APIs.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/14c31f4a-0347-0805-dce8-93a9072c05a5%40eisentraut.org  

M src/backend/access/brin/brin.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashsort.c
M src/backend/access/index/genam.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/toast_helper.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execTuples.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/spgist_private.h
M src/include/access/toast_helper.h
M src/include/executor/executor.h
M src/include/partitioning/partbounds.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h

Fix possible crash in add_paths_to_append_rel()

commit   : fc4089f3c65a5f1b413a3299ba02b66a8e5e37d0    
  
author   : David Rowley <[email protected]>    
date     : Tue, 10 Oct 2023 16:50:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 10 Oct 2023 16:50:03 +1300    

Click here for diff

While working on a8a968a82, I failed to consider that  
cheapest_startup_path can be NULL when there is no non-parameterized  
path in the pathlist.  This is well documented in set_cheapest(), I just  
failed to notice.  
  
Here we adjust the code to just check if the RelOptInfo has a  
cheapest_startup_path set before adding it to the startup_subpaths list.  
  
Reported-by: Richard Guo  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49w3t03V69XhdCuw+GDwivny4uQUxrkVp6Gejaspt0wMQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Revert "Optimize various aggregate deserialization functions"

commit   : 4f3b56eea23554e1756a26080db273156f23f4f2    
  
author   : David Rowley <[email protected]>    
date     : Tue, 10 Oct 2023 14:16:54 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 10 Oct 2023 14:16:54 +1300    

Click here for diff

This reverts commit 608fd198def5390c3490bfe903730207dfd8eeb4.  
  
On 2nd thoughts, the StringInfo API requires that strings are NUL  
terminated and pointing directly to the data in a bytea Datum isn't NUL  
terminated.  
  
Discussion: https://postgr.es/m/CAApHDvorfO3iBZ=xpiZvp3uHtJVLyFaPBSvcAhAq2HPLnaNSwQ@mail.gmail.com  

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

worker_spi: Fix another stability issue with BGWORKER_BYPASS_ALLOWCONN

commit   : f483b209056b4181eb33b97cd6a30910a73c0f87    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Oct 2023 09:04:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Oct 2023 09:04:28 +0900    

Click here for diff

worker_spi_launch() may report that a worker stopped when it fails to  
connect on a database that does not allow connections if the worker  
exits before the SQL function checks for the current status of the  
worker.  The test is switched to use Cluster::psql instead of  
safe_psql() so as it does not fail hard when this query errors.  While  
on it, this removes a query that looks at pg_stat_activity to simplify  
the test, as a check on the contents of the server logs achieves the  
same when the worker cannot connect to the database without  
datallowconn.  
  
Per buildfarm members kestrel, mamba and serinus.  Bonus thanks to Tom  
Lane for providing the logs of the failure from mamba that the buildfarm  
was not able to show up.  Note that I have reproduced the failure with a  
hardcoded stop point.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/t/001_worker_spi.pl

Doc: use CURRENT_USER not USER in plpgsql trigger examples.

commit   : 64aad6944c8d331ceb6a0b2df73bf70c5adaf35b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Oct 2023 11:29:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Oct 2023 11:29:21 -0400    

Click here for diff

While these two built-in functions do exactly the same thing,  
CURRENT_USER seems preferable to use in documentation examples.  
It's easier to look up if the reader is unsure what it is.  
Also, this puts these examples in sync with an adjacent example  
that already used CURRENT_USER.  
  
Per question from Kirk Parker.  
  
Discussion: https://postgr.es/m/CANwZ8rmN_Eb0h0hoMRS8Feftaik0z89PxVsKg+cP+PctuOq=Qg@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml

Rename StartBackgroundWorker() to BackgroundWorkerMain().

commit   : 637109d13ab2684aa7ad4e893137e7487b5e8490    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:52:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:52:09 +0300    

Click here for diff

The comment claimed that it is "called from postmaster", but it is  
actually called in the child process, pretty early in the process  
initialization. I guess you could interpret "called from postmaster"  
to mean that, but it seems wrong to me. Rename the function to be  
consistent with other functions with similar role.  
  
Reviewed-by: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/include/postmaster/bgworker_internals.h

Allocate Backend structs in PostmasterContext.

commit   : 0bbafb534275686e780aae2964382e56321c61af    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:23:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:23:50 +0300    

Click here for diff

The child processes don't need them. By allocating them in  
PostmasterContext, the memory gets free'd and is made available for  
other stuff in the child processes.  
  
Reviewed-by: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Clarify the checks in RegisterBackgroundWorker.

commit   : 1ca312686e4c4b270cb598429983a07c73a5c44a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:23:47 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Oct 2023 11:23:47 +0300    

Click here for diff

In EXEC_BACKEND or single-user mode, we process  
shared_preload_libraries at postmaster startup as usual, but also at  
backend startup. When a library calls RegisterBackgroundWorker() when  
being loaded into a backend process, we go through the motions to add  
the worker to BackgroundWorkerList, even though that is a  
postmaster-private data structure. Make it return early when called in  
a backend process, without changing BackgroundWorkerList.  
  
You could argue that it was intentional: In non-EXEC_BACKEND mode, the  
backend processes inherit BackgroundWorkerList at fork(), so it does  
make some sense to initialize it to the same state in EXEC_BACKEND  
mode, too. It's clearly a postmaster-private structure, though, and  
all the functions that use it are clearly marked as "should only be  
called in postmaster".  
  
You could also argue that libraries should not call  
RegisterBackgroundWorker() during backend startup. It's too late to  
correctly register any static background workers at that stage. But  
it's a common pattern in extensions, and it doesn't seem worth the  
churn to require all extensions to change it.  
  
Another sloppiness was the exception for "internal" background  
workers. We checked that RegisterBackgroundWorker() was called during  
shared_preload_libraries processing, or the background worker was an  
internal one. That exception was made in commit 665d1fad99 to allow  
postmaster to register the logical apply launcher in  
ApplyLauncherRegister(). The way the check was written, it would not  
complain if you registered an internal background worker in a regular  
backend process. But it would complain if postmaster registered a  
background worker defined in a shared library, outside  
shared_preload_libraries processing. I think the correct rule is that  
you can only register static background workers in the postmaster  
process, and only before the bgworker shared memory array has been  
initialized. Check for that more directly.  
  
Reviewed-by: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/bgworker.c

Optimize various aggregate deserialization functions

commit   : 608fd198def5390c3490bfe903730207dfd8eeb4    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 17:25:16 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 17:25:16 +1300    

Click here for diff

The serialized representation of an internal aggregate state is a bytea  
value.  In each deserial function, in order to "receive" the bytea value  
we appended it onto a short-lived StringInfoData using  
appendBinaryStringInfo.  This was a little wasteful as it meant having to  
palloc memory, copy a (possibly long) series of bytes then later pfree  
that memory.  Instead of going to this extra trouble, we can just fake up  
a StringInfoData and point the data directly at the bytea's payload.  This  
should help increase the performance of internal aggregate  
deserialization.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAApHDvr=e-YOigriSHHm324a40HPqcUhSp6pWWgjz5WwegR=cQ@mail.gmail.com  

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

Remove duplicate words in docs and code comments.

commit   : 7cc2f59dd57ab275497ae42a4f98e7936e1e3723    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 9 Oct 2023 09:18:47 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 9 Oct 2023 09:18:47 +0530    

Click here for diff

Additionally, add a missing "the" in a couple of places.  
  
Author: Vignesh C, Dagfinn Ilmari Mannsåker  
Discussion: http://postgr.es/m/CALDaNm28t+wWyPfuyqEaARS810Je=dRFkaPertaLAEJYY2cWYQ@mail.gmail.com  

M .cirrus.star
M contrib/citext/expected/citext_utf8.out
M contrib/citext/expected/citext_utf8_1.out
M contrib/citext/sql/citext_utf8.sql
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/transam/xlogreader.c
M src/backend/executor/nodeHashjoin.c
M src/test/regress/expected/tuplesort.out
M src/test/regress/sql/tuplesort.sql

Strip off ORDER BY/DISTINCT aggregate pathkeys in create_agg_path

commit   : d8a295389baee766df882f8f934e205b5978b529    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 16:37:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 16:37:05 +1300    

Click here for diff

1349d2790 added code to adjust the PlannerInfo.group_pathkeys so that  
ORDER BY / DISTINCT aggregate functions could obtain pre-sorted inputs  
to allow faster execution.  That commit forgot to adjust the pathkeys in  
create_agg_path().  Some code in there assumed that it was always fine  
to make the AggPath's pathkeys the same as its subpath's.  That seems to  
have been ok up until 1349d2790, but since that commit adds pathkeys for  
columns which are within the aggregate function, those columns won't be  
available above the aggregate node.  This can result in "could not find  
pathkey item to sort" during create_plan().  
  
The fix here is to strip off the additional pathkeys added by  
adjust_group_pathkeys_for_groupagg().  It seems that the pathkeys here  
will only ever be group_pathkeys, so all we need to do is check if the  
length of the pathkey list is longer than the num_groupby_pathkeys and  
get rid of the additional ones only if we see extras.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/ZQhYYRhUxpW3PSf9%40telsasoft.com  
Backpatch-through: 16, where 1349d2790 was introduced  

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

Remove debug_print_rel and replace usages with pprint

commit   : 77db132637661f6e01497959128fb650330552b4    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 15:53:16 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Oct 2023 15:53:16 +1300    

Click here for diff

Going by c4a1933b4, b33ef397a and 05893712c (to name just a few), it seems  
that maintaining debug_print_rel() is often forgotten.  In the case of  
c4a1933b4, it was several years before anyone noticed that a path type  
was not handled by debug_print_rel().  (debug_print_rel() is only  
compiled when building with OPTIMIZER_DEBUG).  
  
After a quick survey on the pgsql-hackers mailing list, nobody came  
forward to admit that they use OPTIMIZER_DEBUG.  So to prevent any future  
maintenance neglect, let's just remove debug_print_rel() and have  
OPTIMIZER_DEBUG make use of pprint() instead (as suggested by Tom Lane).  
If anyone wants to come forward to claim they make use of  
OPTIMIZER_DEBUG in a way that they need debug_print_rel() then they have  
around 10 months remaining in the v17 cycle where we could revert this.  
If nobody comes forward in that time, then we can likely safely declare  
debug_print_rel() as not worth keeping.  
  
Discussion: https://postgr.es/m/CAApHDvoCdjo8Cu2zEZF4-AxWG-90S+pYXAnoDDa9J3xH-OrczQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/include/optimizer/paths.h

Fix another typo in e0b1ee17dc

commit   : 82a7132f531b8b12e77d17476e9bfd599c3c30cf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 7 Oct 2023 20:36:47 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 7 Oct 2023 20:36:47 +0300    

Click here for diff

Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_kHMJDak75y1kBTirv-drS1-knT-7Mpg5LprAjqRJDVA%40mail.gmail.com  

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

Restore proper linkage of pg_char_to_encoding() and friends.

commit   : b6c7cfac88c47a9194d76f3d074129da3c46545a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2023 12:08:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2023 12:08:10 -0400    

Click here for diff

Back in the 8.3 era we discovered that it was problematic if  
libpq.so had encoding ID assignments different from the backend,  
which is possible because on some platforms libpq.so might be  
of a different major version from the calling programs.  
psql should use libpq's assignments, but initdb has to use the  
backend's, else it will put wrong values into pg_database.  
The solution devised in commit 8468146b0 relied on giving initdb  
its own copy of encnames.c rather than relying on the functions  
exported by libpq.  Later, that metamorphosed into ensuring that  
libpgcommon got linked before libpq -- which made things OK for  
initdb but broke psql.  We didn't notice for lack of any changes  
in enum pg_enc since then.  Commit 06843df4a reversed that, fixing  
the latent bug in psql but adding one in initdb.  The meson build  
infrastructure is also not being sufficiently careful about link  
order, and trying to make it so would be equally fragile.  
  
Hence, let's use a new scheme based on giving the libpq-exported  
symbols different real names than the same functions exported from  
libpgcommon.a or libpgcommon_srv.a.  (We could distinguish those  
two cases as well, but there seems no need to.)  libpq gets the  
official names to avoid an ABI break for libpq clients, while the  
other cases use #define's to make the real names "xxx_private"  
rather than "xxx".  By controlling where the #define's are  
applied, we can force any particular client program to use one  
set or the other of the encnames.c functions.  
  
We cannot back-patch this, since it'd be an ABI break for backend  
loadable modules, but there seems little need to.  We're just  
trying to ensure that the world is safe for hypothetical future  
additions to enum pg_enc.  
  
In passing this should fix "duplicate symbol" linker warnings  
that we've been seeing on AIX buildfarm members since commit  
06843df4a.  It's not very clear why that linker is complaining  
now, when there were strictly *more* duplicates visible before,  
but in any case this should remove the reason for complaint.  
  
Patch by me; thanks to Andres Freund for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/Makefile
M src/bin/initdb/meson.build
M src/common/Makefile
M src/common/meson.build
M src/include/mb/pg_wchar.h

Fix typos in e0b1ee17dc

commit   : e8c334c47abb6c8f648cb50241c2cd65c9e4e6dc    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 7 Oct 2023 11:55:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 7 Oct 2023 11:55:17 +0300    

Click here for diff

Reported-by: Alexander Lakhin  

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

Add test for checking the line length of --help output

commit   : ffb69b23115a1ca1d81f7e273d50b75154ae7b0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Oct 2023 11:52:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Oct 2023 11:52:05 +0200    

Click here for diff

There was some discussion what the line length should be.  Most output  
currently clearly targets around 80 columns, but the maximum in use  
currently is 95, so we set that as the current maximum.  This just  
ensures that there is some guidance and there are no wild deviations.  
  
based on patch by Atsushi Torikoshi <[email protected]>  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Remove environment-variable-based defaults in psql --help

commit   : b4336515b0803b83a4d8f102006986e5863d2c49    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Oct 2023 10:55:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Oct 2023 10:55:10 +0200    

Click here for diff

This seemed inconsistent with the --help output of other tools.  
Depending on the values, it can cause ugly formatting.  Also, we're  
not getting the defaults from libpq, we're just emulating the methods  
libpq uses to derive these values, so they might not be 100% correct.  
  
Author: Atsushi Torikoshi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/psql/help.c

Remove extra parenthesis from comment.

commit   : aec684ff0fb979d0245985fc0f84c07345a29e18    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 6 Oct 2023 18:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 6 Oct 2023 18:30:00 +0900    

Click here for diff

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

Skip checking of scan keys required for directional scan in B-tree

commit   : e0b1ee17dc3a38ba17fee0fd58b7b834ec934259    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 6 Oct 2023 10:40:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 6 Oct 2023 10:40:51 +0300    

Click here for diff

Currently, B-tree code matches every scan key to every item on the page.  
Imagine the ordered B-tree scan for the query like this.  
  
SELECT * FROM tbl WHERE col > 'a' AND col < 'b' ORDER BY col;  
  
The (col > 'a') scan key will be always matched once we find the location to  
start the scan.  The (col < 'b') scan key will match every item on the page  
as long as it matches the last item on the page.  
  
This patch implements prechecking of the scan keys required for directional  
scan on beginning of page scan.  If precheck is successful we can skip this  
scan keys check for the items on the page.  That could lead to significant  
acceleration especially if the comparison operator is expensive.  
  
Idea from patch by Konstantin Knizhnik.  
  
Discussion: https://postgr.es/m/079c3f8e-3371-abe2-e93c-fc8a0ae3f571%40garret.ru  
Reviewed-by: Peter Geoghegan, Pavel Borisov  

M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Fix crash on syslogger startup

commit   : 5da0a622e88907722ce456d30dbf0565ed7a222b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 6 Oct 2023 10:22:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 6 Oct 2023 10:22:02 +0300    

Click here for diff

When syslogger starts up, ListenSockets is still NULL. Don't try to  
pfree it. Oversight in commit e29c464395.  
  
Reported-by: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/postmaster/postmaster.c

worker_spi: Fix test failure with BGWORKER_BYPASS_ALLOWCONN

commit   : fd4d93d269c02081958e4c0c214f1d82186e5689    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Oct 2023 09:56:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Oct 2023 09:56:55 +0900    

Click here for diff

A bgworker can spawn parallel workers of its own when executing queries,  
and if the worker uses BGWORKER_BYPASS_ALLOWCONN while the database it  
is connected to does not allow connections, a parallel worker would fail  
to startup.  In the case of this module, the step checking for the  
presence of the schema to create was spawning a worker, failing the last  
test introduced by 991bb0f9653c.  
  
This issue could be reproduced with debug_parallel_query = 'regress',  
for example.  
  
Per buildfarm member crake.  

M src/test/modules/worker_spi/worker_spi.c

worker_spi: Add tests for BGWORKER_BYPASS_ALLOWCONN

commit   : 991bb0f9653c61cf116338f295534d1378df2751    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Oct 2023 09:01:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Oct 2023 09:01:27 +0900    

Click here for diff

This bgworker flag exists in the core code since eed1ce72e159, but was  
never tested.  This relies on 4f2994647ff1, that has added a way to  
start dynamic workers with this flag enabled.  
  
Reviewed-by: Bertrand Drouvot, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/t/001_worker_spi.pl

Push attcompression and attstorage handling into BuildDescForRelation()

commit   : 180e3394a7042f6cefa53221bfa224db906671d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    

Click here for diff

This was previously handled by the callers but it can be moved into a  
common place.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Move BuildDescForRelation() from tupdesc.c to tablecmds.c

commit   : 04e485273b56bec0e4637f97c587eca26cf823f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    

Click here for diff

BuildDescForRelation() main job is to convert ColumnDef lists to  
pg_attribute/tuple descriptor arrays, which is really mostly an  
internal subroutine of DefineRelation() and some related functions,  
which is more the remit of tablecmds.c and doesn't have much to do  
with the basic tuple descriptor interfaces in tupdesc.c.  This is also  
supported by observing the header includes we can remove in tupdesc.c.  
By moving it over, we can also (in the future) make  
BuildDescForRelation() use more internals of tablecmds.c that are not  
sensible to be exposed in tupdesc.c.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/common/tupdesc.c
M src/backend/commands/tablecmds.c
M src/include/access/tupdesc.h
M src/include/commands/tablecmds.h

Push attidentity and attgenerated handling into BuildDescForRelation()

commit   : 6d341407a6e34cd6857cf55ee4757397286542db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 16:17:16 +0200    

Click here for diff

Previously, this was handled by the callers separately, but it can be  
trivially moved into BuildDescForRelation() so that it is handled in a  
central place.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/common/tupdesc.c
M src/backend/commands/tablecmds.c

Refactor ListenSocket array.

commit   : e29c46439511a2ba8b447079f2308384a4228c92    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 5 Oct 2023 15:05:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 5 Oct 2023 15:05:25 +0300    

Click here for diff

Keep track of the used size of the array. That avoids looping through  
the whole array in a few places. It doesn't matter from a performance  
point of view since the array is small anyway, but this feels less  
surprising and is a little less code. Now that we have an explicit  
NumListenSockets variable that is statically initialized to 0, we  
don't need the loop to initialize the array.  
  
Allocate the array in PostmasterContext. The array isn't needed in  
child processes, so this allows reusing that memory. We could easily  
make the array resizable now, but we haven't heard any complaints  
about the current 64 sockets limit.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/libpq.h

Improve JsonLexContext's freeability

commit   : 1c99cde2f3440c59f582d45b251412c9a9b54f62    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Oct 2023 10:59:08 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Oct 2023 10:59:08 +0200    

Click here for diff

Previously, the JSON code didn't have to worry too much about freeing  
JsonLexContext, because it was never too long-lived.  With new features  
being added for SQL/JSON this is no longer the case.  Add a routine  
that knows how to free this struct and apply that to a few places, to  
prevent this from becoming problematic.  
  
At the same time, we change the API of makeJsonLexContextCstringLen to  
make it receive a pointer to JsonLexContext for callers that want it to  
be stack-allocated; it can also be passed as NULL to get the original  
behavior of a palloc'ed one.  
  
This also causes an ABI break due to the addition of flags to  
JsonLexContext, so we can't easily backpatch it.  AFAICS that's not much  
of a problem; apparently some leaks might exist in JSON usage of  
text-search, for example via json_to_tsvector, but I haven't seen any  
complaints about that.  
  
Per Coverity complaint about datum_to_jsonb_internal().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/bin/pg_verifybackup/parse_manifest.c
M src/common/jsonapi.c
M src/include/common/jsonapi.h
M src/include/utils/jsonfuncs.h

Consider cheap startup paths in add_paths_to_append_rel

commit   : a8a968a8212ee3ef7f22795c834b33d871fac262    
  
author   : David Rowley <[email protected]>    
date     : Thu, 5 Oct 2023 21:03:10 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 5 Oct 2023 21:03:10 +1300    

Click here for diff

6b94e7a6d did this for ordered append paths to allow fast startup  
MergeAppends, however, nothing was done for the Append case.  
  
Here we adjust add_paths_to_append_rel() to have it build an AppendPath  
containing the cheapest startup paths from each of the child relations  
when the append rel has "consider_startup" set.  
  
Author: Andy Fan, David Rowley  
Discussion: https://www.postgresql.org/message-id/CAKU4AWrXSkUV=Pt-gRxQT7EbfUeNssprGyNsB=5mJibFZ6S3ww@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Fix memory leak in Memoize code

commit   : 0b053e78b5990cd01e7169ee5bd2bb8e4045deea    
  
author   : David Rowley <[email protected]>    
date     : Thu, 5 Oct 2023 20:30:47 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 5 Oct 2023 20:30:47 +1300    

Click here for diff

Ensure we switch to the per-tuple memory context to prevent any memory  
leaks of detoasted Datums in MemoizeHash_hash() and MemoizeHash_equal().  
  
Reported-by: Orlov Aleksej  
Author: Orlov Aleksej, David Rowley  
Discussion: https://postgr.es/m/83281eed63c74e4f940317186372abfd%40cft.ru  
Backpatch-through: 14, where Memoize was added  

M src/backend/executor/nodeMemoize.c

Constify crc32_sz

commit   : 688926633fc6663d632334b17b34b0384620a458    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 08:53:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 08:53:21 +0200    

Click here for diff

Author: Aleksander Alekseev <[email protected]>  
Discussion: https://postgr.es/m/e08317a0-a2e7-c60d-c14a-ad9fc34f8f6c%40eisentraut.org  

M contrib/hstore/hstore_gist.c

Modernize const handling with readline

commit   : 8666cf65ea6926b6d8c781ae03891435131911cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 08:43:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Oct 2023 08:43:49 +0200    

Click here for diff

The comment  
  
    /* On some platforms, readline is declared as readline(char *) */  
  
is obsolete.  The casting away of const can be removed.  
  
The const in the readline() prototype was added in GNU readline 4.2,  
released in 2001.  BSD libedit has also had const in the prototype  
since at least 2001.  
  
(The commit that introduced this comment (187e865174) talked about  
FreeBSD 4.8, which didn't have readline compatibility in libedit yet,  
so it must have been talking about GNU readline in the base system.  
This checks out, but already FreeBSD 5 had an updated GNU readline  
with const.)  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/862fc1d4-9a0c-d2b6-5451-ee3dc750bcab%40eisentraut.org  

M src/bin/psql/input.c

worker_spi: Expand set of options to start workers

commit   : 4f2994647ff1e1209829a0085ca0c8d237dbbbb4    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 12:22:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 12:22:28 +0900    

Click here for diff

A couple of new options are added to this module to provide more control  
on the ways bgworkers are started:  
- A new GUC called worker_spi.role to control which role to use by  
default when starting a worker.  
- worker_spi_launch() gains three arguments: a role OID, a database OID  
and flags (currently only BGWORKER_BYPASS_ALLOWCONN).  By default, the  
role OID and the database OID are InvalidOid, in which case the worker  
would use the related GUCs.  
  
Workers loaded by shared_preload_libraries use the default values  
provided by the GUCs, with flags at 0.  The options are given to the  
main bgworker routine through bgw_extra.  A test case is tweaked to  
start two dynamic workers with databases and roles defined by the caller  
of worker_spi_launch().  
  
These additions will have the advantage of expanding the tests for  
bgworkers, for at least two cases:  
- BGWORKER_BYPASS_ALLOWCONN has no coverage in the core tree.  
- A new bgworker flag is under discussion, and this eases the  
integration of new tests.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi–1.0.sql
M src/test/modules/worker_spi/worker_spi.c

commit   : c789f0f6cc5da084f75f2556bada572a1a05e39a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 10:23:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 10:23:22 +0900    

Click here for diff

Two custom wait events are added here:  
- "DblinkConnect", when waiting to establish a connection to a remote  
server.  
- "DblinkGetConnect", when waiting to establish a connection to a remote  
server but it could not be found in the list of already-opened ones.  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M doc/src/sgml/dblink.sgml

postgres_fdw: Replace WAIT_EVENT_EXTENSION with custom wait events

commit   : d61f2538a39f1dbeead01bc972fca597c769f518    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 09:50:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Oct 2023 09:50:42 +0900    

Click here for diff

Three custom wait events are added here:  
- "PostgresFdwCleanupResult", waiting while cleaning up PQgetResult() on  
transaction abort.  
- "PostgresFdwConnect", waiting to establish a connection to a remote  
server.  
- "PostgresFdwGetResult", waiting to receive a result from a remote  
server.  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c
M doc/src/sgml/postgres-fdw.sgml

Document that --sync-method takes an argument.

commit   : 684d9bfdd5a6e6e368133707c678a2e2a984cc4e    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 4 Oct 2023 14:40:50 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 4 Oct 2023 14:40:50 -0500    

Click here for diff

This was missed in commit 8c16ad3b43.  
  
Reported-by: Robert Haas  
Reviewed-by: Daniel Gustafsson, Robert Haas, Alvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/CA%2BTgmoZi7pcx-ec3oJLWSr2R%3DDn2Zeiyx3EXQKc_1TTvA6Eepg%40mail.gmail.com  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml

doc: Clarify not-null constraints in information schema

commit   : af2324fabf0020e464b0268be9ef03e8f46ed84b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Oct 2023 15:03:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Oct 2023 15:03:48 +0200    

Click here for diff

Add a bit of clarification in various places that not-null constraints  
are included under check constraints in the information schema.  

M doc/src/sgml/information_schema.sgml

test_shm_mq: Replace WAIT_EVENT_EXTENSION with custom wait events

commit   : 3338a9838298c4b42e2829373f70228c4fc50652    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Oct 2023 17:12:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Oct 2023 17:12:25 +0900    

Click here for diff

Two custom wait events are added here:  
- "TestShmMqBgWorkerStartup", when setting up a set of bgworkers in  
wait_for_workers_to_become_ready().  
- "TestShmMqMessageQueue", when waiting for a queued message in  
test_shm_mq_pipelined().  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c

worker_spi: Rename custom wait event to "WorkerSpiMain"

commit   : c8e318b1b8d9b699a96b96db861b362550456108    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Oct 2023 16:16:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Oct 2023 16:16:50 +0900    

Click here for diff

This naming is more consistent with all the other user-facing wait event  
strings.  Other in-core modules will use the same naming convention, so  
let's be consistent here as well.  
  
Extracted from a larger patch by the same author.  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi.c

Doc: suppress "exceed the available area" warning in PDF build.

commit   : 77d0ad6c46c518234b9ce0a5be1f61a25f1bf753    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2023 14:13:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2023 14:13:53 -0400    

Click here for diff

Allow a line break in example output, as we have done elsewhere.  
Overlength output was added in commit 1e68e43d3.  
  
While here, adjust some shaky grammar in an adjacent note  
(from a different commit, c9af05465).  
  
Per buildfarm.  

M doc/src/sgml/monitoring.sgml

Remove RelationGetIndexRawAttOptions()

commit   : 5e4282772a569363da350548b2ce2e214e92ba40    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 17:40:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 17:40:15 +0200    

Click here for diff

There was only one caller left, for which this function was overkill.  
  
Also, having it in relcache.c was inappropriate, since it doesn't work  
with the relcache at all.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/indexcmds.c
M src/backend/utils/cache/relcache.c
M src/include/utils/relcache.h

Remove IndexInfo.ii_OpclassOptions field

commit   : 784162357130f63b5130cd6517db21451692f9b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 17:39:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 17:39:31 +0200    

Click here for diff

It is unnecessary to include this field in IndexInfo.  It is only used  
by DDL code, not during execution.  It is really only used to pass  
local information around between functions in index.c and indexcmds.c,  
for which it is clearer to use local variables, like in similar cases.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/nodes/makefuncs.c
M src/include/catalog/index.h
M src/include/nodes/execnodes.h

Add some notes about why "ALTER TYPE enum DROP VALUE" is hard.

commit   : af3ee8a086ca210d9461f813538d0169dbf07c2c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2023 11:41:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2023 11:41:42 -0400    

Click here for diff

In hopes of putting these where any would-be implementer is sure to  
find them, make a placeholder grammar production for ALTER DROP VALUE  
and put them there.  This is really just a docs patch, though.  
  
Vik Fearing, with a bit more wordsmithing by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y

In basebackup.c, refactor to create read_file_data_into_buffer.

commit   : c2ba3fdea5938dff96ca32ed7a4a83c8ff5f188d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Oct 2023 11:00:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Oct 2023 11:00:40 -0400    

Click here for diff

This further reduces the length and complexity of sendFile(),  
hopefully make it easier to understand and modify. In addition  
to moving some logic into a new function, I took this opportunity  
to make a few slight adjustments to sendFile() itself, including  
renaming the 'len' variable to 'bytes_done', since we use it to represent  
the number of bytes we've already handled so far, not the total  
length of the file.  
  
Patch by me, reviewed by David Steele.  
  
Discussion: http://postgr.es/m/CA+TgmoYt5jXH4U6cu1dm9Oe2FTn1aae6hBNhZzJJjyjbE_zYig@mail.gmail.com  

M src/backend/backup/basebackup.c

In basebackup.c, refactor to create verify_page_checksum.

commit   : 053183138a7a11408d6faa9281001ff7b1ffee2e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Oct 2023 10:37:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Oct 2023 10:37:20 -0400    

Click here for diff

If checksum verification fails for a particular page, we reread the  
page and try one more time. The code that does this somewhat complex  
and difficult to follow. Move some of the logic into a new function  
and rearrange the code a bit to try to make it clearer. This way,  
we don't need the block_retry Boolean, a couple of other variables  
move from sendFile() into the new function, and some code is now less  
deeply indented.  
  
Patch by me, reviewed by David Steele.  
  
Discussion: http://postgr.es/m/CA+TgmoYt5jXH4U6cu1dm9Oe2FTn1aae6hBNhZzJJjyjbE_zYig@mail.gmail.com  

M src/backend/backup/basebackup.c

Avoid memory size overflow when allocating backend activity buffer

commit   : a956bd3fa9d937689db24620002c78221eaffddd    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 15:37:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 15:37:00 +0900    

Click here for diff

The code in charge of copying the contents of PgBackendStatus to local  
memory could fail on memory allocation because of an overflow on the  
amount of memory to use.  The overflow can happen when combining a high  
value track_activity_query_size (max at 1MB) with a large  
max_connections, when both multiplied get higher than INT32_MAX as both  
parameters treated as signed integers.  This could for example trigger  
with the following functions, all calling pgstat_read_current_status():  
- pg_stat_get_backend_subxact()  
- pg_stat_get_backend_idset()  
- pg_stat_get_progress_info()  
- pg_stat_get_activity()  
- pg_stat_get_db_numbackends()  
  
The change to use MemoryContextAllocHuge() has been introduced in  
8d0ddccec636, so backpatch down to 12.  
  
Author: Jakub Wartak  
Discussion: https://postgr.es/m/CAKZiRmw8QSNVw2qNK-dznsatQqz+9DkCquxP0GHbbv1jMkGHMA@mail.gmail.com  
Backpatch-through: 12  

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

Fix incorrect format placeholder

commit   : aea599cfc06b54426160a630e94ab7bdff7529c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 08:30:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Oct 2023 08:30:20 +0200    

Click here for diff

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

Tidy-up some appendStringInfo*() usages

commit   : 2075ba9dc9af8833b1147996c15246e44a1e4fab    
  
author   : David Rowley <[email protected]>    
date     : Tue, 3 Oct 2023 17:09:52 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 3 Oct 2023 17:09:52 +1300    

Click here for diff

Make a few newish calls to appendStringInfo() which have no special  
formatting use appendStringInfoString() instead.  Also, adjust usages of  
appendStringInfoString() which only append a string containing a single  
character to make use of appendStringInfoChar() instead.  
  
This makes the code marginally faster, but primarily this change is so  
we use the StringInfo type as it was intended to be used.  
  
Discussion: https://postgr.es/m/CAApHDvpXKQmL+r=VDNS98upqhr9yGBhv2Jw3GBFFk_wKHcB39A@mail.gmail.com  

M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/backend/access/transam/xlogbackup.c
M src/backend/replication/slot.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/pg_regress.c

Fail hard on out-of-memory failures in xlogreader.c

commit   : 6b18b3fe2c2f375d4a5d8a69b67bc59d13d4c844    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 10:21:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 10:21:44 +0900    

Click here for diff

This commit changes the WAL reader routines so as a FATAL for the  
backend or exit(FAILURE) for the frontend is triggered if an allocation  
for a WAL record decode fails in walreader.c, rather than treating this  
case as bogus data, which would be equivalent to the end of WAL.  The  
key is to avoid palloc_extended(MCXT_ALLOC_NO_OOM) in walreader.c,  
relying on plain palloc() calls.  
  
The previous behavior could make WAL replay finish too early than it  
should.  For example, crash recovery finishing earlier may corrupt  
clusters because not all the WAL available locally was replayed to  
ensure a consistent state.  Out-of-memory failures would show up  
randomly depending on the memory pressure on the host, but one simple  
case would be to generate a large record, then replay this record after  
downsizing a host, as Ethan Mertz originally reported.  
  
This relies on bae868caf222, as the WAL reader routines now do the  
memory allocation required for a record only once its header has been  
fully read and validated, making xl_tot_len trustable.  Making the WAL  
reader react differently on out-of-memory or bogus record data would  
require ABI changes, so this is the safest choice for stable branches.  
Also, it is worth noting that 3f1ce973467a has been using a plain  
palloc() in this code for some time now.  
  
Thanks to Noah Misch and Thomas Munro for the discussion.  
  
Like the other commit, backpatch down to 12, leaving out v11 that will  
be EOL'd soon.  The behavior of considering a failed allocation as bogus  
data comes originally from 0ffe11abd3a0, where the record length  
retrieved from its header was not entirely trustable.  
  
Reported-by: Ethan Mertz  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Replace use of stat()[7] by -s switch in TAP tests to retrieve file size

commit   : 6c77bb42ab0eb3f79e934ed3c97568119cca7b5f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 08:27:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Oct 2023 08:27:34 +0900    

Click here for diff

The list form of stat() is an inelegant API as it relies on the position  
of the file size in the list returned in result.  Like in any other  
places of the tree, replace that with a -s switch instead.  
  
Another suggestion from Dagfinn is File::Stat, which we've been already  
using for some other fields.  It really comes down to a matter of taste  
to choose that over -s, and the latter is more used in the tree.  
  
Author: Bertrand Drouvot  
Reviewed-by: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/test/recovery/t/019_replslot_limit.pl

Fix omission of column-level privileges in selective pg_restore.

commit   : 06c0c36884a5c9ced6d6a90f8b47540464b28e3a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Oct 2023 13:27:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Oct 2023 13:27:51 -0400    

Click here for diff

In a selective restore, ACLs for a table should be dumped if the  
table is selected to be dumped.  However, if the table has both  
table-level and column-level ACLs, only the table-level ACL was  
restored.  This happened because _tocEntryRequired assumed that  
an ACL could have only one dependency (the one on its table),  
and punted if there was more than one.  But since commit ea9125304,  
column-level ACLs also depend on the table-level ACL if any, to  
ensure correct ordering in parallel restores.  To fix, adjust the  
logic in _tocEntryRequired to ignore dependencies on ACLs.  
  
I extended a test case in 002_pg_dump.pl so that it purports to  
test for this; but in fact the test passes even without the fix.  
That's because this bug only manifests during a selective restore,  
while the scenarios 002_pg_dump.pl tests include only selective dumps.  
Perhaps somebody would like to extend the script so that it can test  
scenarios including selective restore, but I'm not touching that.  
  
Euler Taveira and Tom Lane, per report from Kong Man.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/DM4PR11MB73976902DBBA10B1D652F9498B06A@DM4PR11MB7397.namprd11.prod.outlook.com  

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

Remove retry loop in heap_page_prune().

commit   : 1ccc1e05ae8feabf444259234d34e1e32231604d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 Oct 2023 11:40:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 Oct 2023 11:40:07 -0400    

Click here for diff

The retry loop is needed because heap_page_prune() calls  
HeapTupleSatisfiesVacuum() and then lazy_scan_prune() does the same  
thing again, and they might get different answers due to concurrent  
clog updates.  But this patch makes heap_page_prune() return the  
HeapTupleSatisfiesVacuum() results that it computed back to the  
caller, which allows lazy_scan_prune() to avoid needing to recompute  
those values in the first place. That's nice both because it eliminates  
the need for a retry loop and also because it's cheaper.  
  
Melanie Plageman, reviewed by David Geier, Andres Freund, and me.  
  
Discussion: https://postgr.es/m/CAAKRu_br124qsGJieuYA0nGjywEukhK1dKBfRdby_4yY3E9SXA%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Flush WAL stats in bgwriter

commit   : e64c733bb1996e52a13f6fc4a1240703f607fa53    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 12:39:35 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 12:39:35 +0300    

Click here for diff

bgwriter can write out WAL, but did not flush the WAL pgstat counters,  
so the writes were not seen in pg_stat_wal.  
  
Back-patch to v14, where pg_stat_wal was introduced.  
  
Author: Nazir Bilal Yavuz  
Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/CAN55FZ2FPYngovZstr%3D3w1KSEHe6toiZwrurbhspfkXe5UDocg%40mail.gmail.com  

M src/backend/postmaster/bgwriter.c

Add rmgrdesc README

commit   : f0bd0b4489fa3e53ba1612b779860d82a1b50f57    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 12:18:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 12:18:57 +0300    

Click here for diff

In the README, briefly explain what rmgrdesc functions are, and why  
they are in a separate directory. Commit c03c2eae0a added some  
guidelines on the preferred output format; move that to the README  
too.  
  
Reviewed-by: Melanie Plageman, Peter Geoghegan  
Discussion: https://www.postgresql.org/message-id/9159daf7-f42d-781b-458f-1b2cf32cb256%40iki.fi  

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

Add regression tests for psql \g piped into a program

commit   : be8d4cb13cb477fe45db31acf74e97eced51dfce    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 11:46:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Oct 2023 11:46:25 +0300    

Click here for diff

Author: Daniel Vérité  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/33ce8350-8cd1-45ff-a5fe-f9be7bc70649%40manitou-mail.org  

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

Revert "Add soft error handling to some expression nodes"

commit   : c8ec5e0543b90372c8e6d5cc2cd3d2ff89ca0e82    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 2 Oct 2023 13:48:15 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 2 Oct 2023 13:48:15 +0900    

Click here for diff

This reverts commit 7fbc75b26ed8ec70c729c5e7f8233896c54c900f.  
  
Looks like the LLVM additions may not be totally correct.  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h

Add soft error handling to some expression nodes

commit   : 7fbc75b26ed8ec70c729c5e7f8233896c54c900f    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 2 Oct 2023 11:52:28 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 2 Oct 2023 11:52:28 +0900    

Click here for diff

This adjusts the expression evaluation code for CoerceViaIO and  
CoerceToDomain to handle errors softly if needed.  
  
For CoerceViaIo, this means using InputFunctionCallSafe(), which  
provides the option to handle errors softly, instead of calling the  
type input function directly.  
  
For CoerceToDomain, this simply entails replacing the ereport() in  
ExecEvalConstraintCheck() by errsave().  
  
In both cases, the ErrorSaveContext to be used when evaluating the  
expression is stored by ExecInitExprRec() in the expression's struct  
in the expression's ExprEvalStep.  The ErrorSaveContext is passed by  
setting ExprState.escontext to point to it when calling  
ExecInitExprRec() on the expression whose errors are to be handled  
softly.  
  
Note that no call site of ExecInitExprRec() has been changed in this  
commit, so there's no functional change.  This is intended for  
implementing new SQL/JSON expression nodes in future commits that  
will use to it suppress errors that may occur during type coercions.  
  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h

psql: Set variables from query result on failure when printing tuples

commit   : 2940f1c8373cb3b43b3b42d40786b05d6e901de1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Oct 2023 11:05:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Oct 2023 11:05:05 +0900    

Click here for diff

SetResultVariables() was not getting called when "printing" a result  
that failed (see around PrintQueryResult), which would cause some  
variables to not be set, like ROW_COUNT, SQLSTATE or ERROR.  This can be  
confusing as a previous result would be retained.  
  
This state could be reached when failing to process tuples in a few  
commands, like \gset when it returns no tuples, or \crosstabview.  A  
test is added, based on \gset.  
  
This is arguably a bug fix, but no backpatch is done as there is a risk  
of breaking scripts that rely on the previous behavior, even if they do  
so accidentally.  
  
Reported-by: amutu  
Author: Japin Li  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Correct assertion and comments about XLogRecordMaxSize.

commit   : e1f95ec8cf6ea75d90905b2c746e2e1e9f3c9fc1    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 1 Oct 2023 12:20:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 1 Oct 2023 12:20:55 -0700    

Click here for diff

The largest allocation, of xl_tot_len+8192, is in allocate_recordbuf().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xloginsert.c
M src/include/access/xlogrecord.h

Fix datalen calculation in tsvectorrecv().

commit   : 5b7b3824648d6324f649bc74713a6b35e53b91ac    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2023 13:16:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2023 13:16:47 -0400    

Click here for diff

After receiving position data for a lexeme, tsvectorrecv()  
advanced its "datalen" value by (npos+1)*sizeof(WordEntry)  
where the correct calculation is (npos+1)*sizeof(WordEntryPos).  
This accidentally failed to render the constructed tsvector  
invalid, but it did result in leaving some wasted space  
approximately equal to the space consumed by the position data.  
That could have several bad effects:  
  
* Disk space is wasted if the received tsvector is stored into a  
  table as-is.  
  
* A legal tsvector could get rejected with "maximum total lexeme  
  length exceeded" if the extra space pushes it over the MAXSTRPOS  
  limit.  
  
* In edge cases, the finished tsvector could be assigned a length  
  larger than the allocated size of its palloc chunk, conceivably  
  leading to SIGSEGV when the tsvector gets copied somewhere else.  
  The odds of a field failure of this sort seem low, though valgrind  
  testing could probably have found this.  
  
While we're here, let's express the calculation as  
"sizeof(uint16) + npos * sizeof(WordEntryPos)" to avoid the type  
pun implicit in the "npos + 1" formulation.  It's not wrong  
given that WordEntryPos had better be 2 bytes to avoid padding  
problems, but it seems clearer this way.  
  
Report and patch by Denis Erokhin.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/[email protected]  

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

In COPY FROM, fail cleanly when unsupported encoding conversion is needed.

commit   : d8a09939a3e830c7e2c3a68925d5f4c298dc3336    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2023 12:09:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2023 12:09:26 -0400    

Click here for diff

In recent releases, such cases fail with "cache lookup failed for  
function 0" rather than complaining that the conversion function  
doesn't exist as prior versions did.  Seems to be a consequence of  
sloppy refactoring in commit f82de5c46.  Add the missing error check.  
  
Per report from Pierre Fortin.  Back-patch to v14 where the  
oversight crept in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c

Only evaluate default values as required when doing COPY FROM

commit   : 276393f53efbf08f72190221e9c1ef2a28e7fc66    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 1 Oct 2023 10:18:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 1 Oct 2023 10:18:41 -0400    

Click here for diff

Commit 9f8377f7a2 was a little too eager in fetching default values.  
Normally this would not matter, but if the default value is not valid  
for the type (e.g. a varchar that's too long) it caused an unnecessary  
error.  
  
Complaint and fix from Laurenz Albe  
  
Backpatch to release 16.  
  
Discussion: https://postgr.es/m/[email protected]  

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

meson: macos: Correct -exported_symbols_list syntax for Sonoma compat

commit   : b1a8dc846da4d96d903dcb5733f68a1e02d82a23    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Sep 2023 12:10:15 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Sep 2023 12:10:15 -0700    

Click here for diff

-exported_symbols_list=... works on Ventura and earlier, but not on  
Sonoma. The easiest way to fix it is to -Wl,-exported_symbols_list,@0@ which  
actually seems more appropriate anyway, it's obviously a linker argument. It  
is easier to use the -Wl,, syntax than passing multiple arguments, due to the  
way the export_fmt is used (a single string that's formatted), but if it turns  
out to be necessary, we can go for multiple arguments as well.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the meson based buildsystem was added  

M meson.build

Provide FORCE_NULL * and FORCE_NOT_NULL * options for COPY FROM

commit   : f6d4c9cf162b70f2837fb6c2a83e80a3f3410695    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Sep 2023 12:34:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Sep 2023 12:34:41 -0400    

Click here for diff

These options already exist, but you need to specify a column list for  
them, which can be cumbersome. We already have the possibility of all  
columns for FORCE QUOTE, so this is simply extending that facility to  
FORCE_NULL and FORCE_NOT_NULL.  
  
Author: Zhang Mingli  
Reviewed-By: Richard Guo, Kyatoro Horiguchi, Michael Paquier.  
  
Discussion: https://postgr.es/m/CACJufxEnVqzOFtqhexF2+AwOKFrV8zHOY3y=p+gPK6eB14pn_w@mail.gmail.com  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyto.c
M src/backend/parser/gram.y
M src/include/commands/copy.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql

Fix briefly showing old progress stats for ANALYZE on inherited tables.

commit   : c181f2e2bcecc2704c6461a0543894a38d7143df    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 30 Sep 2023 17:03:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 30 Sep 2023 17:03:50 +0300    

Click here for diff

ANALYZE on a table with inheritance children analyzes all the child  
tables in a loop. When stepping to next child table, it updated the  
child rel ID value in the command progress stats, but did not reset  
the 'sample_blks_total' and 'sample_blks_scanned' counters.  
acquire_sample_rows() updates 'sample_blks_total' as soon as the scan  
starts and 'sample_blks_scanned' after processing the first block, but  
until then, pg_stat_progress_analyze would display a bogus combination  
of the new child table relid with old counter values from the  
previously processed child table. Fix by resetting 'sample_blks_total'  
and 'sample_blks_scanned' to zero at the same time that  
'current_child_table_relid' is updated.  
  
Backpatch to v13, where pg_stat_progress_analyze view was introduced.  
  
Reported-by: Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/20230122162345.GP13860%40telsasoft.com  

M src/backend/commands/analyze.c

Fix EvalPlanQual rechecking during MERGE.

commit   : 1d5caec221d85b8950a1ee3d8bb6fad262549ea6    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 30 Sep 2023 10:52:21 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 30 Sep 2023 10:52:21 +0100    

Click here for diff

Under some circumstances, concurrent MERGE operations could lead to  
inconsistent results, that varied according the plan chosen. This was  
caused by a lack of rowmarks on the source relation, which meant that  
EvalPlanQual rechecking was not guaranteed to return the same source  
tuples when re-running the join query.  
  
Fix by ensuring that preprocess_rowmarks() sets up PlanRowMarks for  
all non-target relations used in MERGE, in the same way that it does  
for UPDATE and DELETE.  
  
Per bug #18103. Back-patch to v15, where MERGE was introduced.  
  
Dean Rasheed, reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/18103-c4386baab8e355e3%40postgresql.org  

M src/backend/executor/README
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
A src/test/isolation/expected/merge-join.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/merge-join.spec
M src/test/regress/expected/merge.out
M src/test/regress/expected/with.out

Remove environment sensitivity in pl/tcl regression test.

commit   : f02154652d1a83d80f4bee93b58ecdbd8c33378b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 20:20:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 20:20:57 -0400    

Click here for diff

Add "-gmt 1" to our test invocations of the Tcl "clock" command,  
so that they do not consult the timezone environment.  While it  
doesn't really matter which timezone is used here, it does  
matter that the command not fall over entirely.  We've now  
discovered that at least on FreeBSD, "clock scan" will fail if  
/etc/localtime is missing.  It seems worth making the test  
insensitive to that.  
  
Per Tomas Vondras' buildfarm animal dikkop.  Thanks to  
Thomas Munro for the diagnosis.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/sql/pltcl_setup.sql

doc: remove PG version mention in EXPLAIN output

commit   : 0cfc231aa19d80b31e37422a968d51fa8bcb53a9    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 29 Sep 2023 18:33:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 29 Sep 2023 18:33:03 -0400    

Click here for diff

Reported-by: Daniel Westermann  
  
Discussion: https://postgr.es/m/GV0P278MB0419DF1A8673E8D17A6287FAD2FA9@GV0P278MB0419.CHEP278.PROD.OUTLOOK.COM  
  
Backpatch-through: master  

M doc/src/sgml/planstats.sgml

C comment: add optimizer function reference

commit   : 6d0c39a29309e5d7a6398e213190ae4f031061ab    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 29 Sep 2023 14:25:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 29 Sep 2023 14:25:59 -0400    

Click here for diff

Reported-by: James Coleman  
  
Discussion: https://postgr.es/m/CAAaqYe9F6uoMhAr+8rMLwvGzaKaSknPA0Wi3Ehtv8pbSYmJq-Q@mail.gmail.com  
  
Backpatch-through: master  

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

commit   : 06843df4abc5a0c24e4bd154a8a1327e074fa3ae    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 14:07:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 14:07:30 -0400    

Click here for diff

As of Xcode 15 (macOS Sonoma), the linker complains about duplicate  
references to the same library.  We see warnings about libpgport and  
libpgcommon being duplicated in many client executables.  This is a  
consequence of the hack introduced in commit 6b7ef076b to list  
libpgport before libpq while not removing it from $(LIBS).  
(Commit 8396447cd later applied the same rule to libpgcommon.)  
  
The concern in 6b7ef076b was to ensure that the client executable  
wouldn't unintentionally depend on pgport functions from libpq.  
That concern is obsolete on any platform for which we can do symbol  
export control, because if we can then the pgport functions in libpq  
won't be exposed anyway.  Hence, we can fix this problem by just  
removing libpgport and libpgcommon from $(libpq_pgport), and letting  
clients depend on the occurrences in $(LIBS).  
  
In the back branches, do that only on macOS (which we know has  
symbol export control).  In HEAD, let's be more aggressive and  
remove the extra libraries everywhere.  The only still-supported  
platforms that lack export control are MinGW/Cygwin, and it  
doesn't seem worth sweating over ABI stability details for those  
(or if somebody does care, it'd probably be possible to perform  
symbol export control for those too).  As well as being simpler,  
this might give some microscopic improvement in build time.  
  
The meson build system is not changed here, as it doesn't have  
this particular disease, though it does have some related issues  
that we'll fix separately.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Doc: improve description of dump/restore's --clean and --if-exists.

commit   : 75af0f401f905b947ea14401e8a51f1bae4ac265    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 13:13:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2023 13:13:54 -0400    

Click here for diff

Try to make these option descriptions a little clearer for novices.  
Per gripe from Attila Gulyás.  
  
Discussion: https://postgr.es/m/169590536647.3727336.11070254203649648453@wrigleys.postgresql.org  

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

doc: Change statistics function xref to the right target

commit   : ccd42ca046eb1cae73d5bf0dcd9f6eae4f929872    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 29 Sep 2023 15:55:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 29 Sep 2023 15:55:37 +0200    

Click here for diff

Commit 7d3b7011b added a link to the statistics functions, which at the  
time were anchored under the section for statistics views.  aebe989477a  
added a separate section for statistics functions, but the link was not  
updated to point to the new anchor.  Fix by changing the xref.  
  
Backpatch to all supported branches.  
  
Author: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/CAHut+Ptr0jKzNNtWnssLq+3jNhbyaBseqf6NPrWHk08mQFRoTg@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/func.sgml

Revert "pg_resetwal: Improve error with wrong/missing data directory"

commit   : 5daa50f962bd06e49af690efc2a8a27fdd37fb7d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Sep 2023 10:59:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Sep 2023 10:59:46 +0200    

Click here for diff

This reverts commit 1d863c250461410e60c9ed5d3180f32336f4c3e2.  
  
This broke specifying the data directory as a relative path.  
  
Reported-by: Hayato Kuroda (Fujitsu) <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/TYAPR01MB58664AD301F511B1EA5B72B4F5C0A%40TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/bin/pg_resetwal/pg_resetwal.c

Robustify find_base_rel and find_base_rel_ignore_join

commit   : d40d8272190ce5f1641b9afb83a3752101af6a38    
  
author   : David Rowley <[email protected]>    
date     : Fri, 29 Sep 2023 16:58:32 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 29 Sep 2023 16:58:32 +1300    

Click here for diff

Improve find_base_rel() and find_base_rel_ignore_join() so that they  
raise an ERROR if they ever receive a negative relid value in  
non-cassert builds.  If either of these functions had ever received a  
negative relid then they'd have attempted to access memory that does not  
belong to simple_rel_array.  
  
Because no evidence has been presented of actual cases where bugs have  
caused this to happen, here we take a lightweight approach to checking  
for negative values and simply cast both values to uint32 before  
performing the comparison.  This will cause any negative relids to be  
seen as greater than simple_rel_array_size which will ERROR rather than  
attempt to access a negative simple_rel_array element.  Obviously, the  
run-time error is better than a crash, so it makes sense to protect  
against this, especially when it can be done without adding any  
additional run-time overhead.  
  
There is a slight change here if the functions are ever called with a  
relid of 0.  This will pass the bounds check, but that array entry  
should be NULL (along with the corresponding simple_rte_array entry), so  
won't pass the "if (rel)" condition and still fall through and raise an  
ERROR.  
  
Author: Ranier Vilela  
Reviewed-by: Ashutosh Bapat, David Rowley  
Discussion: https://postgr.es/m/CAEudQArQSghBu2gLojg4o_tnHj_x2HcS%3D%2BwewL3NJS8z0VnK%2Bg%40mail.gmail.com  

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

commit   : 3ef18a90bdeaeb7895b16431b0bb0023265c1df4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 29 Sep 2023 10:34:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 29 Sep 2023 10:34:04 +0900    

Click here for diff

Since 45b1a67a0fcb, non-printable ASCII characters do not show up in  
various configuration paths as question marks, but as hexadecimal  
escapes.  The documentation was not updated to reflect that.  
  
Author: Hayato Kuroda  
Reviewed-by: Jian He, Tom Lane, Karl O. Pinc, Peter Smith  
Discussion: https://postgr.es/m/TYAPR01MB586631D0961BF9C44893FAB1F523A@TYAPR01MB5866.jpnprd01.prod.outlook.com  
Backpatch-through: 16  

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

Fix btmarkpos/btrestrpos array key wraparound bug.

commit   : 714780dcddf01865aa4323fedec59ffbefc7e707    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 28 Sep 2023 16:29:37 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 28 Sep 2023 16:29:37 -0700    

Click here for diff

nbtree's mark/restore processing failed to correctly handle an edge case  
involving array key advancement and related search-type scan key state.  
Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore  
processing (for a merge join) could incorrectly conclude that an  
affected array/scan key must not have advanced during the time between  
marking and restoring the scan's position.  
  
As a result of all this, array key handling within btrestrpos could skip  
a required call to _bt_preprocess_keys().  This confusion allowed later  
primitive index scans to overlook tuples matching the true current array  
keys.  The scan's search-type scan keys would still have spurious values  
corresponding to the final array element(s) -- not values matching the  
first/now-current array element(s).  
  
To fix, remember that "array key wraparound" has taken place during the  
ongoing btrescan in a flag variable stored in the scan's state, and use  
that information at the point where btrestrpos decides if another call  
to _bt_preprocess_keys is required.  
  
Oversight in commit 70bc5833, which taught nbtree to handle array keys  
during mark/restore processing, but missed this subtlety.  That commit  
was itself a bug fix for an issue in commit 9e8da0f7, which taught  
nbtree to handle ScalarArrayOpExpr quals natively.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkgP3DDRJxw6DgjCxo-cu-DKrvjEv_ArkP2ctBJatDCYg@mail.gmail.com  
Backpatch: 11- (all supported branches).  

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

Fix checking of index expressions in CompareIndexInfo().

commit   : 9f71e10d65fa2db7cde9fe1554f89a9526904eb9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Sep 2023 14:05:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Sep 2023 14:05:25 -0400    

Click here for diff

This code was sloppy about comparison of index columns that  
are expressions.  It didn't reliably reject cases where one  
index has an expression where the other has a plain column,  
and it could index off the start of the attmap array, leading  
to a Valgrind complaint (though an actual crash seems unlikely).  
  
I'm not sure that the expression-vs-column sloppiness leads  
to any visible problem in practice, because the subsequent  
comparison of the two expression lists would reject cases  
where the indexes have different numbers of expressions  
overall.  Maybe we could falsely match indexes having the  
same expressions in different column positions, but it'd  
require unlucky contents of the word before the attmap array.  
It's not too surprising that no problem has been reported  
from the field.  Nonetheless, this code is clearly wrong.  
  
Per bug #18135 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c

Return data from heap_page_prune via a struct.

commit   : 4e9fc3a9762065a442b829d759dc61d9a3265e81    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Sep 2023 10:36:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Sep 2023 10:36:34 -0400    

Click here for diff

Previously, one of the values in the struct was returned as the return  
value, and another was returned via an output parameter. In  
preparation for returning more stuff, consolidate both values into a  
struct returned via an output parameter.  
  
Melanie Plageman, reviewed by Andres Freund and by me.  
  
Discussion: https://postgr.es/m/CAAKRu_br124qsGJieuYA0nGjywEukhK1dKBfRdby_4yY3E9SXA%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list

doc: Clarify where ereport severity levels are defined

commit   : 22ff5c9d78b9c23622de2cf0730cec85266a7596    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 28 Sep 2023 15:33:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 28 Sep 2023 15:33:37 +0200    

Click here for diff

For a reader unfamiliar with the postgres code it might take some  
grepping to find where elevels are defined. This adds a reference  
to elog.h in the text like how SQLSTATE errorcodes are referenced  
to errcodes.h on the same page.  
  
Author: Kuwamura Masaki <[email protected]>  
Discussion: https://postgr.es/m/CAMyC8qqp1UDA9zothnJ9CbUYByytwpALS3LkdZ6bs1w5kZw5Xg@mail.gmail.com  

M doc/src/sgml/sources.sgml

Add missing TidRangePath handling in print_path()

commit   : c4a1933b48472eed0326462098091b47ffd7a14e    
  
author   : David Rowley <[email protected]>    
date     : Fri, 29 Sep 2023 00:02:22 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 29 Sep 2023 00:02:22 +1300    

Click here for diff

Tid Range scans were added back in bb437f995.  That commit forgot to add  
handling for TidRangePaths in print_path().  
  
Only people building with OPTIMIZER_DEBUG might have noticed this, which  
likely is the reason it's taken 4 years for anyone to notice.  
  
Author: Andrey Lepikhov  
Reported-by: Andrey Lepikhov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where bb437f995 was introduced  

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

Fix typo in src/backend/access/transam/README.

commit   : c68f78538f93803b5c4f879da12918762eb43482    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 28 Sep 2023 19:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 28 Sep 2023 19:45:00 +0900    

Click here for diff

M src/backend/access/transam/README

doc: Improve documentation about pg_resetwal -f option

commit   : 5f1b00e64aee58a83558b5036d9877dfcfba4252    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 12:08:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 12:08:54 +0200    

Click here for diff

Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

pg_resetwal: Use frontend logging API

commit   : a11d8e10f226c5a2072c1640bd1d70403ae4c4fa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:58:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:58:36 +0200    

Click here for diff

This now causes error messages related to the lack of the -f option to  
appear on standard error rather than standard output.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c

pg_resetwal: Regroup --help output

commit   : b5da1b3a939a8a7ece408131e6503be7a422e491    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:49:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:49:20 +0200    

Click here for diff

Put the options to modify the control values into a separate group.  
This matches the outline of the man page.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c

pg_resetwal: Improve error with wrong/missing data directory

commit   : 1d863c250461410e60c9ed5d3180f32336f4c3e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:40:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:40:00 +0200    

Click here for diff

Run chdir() before permission check to get a less confusing error  
message if the specified data directory does not exist.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c

pg_resetwal: Update an obsolete comment

commit   : 7273945cafa7a068ca2bcc617df1be1c7404de87    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:27:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2023 11:27:22 +0200    

Click here for diff

The comment claimed that pg_resetwal updates the pg_control file if it  
is of an old version.  This has apparently never been true.  Also, in  
c3c09be34b, another comment was added elsewhere that this currently  
does not happen.  So this comment is wrong and redundant and can be  
removed.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c

Show parameters of CALL as constants in pg_stat_statements

commit   : 11c34b342bd77a292b625c32b70b44c02db8f3ed    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Sep 2023 15:17:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Sep 2023 15:17:55 +0900    

Click here for diff

This commit changes the query jumbling of CallStmt so as its IN/OUT  
parameters are able to show up as constants with a parameter symbol in  
pg_stat_statements, like:  
CALL proc1($1, $2);  
CALL proc2($1, $2, $3);  
  
The transformed FuncExpr is used in the query ID computation instead of  
the FuncCall generated by the parser, so as it is sensitive to the OID  
of the procedure and its list of input arguments.  The output arguments  
are handled in a separate list in CallStmt, which is also included in  
the computation.  
  
Tests are added to pg_stat_statements to show how this affects CALL with  
IN/OUT parameters as well as overloaded functions.  
  
Like 638d42a3c520 or 31de7e60da34, this improves the monitoring of  
workloads with a lot of CALL statements, preventing unnecessary bloat  
when these use different input (or event output) values.  
  
Author: Sami Imseih  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/sql/utility.sql
M src/include/nodes/parsenodes.h

Remove obsolete executor cleanup code

commit   : d060e921ea5aa47b6265174c32e1128cebdbc3df    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 28 Sep 2023 09:44:39 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 28 Sep 2023 09:44:39 +0900    

Click here for diff

This commit removes unnecessary ExecExprFreeContext() calls in  
ExecEnd* routines because the actual cleanup is managed by  
FreeExecutorState(). With no callers remaining for  
ExecExprFreeContext(), this commit also removes the function.  
  
This commit also drops redundant ExecClearTuple() calls, because  
ExecResetTupleTable() in ExecEndPlan() already takes care of  
resetting and dropping all TupleTableSlots initialized with  
ExecInitScanTupleSlot() and ExecInitExtraTupleSlot().  
  
After these modifications, the ExecEnd*() routines for ValuesScan,  
NamedTuplestoreScan, and WorkTableScan became redundant. So, this  
commit removes them.  
  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com  

M src/backend/executor/execProcnode.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/include/executor/executor.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWorktablescan.h

Move tracking of in_streaming to PGOutputData

commit   : 9210afd3bcd65feccb883ace4ed6dcef6a684585    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Sep 2023 09:33:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Sep 2023 09:33:51 +0900    

Click here for diff

"in_streaming" is a flag used to track if an instance of pgoutput is  
streaming changes.  When pgoutput is started, the flag was always reset,  
switched it back and forth in the stream start/stop callbacks.  
  
Before this commit, it was a global variable, which is confusing as it  
is actually attached to a state of PGOutputData.  Per my analysis, using  
a global variable did not lead to an active bug like in 54ccfd65868c,  
but it makes the code more consistent.  Note that we cannot backpatch  
this change anyway as it requires the addition of a new field to  
PGOutputData, exposed in pgoutput.h.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila, Michael Paquier, Peter Smith  
Discussion: https://postgr.es/m/OS0PR01MB571690EF24F51F51EFFCBB0E94FAA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Add TupleDescGetDefault()

commit   : ebf76f2753a91615d45f113f1535a8443fa8d076    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Sep 2023 18:52:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Sep 2023 18:52:40 +0100    

Click here for diff

This unifies some repetitive code.  
  
Note: I didn't push the "not found" error message into the new  
function, even though all existing callers would be able to make use  
of it.  Using the existing error handling as-is would probably require  
exposing the Relation type via tupdesc.h, which doesn't seem  
desirable.  (Or even if we changed it to just report the OID, it would  
inject the concept of a relation containing the tuple descriptor into  
tupdesc.h, which might be a layering violation.  Perhaps some further  
improvements could be considered here separately.)  
  
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da%40eisentraut.org  

M src/backend/access/common/tupdesc.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/include/access/tupdesc.h

llvmjit: Use explicit LLVMContextRef for inlining

commit   : 9dce22033d5d2813e9f8e7d595f57ee5a38b3f8e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:21 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:21 +0200    

Click here for diff

When performing inlining LLVM unfortunately "leaks" types (the  
types survive and are usable, but a new round of inlining will  
recreate new structurally equivalent types). This accumulation  
will over time amount to a memory leak which for some queries  
can be large enough to trigger the OOM process killer.  
  
To avoid accumulation of types, all IR related data is stored  
in an LLVMContextRef which is dropped and recreated in order  
to release all types.  Dropping and recreating incurs overhead,  
so it will be done only after 100 queries. This is a heuristic  
which might be revisited, but until we can get the size of the  
context from LLVM we are flying a bit blind.  
  
This issue has been reported several times, there may be more  
references to it in the archives on top of the threads linked  
below.  
  
Backpatching of this fix will be handled once it has matured  
in master for a bit.  
  
Reported-By: Justin Pryzby <[email protected]>  
Reported-By: Kurt Roeckx <[email protected]>  
Reported-By: Jaime Casanova <[email protected]>  
Reported-By: Lauri Laanmets <[email protected]>  
Author: Andres Freund and Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAPH-tTxLf44s3CvUUtQpkDr1D8Hxqc2NGDzGXS1ODsfiJ6WSqA@mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h

llvmjit: Make llvm_types_module variable static

commit   : ef668d8bf56e8c164ed62acdb269aa2f7e7ad5a1    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:14 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:14 +0200    

Click here for diff

Commit b059d2f45685a introduced llvm_types_module and accidentally  
exported it. As there is no usecase for accessing this variable  
externally, this makes it static.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

llvmjit: Remove unnecessary types

commit   : 2dad308e73c1d105e69e69b9268a871260d94b4e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:01 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Sep 2023 13:02:01 +0200    

Click here for diff

These types were added in fb46ac26fe but hasn't been used, so  
remove until there is a need for them.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the misuse of origin filter across multiple pg_logical_slot_get_changes() calls.

commit   : 54ccfd65868c013a8c6906bc894bc5ea3640740a    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Sep 2023 14:32:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Sep 2023 14:32:51 +0530    

Click here for diff

The pgoutput module uses a global variable (publish_no_origin) to cache  
the action for the origin filter, but we didn't reset the flag when  
shutting down the output plugin, so subsequent retries may access the  
previous publish_no_origin value.  
  
We fix this by storing the flag in the output plugin's private data.  
Additionally, the patch removes the currently unused origin string from the  
structure.  
  
For the back branch, to avoid changing the exposed structure, we eliminated the  
global variable and instead directly used the origin string for change  
filtering.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila, Michael Paquier  
Backpatch-through: 16  
Discussion: http://postgr.es/m/OS0PR01MB571690EF24F51F51EFFCBB0E94FAA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/sql/replorigin.sql
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/pgoutput.h

unaccent: Tweak value of PYTHON when building without Python support

commit   : 6fc3a138b1e8049a73e48d4b0f1031a1e6e7b8c6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Sep 2023 14:40:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Sep 2023 14:40:23 +0900    

Click here for diff

As coded, the module's Makefile would fail to set a value for PYTHON as  
it checked if the variable is defined.  When compiling without  
--with-python, PYTHON is defined and set to an empty value, so the  
existing check is not able to do its work.  
  
This commit switches the rule to check if the value is empty rather than  
defined, allowing the generation of unaccent.rules even if --with-python  
is not used as long as "python" exists.  BISON and FLEX do the same in  
pgxs.mk, for instance.  
  
Thinko in f85a485f89e2.  
  
Author: Japin Li  
Discussion: https://postgr.es/m/MEYP282MB1669F86C0DC7B4DC48489CB0B6C3A@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
Backpatch-through: 13  

M contrib/unaccent/Makefile

Stop using "-multiply_defined suppress" on macOS.

commit   : 3aa021b29b0ecdafa518d225fa08b98d7bf5c84e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2023 21:06:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Sep 2023 21:06:21 -0400    

Click here for diff

We started to use this linker switch in commit 9df308697 of  
2004-07-13, which was in the OS X 10.3 era.  Apparently it's been a  
no-op since around OS X 10.9.  Apple's most recent toolchain version  
actively complains about it, so it's time to get rid of it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

doc: clarify the effect of concurrent work_mem allocations

commit   : 5f567b3c35c10668f62839a4a6d111b2d62e770a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:44:22 -0400    

Click here for diff

Reported-by: Sami Imseih  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/config.sgml

doc: clarify handling of time zones with "time with time zone"

commit   : eec2190b8c9b353c74aa03124d5664614c475305    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:23:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:23:59 -0400    

Click here for diff

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

M doc/src/sgml/datatype.sgml

doc: clarify the behavior of unopenable listen_addresses

commit   : 3fea8546914e3ebfcd4c3a3e25fbee6c54545087    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:02:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 19:02:18 -0400    

Click here for diff

Reported-by: Gurjeet Singh  
  
Discussion: https://postgr.es/m/CABwTF4WYPD9ov-kcSq1+J+ZJ5wYDQLXquY6Lu2cvb-Y7pTpSGA@mail.gmail.com  
  
Backpatch-through: 11  

M doc/src/sgml/config.sgml

doc: pg_upgrade, clarify standby servers must remain running

commit   : b0d049e8fa0c7ad61f7aa0c95e2987b8bace7090    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 18:54:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 18:54:10 -0400    

Click here for diff

Also mention that mismatching primary/standby LSNs should never  
happen.  
  
Reported-by: Nikolay Samokhvalov  
  
Discussion: https://postgr.es/m/CAM527d8heqkjG5VrvjU3Xjsqxg41ufUyabD9QZccdAxnpbRH-Q@mail.gmail.com  
  
Backpatch-through: 11  

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

pgrowlocks: change lock mode output labels for consistency

commit   : 15d5d7405d3591aeba418b20c5ac75e80ddc8c74    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:41:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:41:48 -0400    

Click here for diff

Change "Share" to "For Share" and "Key Share" to "For Key Share" for  
consistency with other lock mode labels.  
  
BACKWARD COMPATIBILITY BREAK  
  
Reported-by: David Cook  
  
Discussion:  https://postgr.es/m/CA+dNBPNBf+FCEwohe7SH1tSks0R_G4F=tuvM=hnPs4qWiAH8vg@mail.gmail.com  
  
Backpatch-through: master  

M contrib/pgrowlocks/expected/pgrowlocks.out
M contrib/pgrowlocks/pgrowlocks.c
M doc/src/sgml/pgrowlocks.sgml

doc: mention GROUP BY columns can reference target col numbers

commit   : 1b5a00450acb34d4aa4565aa54fe79c6676f8236    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:31:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:31:06 -0400    

Click here for diff

Reported-by: hape <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

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

pgbench: Improve help output of -I option

commit   : 639e1aa81f3d0dddd9ff9b54abb7edabd2277af1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 22:08:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 22:08:58 +0100    

Click here for diff

Add a description of the step letters to the --help output.  
  
Author: Gurjeet Singh <[email protected]>  
Reviewed-by: Tristen Raab <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CABwTF4Xbc=K4tFj5Znc8jx0GCufQa577GCDsWD7=71qDnUEOyQ@mail.gmail.com  

M src/bin/pgbench/pgbench.c

doc: correct reference to pg_relation in comment

commit   : 441bbd298888fe751a01b6c74cc53f2e7b223fa9    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:07:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Sep 2023 17:07:14 -0400    

Click here for diff

Reported-by: Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M src/backend/storage/large_object/inv_api.c

commit   : b0ae29512c2172f88696fe0963dd2a3304dc4972    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 16:08:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 16:08:35 +0100    

Click here for diff

Mainly, rename "schema" to "columns" and related changes.  The  
previous naming has long been confusing.  
  
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da%40eisentraut.org  

M src/backend/access/common/tupdesc.c
M src/backend/commands/tablecmds.c
M src/include/access/tupdesc.h

Clean up MergeCheckConstraint()

commit   : 369202bf4be6538ee29f41eb8c539d3764da4a3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 14:01:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 14:01:53 +0100    

Click here for diff

If the constraint is not already in the list, add it ourselves,  
instead of making the caller do it.  This makes the interface more  
consistent with other "merge" functions in this file.  
  
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da%40eisentraut.org  

M src/backend/commands/tablecmds.c

Fix another bug in parent page splitting during GiST index build.

commit   : 28d3c2ddcf91395920da17646a16367b6de1a93a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Sep 2023 14:14:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Sep 2023 14:14:49 +0300    

Click here for diff

Yet another bug in the ilk of commits a7ee7c851 and 741b88435. In  
741b88435, we took care to clear the memorized location of the  
downlink when we split the parent page, because splitting the parent  
page can move the downlink. But we missed that even *updating* a tuple  
on the parent can move it, because updating a tuple on a gist page is  
implemented as a delete+insert, so the updated tuple gets moved to the  
end of the page.  
  
This commit fixes the bug in two different ways (belt and suspenders):  
  
1. Clear the downlink when we update a tuple on the parent page, even  
   if it's not split. This the same approach as in commits a7ee7c851  
   and 741b88435.  
  
   I also noticed that gistFindCorrectParent did not clear the  
   'downlinkoffnum' when it stepped to the right sibling. Fix that  
   too, as it seems like a clear bug even though I haven't been able  
   to find a test case to hit that.  
  
2. Change gistFindCorrectParent so that it treats 'downlinkoffnum'  
   merely as a hint. It now always first checks if the downlink is  
   still at that location, and if not, it scans the page like before.  
   That's more robust if there are still more cases where we fail to  
   clear 'downlinkoffnum' that we haven't yet uncovered. With this,  
   it's no longer necessary to meticulously clear 'downlinkoffnum',  
   so this makes the previous fixes unnecessary, but I didn't revert  
   them because it still seems nice to clear it when we know that the  
   downlink has moved.  
  
Also add the test case using the same test data that Alexander  
posted. I tried to reduce it to a smaller test, and I also tried to  
reproduce this with different test data, but I was not able to, so  
let's just include what we have.  
  
Backpatch to v12, like the previous fixes.  
  
Reported-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M src/backend/access/gist/gist.c

Add some const qualifiers

commit   : 64b787656de6c0c6f8f2e6e5b8a3cea25b92458b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 11:28:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 11:28:57 +0100    

Click here for diff

There was a mismatch between the const qualifiers for  
excludeDirContents in src/backend/backup/basebackup.c and  
src/bin/pg_rewind/filemap.c, which led to a quick search for similar  
cases.  We should make excludeDirContents match, but the rest of the  
changes seem like a good idea as well.  
  
Author: David Steele <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/pgcrypto/pgp-armor.c
M src/backend/catalog/heap.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pgbench/pgbench.c
M src/interfaces/libpq/pqexpbuffer.c

Clean up MergeAttributesIntoExisting()

commit   : eddad679d2ab6d7369767d1c2f01fdbe76afbce3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 09:09:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2023 09:09:36 +0100    

Click here for diff

Make variable naming clearer and more consistent.  Move some variables  
to smaller scope.  Remove some unnecessary intermediate variables.  
Try to save some vertical space.  
  
Apply analogous changes to nearby MergeConstraintsIntoExisting() and  
RemoveInheritance() for consistency.  
  
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da%40eisentraut.org  

M src/backend/commands/tablecmds.c

Remove unused include

commit   : eb36c6ac8478e664edebe8131ffa23c394e487cc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 08:26:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 08:26:13 +0200    

Click here for diff

This was added in add5cf28d4 but was apparently never used.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/index.c

Fix behavior of "force" in pgstat_report_wal()

commit   : e221c0befb1b23130d87c26a1a2479019b9d565d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Sep 2023 09:29:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Sep 2023 09:29:47 +0900    

Click here for diff

As implemented in 5891c7a8ed8f, setting "force" to true in  
pgstat_report_wal() causes the routine to not wait for the pgstat  
shmem lock if it cannot be acquired, in which case the WAL and I/O  
statistics finish by not being flushed.  The origin of the confusion  
comes from pgstat_flush_wal() and pgstat_flush_io(), that use "nowait"  
as sole argument.  The I/O stats are new in v16.  
  
This is the opposite behavior of what has been used in  
pgstat_report_stat(), where "force" is the opposite of "nowait".  In  
this case, when "force" is true, the routine sets "nowait" to false,  
which would cause the routine to wait for the pgstat shmem lock,  
ensuring that the stats are always flushed.  When "force" is false,  
"nowait" is set to true, and the stats would only not be flushed if the  
pgstat shmem lock can be acquired, returning immediately without  
flushing the stats if the lock cannot be acquired.  
  
This commit changes pgstat_report_wal() so as "force" has the same  
behavior as in pgstat_report_stat().  There are currently three callers  
of pgstat_report_wal():  
- Two in the checkpointer where force=true during a shutdown and the  
main checkpointer loop.  Now the code behaves so as the stats are always  
flushed.  
- One in the main loop of the bgwriter, where force=false.  Now the code  
behaves so as the stats would not be flushed if the pgstat shmem lock  
could not be acquired.  
  
Before this commit, some stats on WAL and I/O could have been lost after  
a shutdown, for example.  
  
Reported-by: Ryoga Yoshida  
Author: Ryoga Yoshida, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

doc: Tell about "vcregress taptest" for regression tests on Windows

commit   : dbd44ea30c5c742d761ec91f5612e92dfb1d8253    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Sep 2023 08:16:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Sep 2023 08:16:12 +0900    

Click here for diff

There was no mention of this command in the documentation, and it is  
useful to run the TAP tests of a target source directory.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Fix edge-case for xl_tot_len broken by bae868ca.

commit   : becfbdd6c1c94fe03391368080029a6dd8523658    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 26 Sep 2023 09:07:26 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 26 Sep 2023 09:07:26 +1300    

Click here for diff

bae868ca removed a check that was still needed.  If you had an  
xl_tot_len at the end of a page that was too small for a record header,  
but not big enough to span onto the next page, we'd immediately perform  
the CRC check using a bogus large length.  Because of arbitrary coding  
differences between the CRC implementations on different platforms,  
nothing very bad happened on common modern systems.  On systems using  
the _sb8.c fallback we could segfault.  
  
Restore that check, add a new assertion and supply a test for that case.  
Back-patch to 12, like bae868ca.  
  
Tested-by: Tom Lane <[email protected]>  
Tested-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLCkTT7zYjzOxuLGahBdQ%3DMcF%3Dz5ZvrjSOnW4EDhVjT-g%40mail.gmail.com  

M src/backend/access/transam/xlogreader.c
M src/test/recovery/t/039_end_of_wal.pl

Add worker type to pg_stat_subscription.

commit   : 13aeaf0797e75a0c53abb66ac907ba14b4e47f6b    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 25 Sep 2023 14:12:43 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 25 Sep 2023 14:12:43 -0700    

Click here for diff

Thanks to commit 2a8b40e368, the logical replication worker type is  
easily determined.  The worker type could already be deduced via  
other columns such as leader_pid and relid, but that is unnecessary  
complexity for users.  
  
Bumps catversion.  
  
Author: Peter Smith  
Reviewed-by: Michael Paquier, Maxim Orlov, Amit Kapila  
Discussion: https://postgr.es/m/CAHut%2BPtmbSMfErSk0S7xxVdZJ9XVE3xVLhqBTmT91kf57BeKDQ%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/launcher.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/test/subscription/t/004_sync.pl

pg_dump: tests: Correct test condition for invalid databases

commit   : 849d367ff9a2875d4906fa110472462c4c95fad0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Sep 2023 11:50:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Sep 2023 11:50:02 -0700    

Click here for diff

For some reason I used not_like = { pg_dumpall_dbprivs => 1, } in the test  
condition of one of the tests added in in c66a7d75e65. That doesn't make sense  
for two reasons: 1) not_like isn't a valid test condition 2) the database  
should not be dumped in any of the tests.  Due to 1), the test achieved its  
goal, but clearly the formulation is confusing.  Instead use like => {}, with  
a comment explaining why.  
  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, like c66a7d75e65  

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

Collect dependency information for parsed CallStmts.

commit   : dc8d72c1c213d65a3f1500111d3c773aabce419f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 14:41:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 14:41:57 -0400    

Click here for diff

Parse analysis of a CallStmt will inject mutable information,  
for instance the OID of the called procedure, so that subsequent  
DDL may create a need to re-parse the CALL.  We failed to detect  
this for CALLs in plpgsql routines, because no dependency information  
was collected when putting a CallStmt into the plan cache.  That  
could lead to misbehavior or strange errors such as "cache lookup  
failed".  
  
Before commit ee895a655, the issue would only manifest for CALLs  
appearing in atomic contexts, because we re-planned non-atomic  
CALLs every time through anyway.  
  
It is now apparent that extract_query_dependencies() probably  
needs a special case for every utility statement type for which  
stmt_requires_parse_analysis() returns true.  I wanted to add  
something like Assert(!stmt_requires_parse_analysis(...)) when  
falling out of extract_query_dependencies_walker without doing  
anything, but there are API issues as well as a more fundamental  
point: stmt_requires_parse_analysis is supposed to be applied to  
raw parser output, so it'd be cheating to assume it will give the  
correct answer for post-parse-analysis trees.  I contented myself  
with adding a comment.  
  
Per bug #18131 from Christian Stork.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/setrefs.c
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

docs: Clarify --with-segsize-blocks documentation

commit   : a2c2fbf740fcfdf75b76d589b8e85c1cdf725a46    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Sep 2023 10:36:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Sep 2023 10:36:04 -0700    

Click here for diff

Without the added "relation" it's not immediately clear that the option  
relates to the relation segment size and not e.g. the WAL segment size.  
  
The option was added in d3b111e32.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-  

M doc/src/sgml/installation.sgml

Pack struct ParsedWord more tightly.

commit   : 036297cf1b8490bb72439d9ab471670598d3ad2f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 12:07:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 12:07:32 -0400    

Click here for diff

In a 64-bit build there's an awful lot of useless pad space in  
ParsedWords.  Since we may allocate large arrays of these,  
it's worth some effort to reduce their size.  
  
Here we reduce the alen field from uint32 to uint16, and then re-order  
the fields to avoid unnecessary padding.  alen is only used to  
remember the allocated size of the apos[] array, which is not allowed  
to exceed MAXNUMPOS (256) elements, so uint16 is plenty of space for  
it.  That gets us from 40 bytes to 24 on 64-bit builds, and from 20  
bytes to 16 on 32-bit builds.  
  
Per discussion of bug #18080.  Unfortunately this is an ABI break  
so we can't back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/tsearch/ts_utils.h

Limit to_tsvector_byid's initial array allocation to something sane.

commit   : cf1c65070a89de1e810ef2c5a2036ca4a56c2fdc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 11:50:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 11:50:28 -0400    

Click here for diff

The initial estimate of the number of distinct ParsedWords is just  
that: an estimate.  Don't let it exceed what palloc is willing to  
allocate.  If in fact we need more entries, we'll eventually fail  
trying to enlarge the array.  But if we don't, this allows success on  
inputs that currently draw "invalid memory alloc request size".  
  
Per bug #18080 from Uwe Binder.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/to_tsany.c

Doc: improve cross-reference in Makefile comment.

commit   : 3aff1d3fd0fb7f00da3c9994114e596c6744ea41    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 11:25:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2023 11:25:19 -0400    

Click here for diff

Per gripe from Japin Li.  
  
Discussion: https://postgr.es/m/MEYP282MB16692171F13B5DF40DB768EEB6FCA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/utils/mb/Unicode/Makefile

vacuumdb: Reword --help message for clarity

commit   : aa9de547b7674df98ffaeef0fb9d56a87d8344f5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 16:03:32 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 16:03:32 +0200    

Click here for diff

The --help output stated that schemas were specified using PATTERN  
when they in fact aren't pattern matched but are required to be  
exact matches. This changes to SCHEMA to make that clear.  
  
Backpatch through v16 where this was introduced.  
  
Author: Kuwamura Masaki <[email protected]>  
Discussion: https://postgr.es/m/CAMyC8qp9mXPQd5D6s6CJxvmignsbTqGZwDDB6VYJOn1A8WG38w@mail.gmail.com  
Backpatch-through: 16  

M src/bin/scripts/vacuumdb.c

vacuumdb: Fix excluding multiple schemas with -N

commit   : fb56a181175bba03a6d4f82cd3c07ec5511ce545    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 16:03:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 16:03:17 +0200    

Click here for diff

When specifying multiple schemas to exclude with -N parameters, none  
of the schemas are actually excluded (a single -N worked as expected).  
This fixes the catalog query to handle multiple exclusions and adds a  
test for this case.  
  
Backpatch to v16 where this was introduced.  
  
Author: Nathan Bossart <[email protected]>  
Author: Kuwamura Masaki <[email protected]>  
Reported-by: Kuwamura Masaki <[email protected]>  
Discussion: https://postgr.es/m/CAMyC8qp9mXPQd5D6s6CJxvmignsbTqGZwDDB6VYJOn1A8WG38w@mail.gmail.com  
Backpatch-through: 16  

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

pg_upgrade: check for types removed in pg12

commit   : 2e3dc8c14811a8d5dc0cdeda408f63131b873da0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Sep 2023 14:27:33 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Sep 2023 14:27:33 +0200    

Click here for diff

Commit cda6a8d01d39 removed a few datatypes, but didn't update  
pg_upgrade --check to throw error if these types are used.  So the users  
find that pg_upgrade --check tells them that everything is fine, only to  
fail when the real upgrade is attempted.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Reviewed-by: Suraj Kharage <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c

Fix typo in numutils.c comments

commit   : c1609cf3c014294937058d4ca2b3160ec1b5be8c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 13:29:34 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 13:29:34 +0200    

Click here for diff

s/messges/messages/  

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

Add GUC for temporarily disabling event triggers

commit   : 7750fefdb2b81e0ee09c523d0a21cbd37edaf4b2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 12:41:49 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 25 Sep 2023 12:41:49 +0200    

Click here for diff

In order to troubleshoot misbehaving or buggy event triggers, the  
documented advice is to enter single-user mode.  In an attempt to  
reduce the number of situations where single-user mode is required  
(or even recommended) for non-extraordinary maintenance, this GUC  
allows to temporarily suspend event triggers.  
  
This was originally extracted from a larger patchset which aimed  
at supporting event triggers on login events.  
  
Reviewed-by: Ted Yu <[email protected]>  
Reviewed-by: Mikhail Gribkov <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M src/backend/commands/event_trigger.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/commands/event_trigger.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

unaccent: Fix allocation size for target characters on initial load

commit   : f19669fed3efe872425c80d4b1f45bf59267b7ea    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Sep 2023 09:31:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Sep 2023 09:31:48 +0900    

Click here for diff

This led to an overestimation of the size allocated for both the quoted  
and non-quoted cases, while using an inconsistent style.  Thinkos in  
59f47fb98dab.  
  
Per report from Coverity, with extra input from Tom Lane.  

M contrib/unaccent/unaccent.c

Fix typo in test comment

commit   : 1f9e3a9be539f912babd3ad58d01a4ce6aa0b85b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 23 Sep 2023 09:56:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 23 Sep 2023 09:56:38 +0200    

Click here for diff

s/currect/correct/, accidentally introduced in 608b167f9f9.  

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

Don't use Perl pack('Q') in 039_end_of_wal.pl.

commit   : 91b0e85aa0ade896129fab540c3e02f62d7fe6fb    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 23 Sep 2023 14:13:06 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 23 Sep 2023 14:13:06 +1200    

Click here for diff

'Q' for 64 bit integers turns out not to work on 32 bit Perl, as  
revealed by the build farm.  Use 'II' instead, and deal with endianness.  
  
Back-patch to 12, like bae868ca.  
  
Discussion: https://postgr.es/m/ZQ4r1vHcryBsSi_V%40paquier.xyz  

M src/test/recovery/t/039_end_of_wal.pl

Don't trust unvalidated xl_tot_len.

commit   : bae868caf222ca01c569b61146fc2e398427127a    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 23 Sep 2023 10:26:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 23 Sep 2023 10:26:24 +1200    

Click here for diff

xl_tot_len comes first in a WAL record.  Usually we don't trust it to be  
the true length until we've validated the record header.  If the record  
header was split across two pages, previously we wouldn't do the  
validation until after we'd already tried to allocate enough memory to  
hold the record, which was bad because it might actually be garbage  
bytes from a recycled WAL file, so we could try to allocate a lot of  
memory.  Release 15 made it worse.  
  
Since 70b4f82a4b5, we'd at least generate an end-of-WAL condition if the  
garbage 4 byte value happened to be > 1GB, but we'd still try to  
allocate up to 1GB of memory bogusly otherwise.  That was an  
improvement, but unfortunately release 15 tries to allocate another  
object before that, so you could get a FATAL error and recovery could  
fail.  
  
We can fix both variants of the problem more fundamentally using  
pre-existing page-level validation, if we just re-order some logic.  
  
The new order of operations in the split-header case defers all memory  
allocation based on xl_tot_len until we've read the following page.  At  
that point we know that its first few bytes are not recycled data, by  
checking its xlp_pageaddr, and that its xlp_rem_len agrees with  
xl_tot_len on the preceding page.  That is strong evidence that  
xl_tot_len was truly the start of a record that was logged.  
  
This problem was most likely to occur on a standby, because  
walreceiver.c recycles WAL files without zeroing out trailing regions of  
each page.  We could fix that too, but it wouldn't protect us from rare  
crash scenarios where the trailing zeroes don't make it to disk.  
  
With reliable xl_tot_len validation in place, the ancient policy of  
considering malloc failure to indicate corruption at end-of-WAL seems  
quite surprising, but changing that is left for later work.  
  
Also included is a new TAP test to exercise various cases of end-of-WAL  
detection by writing contrived data into the WAL from Perl.  
  
Back-patch to 12.  We decided not to put this change into the final  
release of 11.  
  
Author: Thomas Munro <[email protected]>  
Author: Michael Paquier <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Noah Misch <[email protected]> (the idea, not the code)  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Sergei Kornilov <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/17928-aa92416a70ff44a2%40postgresql.org  

M src/backend/access/transam/xlogreader.c
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/recovery/meson.build
A src/test/recovery/t/039_end_of_wal.pl

Doc: copy-edit the introductory para for the pg_class catalog.

commit   : 755eb44d3c79a9bfe9c4d34e416f07ea78a2676c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2023 14:52:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2023 14:52:36 -0400    

Click here for diff

The previous wording had a faint archaic whiff to it, and more  
importantly used "catalogs" as a verb, which while cutely  
self-referential seems likely to provoke confusion in this  
particular context.  Also consistently use "kind" not "type" to  
refer to the different kinds of relations distinguished by relkind.  
  
Per gripe from Martin Nash.  Back-patch to supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Avoid using internal test methods in SSL tests

commit   : 33774978c78175095da9e6c276e8bcdb177725f8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Sep 2023 13:35:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Sep 2023 13:35:37 +0200    

Click here for diff

The SSL tests for pg_ctl restart with an incorrect key passphrase used  
the internal _update_pid method to set the pidfile after running pg_ctl  
manually instead of using the supplied ->restart method. This refactors  
the ->restart method to accept a fail_ok parameter like how ->start and  
->stop does, and changes the SSL tests to use this instead. This removes  
the need to call internal test module functions.  
  
Reviewed-by: Melih Mutlu <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/ssl/t/001_ssltests.pl

Avoid potential pfree on NULL on OpenSSL errors

commit   : 5f3aa309a880bb429c6a648d64e20fbd353fee8a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Sep 2023 11:18:25 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 22 Sep 2023 11:18:25 +0200    

Click here for diff

Guard against the pointer being NULL before pfreeing upon an error  
returned from OpenSSL.  Also handle errors from X509_NAME_print_ex  
which can return -1 on memory allocation errors.  
  
Backpatch down to v15 where the code was added.  
  
Author: Sergey Shinderuk <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v15  

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

Simplify information schema check constraint deparsing

commit   : e59fcbd712c777eb2987d7c9ad542a7e817954ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2023 07:40:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2023 07:40:56 +0200    

Click here for diff

The computation of the column  
information_schema.check_constraints.check_clause used  
pg_get_constraintdef() plus some string manipulation to get the check  
clause back out.  This ended up with an extra pair of parentheses,  
which is only an aesthetic problem, but also with suffixes like "NOT  
VALID", which don't belong into that column.  We can fix both of these  
problems and simplify the code by just using pg_get_expr() instead.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions.

commit   : 48e2b234f822ea1610826be4526bb56ca4734dbe    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2023 23:11:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2023 23:11:30 -0400    

Click here for diff

In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate  
the current transaction's properties to the new transaction if  
there was any open subtransaction (unreleased savepoint).  
Instead, some previous transaction's properties would be restored.  
This is because the "if (s->chain)" check in CommitTransactionCommand  
examined the wrong instance of the "chain" flag and falsely  
concluded that it didn't need to save transaction properties.  
  
Our regression tests would have noticed this, except they used  
identical transaction properties for multiple tests in a row,  
so that the faulty behavior was not distinguishable from correct  
behavior.  
  
Commit 12d768e70 fixed the problem in v15 and later, but only rather  
accidentally, because I removed the "if (s->chain)" test to avoid a  
compiler warning, while not realizing that the warning was flagging a  
real bug.  
  
In v14 and before, remove the if-test and save transaction properties  
unconditionally; just as in the newer branches, that's not expensive  
enough to justify thinking harder.  
  
Add the comment and extra regression test to v15 and later to  
forestall any future recurrence, but there's no live bug in those  
branches.  
  
Patch by me, per bug #18118 from Liu Xiang.  Back-patch to v12 where  
the AND CHAIN feature was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Allow dbname in pg_basebackup/pg_receivewal connstring

commit   : cca97ce6a6653df7f4ec71ecd54944cc9a6c4c16    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Sep 2023 13:53:07 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Sep 2023 13:53:07 +0200    

Click here for diff

As physical replication work at the cluster level and not database  
level, any dbname in the connection string is ignored. Proxies and  
middleware used in connecting to the cluster might however need to  
know the dbname in order to make the correct routing decision for  
the connection.  
  
With this the startup packet will include the dbname parameter.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Reviewed-by: Tristen Raab <[email protected]>  
Reviewed-by: Jim Jones <[email protected]>  
Discussion: https://postgr.es/m/CAGECzQTw-dZkVT_RELRzfWRzY714-VaTjoBATYfZq93R8C-auA@mail.gmail.com  

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

Update comment about set_join_pathlist_hook().

commit   : c621467d2bc6435d07db4471998ca9c9f0c57777    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 21 Sep 2023 19:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 21 Sep 2023 19:45:00 +0900    

Click here for diff

The comment introduced by commit e7cb7ee14 was a bit too terse, which  
could lead to extensions doing different things within the hook function  
than we intend to allow.  Extend the comment to explain what they can do  
within the hook function.  
  
Back-patch to all supported branches.  
  
In passing, I rephrased a nearby comment that I recently added to the  
back branches.  
  
Reviewed by David Rowley and Andrei Lepikhov.  
  
Discussion: https://postgr.es/m/CAPmGK15SBPA1nr3Aqsdm%2BYyS-ay0Ayo2BRYQ8_A2To9eLqwopQ%40mail.gmail.com  

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

Fix vacuumdb to pass buffer-usage-limit with analyze-only mode

commit   : 5cfba1ad69c6d43184645419476f6cc62e5dd3c5    
  
author   : David Rowley <[email protected]>    
date     : Thu, 21 Sep 2023 17:47:20 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 21 Sep 2023 17:47:20 +1200    

Click here for diff

ae78cae3b added the --buffer-usage-limit to vacuumdb to allow it to  
include the BUFFER_USAGE_LIMIT option in the VACUUM command.  
Unfortunately, that commit forgot to adjust the code so the option was  
added to the ANALYZE command when the -Z command line argument was  
specified.  
  
There were no issues with the -z command as that option just adds  
ANALYZE to the VACUUM command.  
  
In passing adjust the code to escape the --buffer-usage-limit option  
before passing it to the server.  It seems nothing beyond a confusing  
error message could become this lack of escaping as VACUUM cannot be  
specified in a multi-command string.  
  
Reported-by: Ryoga Yoshida  
Author: Ryoga Yoshida, David Rowley  
Discussion: https://postgr.es/m/08930c0b541700a5264e5fbf3a685f5a%40oss.nttdata.com  
Backpatch-through: 16, where ae78cae3b was introduced.  

M src/bin/scripts/vacuumdb.c

doc: Fix description of BUFFER_USAGE_LIMIT for VACUUM and ANALYZE

commit   : e5975c2daad0327b9faa6b62bcfbf173680d14b9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 13:36:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 13:36:54 +0900    

Click here for diff

BUFFER_USAGE_LIMIT requires a parameter, and 'B' is a supported unit.  
  
Author: Ryoga Yoshida  
Reviewed-by: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

unaccent: Add support for quoted translated characters

commit   : 59f47fb98dab6f4a59bdfdb8825a7560ca8f1cba    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 12:29:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 12:29:36 +0900    

Click here for diff

As reported in bug #18057, the extension unaccent removes in its rule  
file whitespace characters that are intentionally specified when  
building unaccent.rules from UnicodeData.txt, causing an incorrect  
translation for some characters like numeric symbols.  This is caused by  
the fact that all whitespaces before and after the origin and target  
characters are all discarded (this limitation is documented).  
  
This commit makes possible the use of quotes around target characters,  
so as whitespaces can be considered part of target characters.  Some  
target characters use a double quote, these require an extra double  
quote.  
  
The documentation is updated to show how to use quoted areas,  
generate_unaccent_rules.py is updated to generate unaccent.rules and a  
couple of tests are added for numeric symbols.  While working on this  
patch, I have implemented a fake rule file to test the parsing logic  
implemented, which is not included here as it would just consume extra  
cycles in the tests, and it requires the manipulation of an installation  
tree to be able to work correctly.  
  
As this requires a change of format in unaccent.rules, this cannot be  
backpatched, unfortunately.  The idea to use double quotes as escaped  
characters comes from Tom Lane.  
  
Reported-by: Martin Schlossarek  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/sql/unaccent.sql
M contrib/unaccent/unaccent.c
M contrib/unaccent/unaccent.rules
M doc/src/sgml/unaccent.sgml

Remove open-coded binary heap in pg_dump_sort.c.

commit   : 559bc1732180d9d3f87ad77e029c823389d8d91b    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 19 Sep 2023 19:18:34 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 19 Sep 2023 19:18:34 -0700    

Click here for diff

Thanks to commit 5af0263afd, binaryheap is available to frontend  
code.  This commit replaces the open-coded heap implementation in  
pg_dump_sort.c with a binaryheap, saving a few lines of code.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/3612876.1689443232%40sss.pgh.pa.us  

M src/bin/pg_dump/pg_dump_sort.c

Fix typos in pgoutput.c

commit   : c868cbfef70a22bc02093cfd5e21d5ffd3ca5dd0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 10:02:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 10:02:12 +0900    

Click here for diff

RelationSyncCache was mentioned in two comments under a different name.  
Issue noticed while reviewing a different patch touching the same area.  
  
Introduced by 665d1fad99e7.  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Reset query buffer of \e, \ef and \ev on error

commit   : cb943054f3f6d67c858dd63192afaa488f8cb51e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 09:26:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Sep 2023 09:26:15 +0900    

Click here for diff

If any of these commands fail during editing or pre-processing, the  
command stored in the query buffer would remain around without being  
executed immediately as PSQL_CMD_ERROR is returned as status.  The next  
command provided by the user would run it, likely causing failures as  
this could include silently some of the contents generated automatically  
for views or functions.  
  
The problems would be different depending on the psql meta-command used:  
- For \ev and \ef, some errors can happen in a predictable way while  
doing an object lookup or while creating an object command.  A failure  
while editing is equally problematic, but the class of failures  
happening in the code path of do_edit() are unlikely.  The query reset  
is kept in exec_command_ef_ev() as a query may be unchanged.  
- For \e, error can happen while editing.  
  
In both cases, the query buffer is reset on error for an incorrect file  
number provided, whose value check is done before filling up the query  
buffer.  
  
This is a slight change of behavior compared to the past for some of the  
predictable error patterns for \ev and \ef, so for now I have made the  
choice to not backpatch this commit (argument particularly available for  
v11 that's going to be EOL'd soon).  Perhaps this could be revisited  
later depending on the feedback of this new behavior.  
  
Author: Ryoga Yoshida, Michael Paquier  
Reviewed-by: Aleksander Alekseev, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Convert pg_restore's ready_list to a priority queue.

commit   : 9bfd44bbde4261181bf94738f3b041c629c65a7e    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 19 Sep 2023 14:31:29 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 19 Sep 2023 14:31:29 -0700    

Click here for diff

Presently, parallel restores spend a lot of time sorting this list  
so that we pick the largest items first.  With many tables, this  
sorting can become a significant bottleneck.  There are a couple of  
reports from the field about this, and it is easy to reproduce.  
  
This commit improves the performance of parallel pg_restore with  
many tables by converting its ready_list to a priority queue, i.e.,  
a binary heap.  We will first try to run the highest priority item,  
but if it cannot be chosen due to the lock heuristic, we'll do a  
sequential scan through the heap nodes until we find one that is  
runnable.  This means that we might end up picking an item with a  
much lower priority.  However, we expect that we will typically be  
able to pick one of the first few items, which should usually have  
a relatively high priority.  
  
Suggested-by: Tom Lane  
Tested-by: Pierre Ducroquet  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/3612876.1689443232%40sss.pgh.pa.us  

M src/bin/pg_dump/pg_backup_archiver.c

Fix psql tab-completion for identifiers containing dollars.

commit   : 1f998863b0bc6fc8ef3d971d9c6d2c29b52d8ba2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Sep 2023 19:26:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Sep 2023 19:26:29 +0300    

Click here for diff

Dollar ($) is a legit character for identifiers, except as the first  
character, since commit 1bd22f55cf in version 7.4. Update the  
tab-completion code accordingly.  
  
Author: Mikhail Gribkov  
Reviewed-by: Vik Fearing  
Discussion: https://www.postgresql.org/message-id/CAMEv5_sTAvPvhye%2Bu4jkWDe5UGDiQ1ZkQomnKCboM08zDzOe%3Dg%40mail.gmail.com  

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

Replace more MemSet calls with struct initialization

commit   : c5b0582841a5785aaf20fa77b507f7041e119d68    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2023 11:29:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2023 11:29:45 +0200    

Click here for diff

This fixes up 10ea0f924a2 to use the style introduced by 9fd45870c1.  
  
Author: Richard Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs490gJf5A=ydqyjh+Z8mVQa_foTGtcmBtHGLra0aOwLWHQ@mail.gmail.com  

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

Fix GiST README's explanation of the NSN cross-check.

commit   : bf094372d14bf00f1c04f70f6ec5790f8b2c8801    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Sep 2023 11:53:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 19 Sep 2023 11:53:51 +0300    

Click here for diff

The text got the condition backwards, it's "NSN > LSN", not "NSN < LSN".  
While we're at it, expand it a little for clarity.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gist/README

Standardize type of extend_by counter

commit   : 9847ca2c79bef27b9bab44b2243fe951b7c62b36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2023 09:46:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2023 09:46:01 +0200    

Click here for diff

The counter of extend_by loops is mixed int and uint32.  Fix by  
standardizing from int to uint32, to match the extend_by variable.  
  
Fixup for 31966b151e.  
  
Author: Ranier Vilela <[email protected]>  
Reviewed-by: Gurjeet Singh <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEudQAqHG-JP-YnG54ftL_b7v6-57rMKwET_MSvEoen0UHuPig@mail.gmail.com  

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

Improve error message for snapshot import in snapmgr.c, take two

commit   : 78a33bba4c634afc3c67dddeb359b5ce872a0b04    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Sep 2023 10:19:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Sep 2023 10:19:50 +0900    

Click here for diff

When a snapshot file fails to be read in ImportSnapshot(), it would  
issue an ERROR as "invalid snapshot identifier" when opening a stream  
for it in read-only mode.  The error handling is improved to be more  
talkative in failure cases:  
- If a snapshot identifier uses incorrect characters, complain with the  
same error as before this commit.  
- If the snapshot file cannot be found in pg_snapshots/, complain with a  
"snapshot \"foo\" does not exist" instead.  This maps to the case where  
AllocateFile() fails on ENOENT.  Based on a suggestion from Andres  
Freund.  
- If AllocateFile() throws something else than ENOENT as errno, report  
it with more details in %m instead, as these failures are never  
expected.  
  
b29504eeb489 was the first improvement take.  The older error message  
exists since bb446b689b66 that introduced snapshot imports.  Two test  
cases are added to cover the cases of an identifier with an incorrect  
format and of a missing snapshot.  
  
Author: Bharath Rupireddy  
Reviewed-by: Andres Freund, Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACWmr=3KdxDkm8h7Zn1XxBoF6hdzq8WQyMn2y1OL5RYFrg@mail.gmail.com  

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

Fix assertion failure with PL/Python exceptions

commit   : af5b3c3d1eae94e9584ad1955a20b5a7cd0083c1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Sep 2023 08:31:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Sep 2023 08:31:06 +0900    

Click here for diff

PLy_elog() was not able to handle correctly cases where a SPI called  
failed, which would fill in a DETAIL string able to trigger an  
assertion.  We may want to improve this infrastructure so as it is able  
to provide any extra detail information provided by an error stack, but  
this is left as a future improvement as it could impact existing error  
stacks and any applications that depend on them.  For now, the assertion  
is removed and a regression test is added to cover the case of a failure  
with a detail string.  
  
This problem exists since 2bd78eb8d51c, so backpatch all the way down  
with tweaks to the regression tests output added where required.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/pl/plpython/expected/plpython_error.out
M src/pl/plpython/expected/plpython_error_5.out
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/sql/plpython_error.sql

Add function for removing arbitrary nodes in binaryheap.

commit   : c103d073819a2189d849c0a93d51c726be524c48    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 14:06:08 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 14:06:08 -0700    

Click here for diff

This commit introduces binaryheap_remove_node(), which can be used  
to remove any node from a binary heap.  The implementation is  
straightforward.  The target node is replaced with the last node in  
the heap, and then we sift as needed to preserve the heap property.  
This new function is intended for use in a follow-up commit that  
will improve the performance of pg_restore.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/3612876.1689443232%40sss.pgh.pa.us  

M src/common/binaryheap.c
M src/include/lib/binaryheap.h

Fix MSVC build for changes to binaryheap.

commit   : 83223f5f714482dd44883c68ecac2ae8c2d838e8    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 12:46:57 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 12:46:57 -0700    

Click here for diff

After 5af0263afd, binaryheap.c needs to be listed in Mkvcbuild.pm.  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Make binaryheap available to frontend code.

commit   : 5af0263afd7beaf947e22115b7e9ade000b0387d    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 12:18:33 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 18 Sep 2023 12:18:33 -0700    

Click here for diff

There are a couple of places in frontend code that could make use  
of this simple binary heap implementation.  This commit makes  
binaryheap usable in frontend code, much like commit 26aaf97b68 did  
for StringInfo.  Like StringInfo, the header file is left in lib/  
to reduce the likelihood of unnecessary breakage.  
  
The frontend version of binaryheap exposes a void *-based API since  
frontend code does not have access to the Datum definitions.  This  
seemed like a better approach than switching all existing uses to  
void * or making the Datum definitions available to frontend code.  
  
Reviewed-by: Tom Lane, Alvaro Herrera  
Discussion: https://postgr.es/m/3612876.1689443232%40sss.pgh.pa.us  

M src/backend/lib/Makefile
M src/backend/lib/meson.build
M src/common/Makefile
R090 src/backend/lib/binaryheap.c src/common/binaryheap.c
M src/common/meson.build
M src/include/lib/binaryheap.h
M src/tools/pgindent/typedefs.list

Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal.

commit   : f73fa5a470b4cf850ad404b63c3e352d179d40b0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2023 14:27:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2023 14:27:47 -0400    

Click here for diff

cursor_to_xmlschema() assumed that any Portal must have a tupDesc,  
which is not so.  Add a defensive check.  
  
It's plausible that this mistake occurred because of the rather  
poorly chosen name of the lookup function SPI_cursor_find(),  
which in such cases is returning something that isn't very much  
like a cursor.  Add some documentation to try to forestall future  
errors of the same ilk.  
  
Report and patch by Boyu Yang (docs changes by me).  Back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/dd343010-c637-434c-a8cb-418f53bda3b8.yangboyu.yby@alibaba-inc.com  

M doc/src/sgml/spi.sgml
M src/backend/utils/adt/xml.c

Fix psql's \? output for \watch

commit   : d726897c571b4269096c2cd13af804d16d089669    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 18 Sep 2023 16:19:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 18 Sep 2023 16:19:25 +0200    

Click here for diff

It was reported as misaligned by Kyotaro, but it also needed to be  
turned into a single translatable phrase (like the one for \g is), as  
reported by Yugo.  
  
This is a new issue (commit f347ec76e2a2), so no backpatch is needed.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Yugo NAGATA <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/help.c

doc: Add example for how to set file_fdw column option

commit   : 51908a37d7ea67655560ff2efcba66816ca458e2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 18 Sep 2023 14:59:16 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 18 Sep 2023 14:59:16 +0200    

Click here for diff

The documentation is pretty light on how to set column options  
on foreign tables, and the file_fdw docs refer to COPY when  
documenting force_null even though it's not used in the same  
way. Add a small example to describe how to use it.  
  
Reported-by: Boshomi Phenix <[email protected]>  
Discussion: https://postgr.es/m/CAJVkCUparn4_Oarernm=U6LWVsTkecKcALHtwGr5M3qJRj_czw@mail.gmail.com  

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

Fix information schema for catalogued not-null constraints

commit   : a0a5e0feb35c1209e340046dc4e40af3b0e79d59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 08:10:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 08:10:51 +0200    

Click here for diff

The column check_constraints.check_clause should be like  
  
    col IS NOT NULL  
  
without a surrounding CHECK (...).  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

Update Unicode data to Unicode 15.1.0

commit   : 9d17e5f16fbe679b851f060a72b1e71f7cd3eba8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 07:26:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 07:26:34 +0200    

Click here for diff

M src/Makefile.global.in
M src/common/unicode/meson.build
M src/include/common/unicode_east_asian_fw_table.h

Make Unicode script fit for future versions

commit   : 5c08927d365bf20c74fc141d75538ca7e44d303f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 07:25:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Sep 2023 07:25:46 +0200    

Click here for diff

Between Unicode 15.0.0 and 15.1.0, the whitespace in  
EastAsianWidth.txt has changed a bit, such as from  
  
0020;Na          # Zs         SPACE  
  
to  
  
0020           ; Na # Zs         SPACE  
  
with space around the semicolon.  Adjust the script to be able to  
parse that.  

M src/common/unicode/generate-unicode_east_asian_fw_table.pl

Track nesting depth correctly when drilling down into RECORD Vars.

commit   : e0e492e5a928e9c9eda01eeebadcfc36f9f8e7b7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2023 17:01:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2023 17:01:26 -0400    

Click here for diff

expandRecordVariable() failed to adjust the parse nesting structure  
correctly when recursing to inspect an outer-level Var.  This could  
result in assertion failures or core dumps in corner cases.  
  
Likewise, get_name_for_var_field() failed to adjust the deparse  
namespace stack correctly when recursing to inspect an outer-level  
Var.  In this case the likely result was a "bogus varno" error  
while deparsing a view.  
  
Per bug #18077 from Jingzhou Fu.  Back-patch to all supported  
branches.  
  
Richard Guo, with some adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_target.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Rename variable for code clarity

commit   : a396e20ad0da42b9cf64c39a99034523d819f008    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 15 Sep 2023 19:05:57 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 15 Sep 2023 19:05:57 +0200    

Click here for diff

When tracking IO timing for WAL, the duration is what we calculate  
based on the start and end timestamps, it's not what the variable  
contains. Rename the timestamp variable to end to better communicate  
what it contains.  Original patch by Krishnakumar with additional  
hacking to fix another occurrence by me.  
  
Author: Krishnakumar R <[email protected]>  
Discussion: https://postgr.es/m/CAPMWgZ9f9o8awrQpjo8oxnNQ=bMDVPx00NE0QcDzvHD_ZrdLPw@mail.gmail.com  

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

Remove unnecessary smgrimmedsync() when creating unlogged table.

commit   : 18724af9e83bb9123e0e1cd09751aef4ba30039e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Sep 2023 17:29:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Sep 2023 17:29:37 +0300    

Click here for diff

This became safe after commit 4b4798e138. The smgrcreate() call will  
now register the segment for syncing at the next checkpoint, so we  
don't need to sync it here. If a checkpoint happens before the  
creation is WAL-logged, the records will be replayed when starting  
recovery from the checkpoint. If a checkpoint happens after the WAL  
logging, the checkpoint will fsync() it.  
  
In the passing, clarify a comment in smgrDoPendingSyncs().  
  
Discussion: https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9%40iki.fi  
Reviewed-by: Robert Haas  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/storage.c

Quote filenames in error messages

commit   : b0ec61c9c27fb932ae6524f92a18e0d1fadbc144    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Sep 2023 11:17:33 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 14 Sep 2023 11:17:33 +0200    

Click here for diff

The majority of all filenames are quoted in user facing error and  
log messages, but a few were still printed without quotes.  While  
these filenames do not risk causing any ambiguity as their format  
is strict, quote them anyways to be consistent across all logs.  
  
Also concatenate a message to keep it one line to make it easier  
to grep for in the code.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix indentation in SQL file

commit   : be6f7cd9bb4a80787a7ebd602e5cae23485e4fe2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Sep 2023 09:42:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Sep 2023 09:42:43 +0200    

Click here for diff

M src/backend/catalog/information_schema.sql

Revert "Improve error message on snapshot import in snapmgr.c"

commit   : be022908cfe2959dbb17c10475deeb492b8e6944    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 16:00:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 16:00:01 +0900    

Click here for diff

This reverts commit a0d87bcd9b57, following a remark from Andres Frend  
that the new error can be triggered with an incorrect SET TRANSACTION  
SNAPSHOT command without being really helpful for the user as it uses  
the internal file name.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/utils/time/snapmgr.c

Flush logical slots to disk during a shutdown checkpoint if required.

commit   : e0b2eed047df9045664da6f724cb42c10f8b12f0    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 14 Sep 2023 08:56:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 14 Sep 2023 08:56:13 +0530    

Click here for diff

It's entirely possible for a logical slot to have a confirmed_flush LSN  
higher than the last value saved on disk while not being marked as dirty.  
Currently, it is not a major problem but a later patch adding support for  
the upgrade of slots relies on that value being properly flushed to disk.  
  
It can also help avoid processing the same transactions again in some  
boundary cases after the clean shutdown and restart.  Say, we process  
some transactions for which we didn't send anything downstream (the  
changes got filtered) but the confirm_flush LSN is updated due to  
keepalives.  As we don't flush the latest value of confirm_flush LSN, it  
may lead to processing the same changes again without this patch.  
  
The approach taken by this patch has been suggested by Ashutosh Bapat.  
  
Author: Vignesh C, Julien Rouhaud, Kuroda Hayato  
Reviewed-by: Amit Kapila, Dilip Kumar, Michael Paquier, Ashutosh Bapat, Peter Smith, Hou Zhijie  
Discussion: http://postgr.es/m/CAA4eK1JzJagMmb_E8D4au=GYQkxox0AfNBm1FbP7sy7t4YWXPQ@mail.gmail.com  
Discussion: http://postgr.es/m/TYAPR01MB58664C81887B3AF2EB6B16E3F5939@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/backend/access/transam/xlog.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
M src/test/recovery/meson.build
A src/test/recovery/t/038_save_logical_slots_shutdown.pl

Remove redundant result assignment in 004_sync.pl.

commit   : a2e0d5e5f6a05f436f7b73c7f12ffcc22611d23d    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 14 Sep 2023 08:39:03 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 14 Sep 2023 08:39:03 +0530    

Click here for diff

Author: Peter Smith  
Discussion: http://postgr.es/m/CAHut+PuTNdxnpn24s6jfPDe+fKJoe3M-CoNv-DFsZmJN-ed0Xw@mail.gmail.com  

M src/test/subscription/t/004_sync.pl

Fix tracking of temp table relation extensions as writes

commit   : 7369798a83c883a6314b8a8ed6d3063c508de784    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Sep 2023 19:14:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Sep 2023 19:14:09 -0700    

Click here for diff

Karina figured out that I (Andres) confused BufferUsage.temp_blks_written with  
BufferUsage.local_blks_written in fcdda1e4b5.  
  
Tests in core PG can't easily test this, as BufferUsage is just used for  
EXPLAIN (ANALYZE, BUFFERS) and pg_stat_statements. Thus this commit adds tests  
for this to pg_stat_statements.  
  
Reported-by: Karina Litskevich <[email protected]>  
Author: Karina Litskevich <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CACiT8ibxXA6+0amGikbeFhm8B84XdQVo6D0Qfd1pQ1s8zpsnxQ@mail.gmail.com  
Backpatch: 16-, where fcdda1e4b5 was merged  

M contrib/pg_stat_statements/expected/dml.out
M contrib/pg_stat_statements/sql/dml.sql
M src/backend/storage/buffer/localbuf.c

Improve error message on snapshot import in snapmgr.c

commit   : a0d87bcd9b57d85ec99eb2b2a2150bc60e5ca842    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 10:30:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 10:30:08 +0900    

Click here for diff

When a snapshot file fails to be read in ImportSnapshot(), it would  
issue an ERROR as "invalid snapshot identifier" when opening a stream  
for it in read-only mode.  This error message is reworded to be the same  
as all the other messages used in this case on failure, which is useful  
when debugging this area.  
  
Thinko introduced by bb446b689b66 where snapshot imports have been  
added.  A backpatch down to 11 is done as this can improve any work  
related to snapshot imports in older branches.  
  
Author: Bharath Rupireddy  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CALj2ACWmr=3KdxDkm8h7Zn1XxBoF6hdzq8WQyMn2y1OL5RYFrg@mail.gmail.com  
Backpatch-through: 11  

M src/backend/utils/time/snapmgr.c

Refactor error messages for unsupported providers in pg_locale.c

commit   : b8f44a47794588329cec280ee16eb0be17e1816e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 08:35:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Sep 2023 08:35:02 +0900    

Click here for diff

These code paths should not be reached normally, but if they are an  
error with "(null)" as information for the collation provider would show  
up if no locale is set, while we can assume that we are referring to  
libc.  
  
This refactors the code so as the provider is always reported even if no  
locale is set.  The name of the function where the error happens is  
added, while on it, as it can be helpful for debugging.  
  
Issue introduced by d87d548cd030, so backpatch down to 16.  
  
Author: Michael Paquier, Ranier Vilela  
Reviewed-by: Jeff Davis, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Fix incorrect logic in plan dependency recording

commit   : ee3a551e96c465f96de04dd1faf4e7bff8d25342    
  
author   : David Rowley <[email protected]>    
date     : Thu, 14 Sep 2023 11:27:29 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 14 Sep 2023 11:27:29 +1200    

Click here for diff

Both 50e17ad28 and 29f45e299 mistakenly tried to record a plan dependency  
on a function but mistakenly inverted the OidIsValid test.  This meant  
that we'd record a dependency only when the function's Oid was  
InvalidOid.  Clearly this was meant to *not* record the dependency in  
that case.  
  
50e17ad28 made this mistake first, then in v15 29f45e299 copied the same  
mistake.  
  
Reported-by: Tom Lane  
Backpatch-through: 14, where 50e17ad28 first made this mistake  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the ALTER SUBSCRIPTION to reflect the change in run_as_owner option.

commit   : f062cddafe6b3dcb6d090111c7cd4afa0c7fa4b3    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 13 Sep 2023 09:34:30 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 13 Sep 2023 09:34:30 +0530    

Click here for diff

Reported-by: Jeff Davis  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Backpatch-through: 16  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/033_run_as_table_owner.pl

Fix exception safety bug in typcache.c.

commit   : 3acd0599bd8e18ae831d1cc86b687453fdbd424a    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 13 Sep 2023 14:32:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 13 Sep 2023 14:32:24 +1200    

Click here for diff

If an out-of-memory error was thrown at an unfortunate time,  
ensure_record_cache_typmod_slot_exists() could leak memory and leave  
behind a global state that produced an infinite loop on the next call.  
  
Fix by merging RecordCacheArray and RecordIdentifierArray into a single  
array.  With only one allocation or re-allocation, there is no  
intermediate state.  
  
Back-patch to all supported releases.  
  
Reported-by: "James Pang (chaolpan)" <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/PH0PR11MB519113E738814BDDA702EDADD6EFA%40PH0PR11MB5191.namprd11.prod.outlook.com  

M src/backend/utils/cache/typcache.c
M src/tools/pgindent/typedefs.list

Switch psql's TAP test for query cancellation to use IPC::Run::signal()

commit   : 522a31ac873d7c6b02677f6d119c089a7dd09dd1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Sep 2023 10:10:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Sep 2023 10:10:04 +0900    

Click here for diff

Previously, the test relied on a trick with a shell to retrieve the PID  
of the psql session to be stopped with SIGINT, that was skipped on  
Windows.  This commit changes the test to use IPC::Run::signal()  
instead, which still does not work on Windows, but for a different  
reason: SIGINT would stop the test before finishing.  
  
This should allow the test to run on non-Windows platforms where PPID is  
not supported (like NetBSD), spreading it a bit more across the  
buildfarm.  And the logic of the test is simpler.  
  
It is the first time in the tree that IPC::Run::signal() is used, so, as  
a matter of safety (or just call that as me having cold feet), no  
backpatch is done, at least for now.  
  
Author: Yugo NAGATA  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/020_cancel.pl

Skip psql's TAP test for query cancellation entirely on Windows

commit   : c53e288dba96bf42c5bfc21e75b45efbf37863d0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Sep 2023 09:53:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Sep 2023 09:53:48 +0900    

Click here for diff

This changes 020_cancel.pl so as the test is entirely skipped on  
Windows.  This test was already doing nothing under WIN32, except  
initializing and starting a node without using it so this shaves a few  
test cycles.  
  
Author: Yugo NAGATA  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/bin/psql/t/020_cancel.pl

Remove redundant assignments in copyfrom.c

commit   : e434e21e114b423e919324ad6ce1f3f079ca2a03    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 9 Sep 2023 21:12:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 9 Sep 2023 21:12:41 +0900    

Click here for diff

The tuple descriptor and the number of attributes are assigned twice to  
the same values in BeginCopyFrom(), for what looks like a small thinko  
coming from the refactoring done in c532d15dddff1.  
  
Author: Jingtang Zhang  
Discussion: https://postgr.es/m/CAPsk3_CrYeXUVHEiaWAYxY9BKiGvGT3AoXo_+Jm0xP_s_VmXCA@mail.gmail.com  

M src/backend/commands/copyfrom.c

doc: remove mention of backslash doubling in strings

commit   : 320a27aab6c6797bfb0213b6b7a252da0b33637d    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/syntax.sgml

Stabilize subscription stats test.

commit   : 28ed5ecbe07121fd55d081e5be1f297a6177c779    
  
author   : Masahiko Sawada <[email protected]>    
date     : Fri, 8 Sep 2023 22:50:59 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Fri, 8 Sep 2023 22:50:59 +0900    

Click here for diff

The new test added by commit 68a59f9e9 disables the subscription and  
manually drops the associated replication slot. However, since  
disabling the subsubscription doesn't wait for a walsender to release  
the replication slot and exit, pg_drop_replication_slot() could  
fail. Avoid failure by adding a wait for the replication slot to  
become inactive.  
  
Reported-by: Hou Zhijie, as per buildfarm  
Reviewed-by: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB571682316378379AA34854F694E9A%40OS0PR01MB5716.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

M src/test/subscription/t/026_stats.pl

Add JIT deform_counter

commit   : 5a3423ad8ee171fbf08317917981effe47d211eb    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Sep 2023 15:05:12 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Sep 2023 15:05:12 +0200    

Click here for diff

generation_counter includes time spent on both JIT:ing expressions  
and tuple deforming which are configured independently via options  
jit_expressions and jit_tuple_deforming.  As they are  combined in  
the same counter it's not apparent what fraction of time the tuple  
deforming takes.  
  
This adds deform_counter dedicated to tuple deforming, which allows  
seeing more directly the influence jit_tuple_deforming is having on  
the query. The counter is exposed in EXPLAIN and pg_stat_statements  
bumpin pg_stat_statements to 1.11.  
  
Author: Dmitry Dolgov <[email protected]>  
Reviewed-by: Pavel Stehule <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/pg_stat_statements–1.10–1.11.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M doc/src/sgml/jit.sgml
M doc/src/sgml/pgstatstatements.sgml
M src/backend/commands/explain.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/jit/jit.h

doc: Extend documentation of PG_TEST_EXTRA

commit   : 6fe3cefde4b414819d9bb68999ae235a9fc3ce83    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Sep 2023 11:34:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 8 Sep 2023 11:34:43 +0200    

Click here for diff

Extend the PG_TEST_EXTRA documentation to mention resource intensive  
tests as well. The previous wording only mentioned special software  
and security in the main paragraph, with resource usage listed on one  
of the tests in the list.  
  
Backpatch to v15 where f47ed79cc8 added wal_consistenct_checking as  
a PG_TEST_EXTRA target.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/CAN55FZ0OthTuBdiNkaX2BvxuHdK4Y1MVEb8_uEuD1yHMPmT9Og@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/regress.sgml

Teach WaitEventSetWait() to report multiple events on Windows.

commit   : 04a09ee944ac904c7fb7ca8f7230a524f514b3e7    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Sep 2023 17:38:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Sep 2023 17:38:48 +1200    

Click here for diff

The WAIT_USE_WIN32 implementation of WaitEventSetWait() previously  
reported at most one event per call, because that's what the underlying  
WaitForMultipleObjects() call does.  
  
We can make the behavior match the three Unix implementations by looping  
until our output buffer is full, or there are no more events available  
now.  This makes no difference to most callers including the regular  
FEBE socket code, since they ask for at most one event anyway.  A  
difference in socket accept priority might be perceived by end users  
after commit 7389aad6 started using WaitEventSet in the postmaster.  
With this commit, the accept order now matches Unix systems, servicing  
listening sockets in round-robin order.  
  
We decided it wasn't really a bug or worth back-patching, but it seems  
good to align the behavior across platforms.  
  
Reviewed-by: Andres Freund <[email protected]> (earlier version)  
Tested-by: "Wei Wang (Fujitsu)" <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BA2dk29hr5zRP3HVJQ-_PncNJM6HVQ7aaYLXLRBZU-xw%40mail.gmail.com  

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

Remove some more "snapshot too old" vestiges.

commit   : 9f0602539db4573b89c09abab666e85b653940bd    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Sep 2023 17:12:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Sep 2023 17:12:12 +1200    

Click here for diff

Commit f691f5b8 removed the logic, but left behind some now-useless  
Snapshot arguments to various AM-internal functions, and missed a couple  
of comments.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wznj9qSNXZ1P1uWTUD_FeaTezbUazb416EPwi4Qr_jR_6A%40mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/spgist/spgscan.c
M src/include/access/brin_revmap.h
M src/include/access/gin_private.h
M src/include/access/nbtree.h

Improve BackendXidGetPid() to only access allProcs on matching XID

commit   : e722846daf4a37797ee39bc8ca3e78a4ef437f51    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Sep 2023 10:00:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Sep 2023 10:00:29 +0900    

Click here for diff

Compilers are able to optimize that, but it makes the code slightly more  
readable this way.  
  
Author: Zhao Junwang  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAEG8a3+i9gtqF65B+g_puVaCQuf0rZC-EMqMyEjGFJYOqUUWfA@mail.gmail.com  

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

doc: change "cross product" to "Cartesian product"

commit   : 8438a3ffef283d12b387eeb73616809e4c409483    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Sep 2023 15:47:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Sep 2023 15:47:53 -0400    

Click here for diff

Reported-by: Erik Wienhold  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Erik Wienhold  
  
Backpatch-through: master  

M doc/src/sgml/queries.sgml

Reorder tests in get_cheapest_path_for_pathkeys().

commit   : 9caf042088e7416ed612e52519ee15f0717e86a7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2023 13:51:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2023 13:51:35 -0400    

Click here for diff

Checking parallel safety should be even cheaper than cost comparison, so  
do that first.  
  
Also make some minor, related comment improvements.  
  
Richard Guo, reviewed by Aleksander Alekseev, Andy Fan, and me.  
  
Discussion: http://postgr.es/m/CAMbWs4-KE2wf4QPj_Sr5mX4QFtBNNKGmxK=+e=KZEGUjdG33=g@mail.gmail.com  

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

Move privilege check to the right place

commit   : ac22a9545ca906e70a819b54e76de38817c93aaf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Sep 2023 12:15:18 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Sep 2023 12:15:18 +0200    

Click here for diff

Now that ATExecDropConstraint doesn't recurse anymore, so it's wrong to  
test privileges "during recursion" there.  Move the check to  
dropconstraint_internal, which is the place where recursion occurs.  
  
In passing, remove now-useless 'recursing' argument to  
ATExecDropConstraint.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update information_schema definition for not-null constraints

commit   : 3af7217942722369a6eb7629e0fb1cbbef889a9b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Sep 2023 11:33:01 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Sep 2023 11:33:01 +0200    

Click here for diff

Now that we have catalogued not-null constraints, our information_schema  
definition can be updated to grab those rather than fabricate synthetic  
definitions.  
  
Note that we still don't have catalog rows for not-null constraints on  
domains, but we've never had not-null constraints listed in  
information_schema, so that's a problem to be solved separately.  
  
Co-authored-by: Peter Eisentraut <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

pg_basebackup: Generate valid temporary slot names under PQbackendPID()

commit   : e1c6db6309292827fc6baf7cf7df87d49254c7e1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Sep 2023 14:12:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Sep 2023 14:12:18 +0900    

Click here for diff

pgbouncer can cause PQbackendPID() to return negative values due to it  
filling be_pid with random bytes (even these days pid_max can only be  
set up to 2^22 on 64b machines on Linux, for example, so this cannot  
happen with normal PID numbers).  When this happens, pg_basebackup may  
generate a temporary slot name that may not be accepted by the parser,  
leading to spurious failures, like:  
pg_basebackup: error: could not send replication command  
ERROR:  replication slot name "pg_basebackup_-1201966863" contains  
invalid character  
  
This commit fixes that problem by formatting the result from  
PQbackendPID() as an unsigned integer when creating the temporary  
replication slot name, so as the invalid character is gone and the  
command can be parsed.  
  
Author: Jelte Fennema  
Reviewed-by: Daniel Gustafsson, Nishant Sharma  
Discussion: https://postgr.es/m/CAGECzQQOGvYfp8ziF4fWQ_o8s2K7ppaoWBQnTmdakn3s-4Z=5g@mail.gmail.com  
Backpatch-through: 11  

M src/bin/pg_basebackup/pg_basebackup.c

Fix instability in 031_recovery_conflict.pl.

commit   : 0174c2d213f69a4ba87932de706eedf3fbb5979e    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Sep 2023 14:38:15 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Sep 2023 14:38:15 +1200    

Click here for diff

Where the test wants a VACUUM command to generate WAL that would  
conflict with a session on the standby, it could transiently fail to do  
so if it couldn't acquire a cleanup lock conditionally at that moment on  
the primary.  VACUUM FREEZE will wait, so use that instead.  
  
No back-patch for now, but that will be needed if/when the test is  
re-enabled in back-branches.  
  
Suggested-by: Andres Freund <[email protected]>  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/20230812210006.ei7tutzwcr5svyt6%40awork3.anarazel.de  

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

Fix recovery conflict SIGUSR1 handling.

commit   : 0da096d78e1e49645ff9baf6e425d3c47c5a5dc0    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Sep 2023 12:38:23 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Sep 2023 12:38:23 +1200    

Click here for diff

We shouldn't be doing non-trivial work in signal handlers in general,  
and in this case the handler could reach unsafe code and corrupt state.  
It also clobbered its own "reason" code.  
  
Move all recovery conflict decision logic into the next  
CHECK_FOR_INTERRUPTS(), and have the signal handler just set flags and  
the latch, following the standard pattern.  Since there are several  
different "reasons", use a separate flag for each.  
  
With this refactoring, the recovery conflict system no longer  
piggy-backs on top of the regular query cancelation mechanism, but  
instead raises an error directly if it decides that is necessary.  It  
still needs to respect QueryCancelHoldoffCount, because otherwise the  
FEBE protocol might get out of sync (see commit 2b3a8b20c2d).  
  
This fixes one class of intermittent failure in the new  
031_recovery_conflict.pl test added by commit 9f8a050f, though the buggy  
coding is much older.  Failures outside contrived testing seem to be  
very rare (or perhaps incorrectly attributed) in the field, based on  
lack of reports.  
  
No back-patch for now due to complexity and release schedule.  We have  
the option to back-patch into 16 later, as 16 has prerequisite commit  
bea3d7e.  
  
Reviewed-by: Andres Freund <[email protected]> (earlier version)  
Reviewed-by: Michael Paquier <[email protected]> (earlier version)  
Reviewed-by: Robert Haas <[email protected]> (earlier version)  
Tested-by: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  
Discussion: https://postgr.es/m/CALj2ACVr8au2J_9D88UfRCi0JdWhyQDDxAcSVav0B0irx9nXEg%40mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/include/storage/procsignal.h
M src/include/tcop/tcopprot.h

Allow using syncfs() in frontend utilities.

commit   : 8c16ad3b43299695f203f9157a2b27c22b9ed634    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:27:16 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:27:16 -0700    

Click here for diff

This commit allows specifying a --sync-method in several frontend  
utilities that must synchronize many files to disk (initdb,  
pg_basebackup, pg_checksums, pg_dump, pg_rewind, and pg_upgrade).  
On Linux, users can specify "syncfs" to synchronize the relevant  
file systems instead of calling fsync() for every single file.  In  
many cases, using syncfs() is much faster.  
  
As with recovery_init_sync_method, this new option comes with some  
caveats.  The descriptions of these caveats have been moved to a  
new appendix section in the documentation.  
  
Co-authored-by: Justin Pryzby  
Reviewed-by: Michael Paquier, Thomas Munro, Robert Haas, Justin Pryzby  
Discussion: https://postgr.es/m/20210930004340.GM831%40telsasoft.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml
A doc/src/sgml/syncfs.sgml
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/fe_utils/option_utils.c
M src/include/fe_utils/option_utils.h

Add support for syncfs() in frontend support functions.

commit   : cccc6cdeb32f010f1cf777a9e9a85344a4317ab8    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:27:00 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:27:00 -0700    

Click here for diff

This commit adds support for using syncfs() in fsync_pgdata() and  
fsync_dir_recurse() (which have been renamed to sync_pgdata() and  
sync_dir_recurse()).  Like recovery_init_sync_method,  
sync_pgdata() calls syncfs() for the data directory, each  
tablespace, and pg_wal (if it is a symlink).  For now, all of the  
frontend utilities that use these support functions are hard-coded  
to use fsync(), but a follow-up commit will allow specifying  
syncfs().  
  
Co-authored-by: Justin Pryzby  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20210930004340.GM831%40telsasoft.com  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/common/file_utils.c
M src/include/common/file_utils.h

Make enum for sync methods available to frontend code.

commit   : 3ed19567198ddb34ab32be6ebdf132148287abdf    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:26:39 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 6 Sep 2023 16:26:39 -0700    

Click here for diff

This commit renames RecoveryInitSyncMethod to DataDirSyncMethod and  
moves it to common/file_utils.h.  This is preparatory work for a  
follow-up commit that will allow specifying the synchronization  
method in frontend utilities such as pg_upgrade and pg_basebackup.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/ZN2ZB4afQ2JbR9TA%40paquier.xyz  

M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/include/common/file_utils.h
M src/include/storage/fd.h
M src/tools/pgindent/typedefs.list

doc: mention that to_char() values are rounded

commit   : 059e4ee92108c0ecc01cb44a9cd1f00042271f7f    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    

Click here for diff

Reported-by: [email protected]  
  
Diagnosed-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/func.sgml

Update comments to match location of definition

commit   : aca17fe206a9b8b73ec76f10a3256f1bf019e1a6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 6 Sep 2023 10:18:30 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 6 Sep 2023 10:18:30 +0200    

Click here for diff

Commit cc50080a82 rearranged testsuites to reduce dependencies, but  
missed to update a comment when moving an operator class definition.  
Also fix a typo in that same comment while here.  
  
Author: Suraj Kharage <[email protected]>  
Discussion: https://postgr.es/m/CAF1DzPWXd2yq9_=P905cEypMVKw3ho+Fpj4HwJ4ta8T-eh+Yig@mail.gmail.com  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/hash_part.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/hash_part.sql
M src/test/regress/sql/partition_prune.sql

Remove column for wait event names in wait_event_names.txt

commit   : 59cbf60c0f2b5723ce4a939077c99bf4e4c433d3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Sep 2023 10:27:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Sep 2023 10:27:02 +0900    

Click here for diff

This file is now made of two columns, removing the column listing the  
user-visible strings used in the system views and the documentation:  
- Enum definitions for each class without the prefix "WAIT_EVENT_", so  
as this information can be grepped in the code and wait_event_names.txt  
at the same time.  
- Description in the documentation.  
  
The wait event names are now generated from the enum objects in  
CamelCase, with the underscores removed.  The data generated for wait  
events is consistent with what was produced by 414f6c0fb79a.  
  
This has the advantage to remove WAIT_EVENT_DOCONLY, which was a  
placeholder for the wait event types Lock and LWLock as these two only  
require the generation of the documentation.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/ZOxVHQwEC/9X/p/[email protected]  

M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/wait_event_names.txt

Use more consistent names for wait event objects and types

commit   : 414f6c0fb79a23afa63bfd27375dbd688031dfd1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Sep 2023 10:04:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Sep 2023 10:04:43 +0900    

Click here for diff

The event names use the same case-insensitive characters, hence applying  
lower() or upper() to the monitoring queries allows the detection of the  
same events as before this change.  It is possible to cross-check the  
data with the system view pg_wait_events, for instance, with a query  
like that showing no differences:  
SELECT lower(type), lower(name), description  
  FROM pg_wait_events ORDER BY 1, 2;  
  
This will help in the introduction of more simplifications in the format  
of wait_event_names.  Some of the enum values in the code had to be  
renamed a bit to follow the same convention naming across the board.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/ZOxVHQwEC/9X/p/[email protected]  

M src/backend/libpq/pqmq.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/activity/wait_event_names.txt

Move PG_TEMP_FILE* macros to file_utils.h.

commit   : f39b265808bde307953dd4bd46dca1f58f0988e8    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 5 Sep 2023 17:02:06 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 5 Sep 2023 17:02:06 -0700    

Click here for diff

Presently, frontend code that needs to use these macros must either  
include storage/fd.h, which declares several frontend-unsafe  
functions, or duplicate the macros.  This commit moves these macros  
to common/file_utils.h, which is safe for both frontend and backend  
code.  Consequently, we can also remove the duplicated macros in  
pg_checksums and stop including storage/fd.h in pg_rewind.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/ZOP5qoUualu5xl2Z%40paquier.xyz  

M src/backend/backup/basebackup.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/file/fileset.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/filemap.c
M src/include/common/file_utils.h
M src/include/storage/fd.h

Replace known_assigned_xids_lck with memory barriers.

commit   : 119c23eb9819213551cbe7e7665c8b493c59ceee    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 5 Sep 2023 13:59:06 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 5 Sep 2023 13:59:06 -0700    

Click here for diff

This lock was introduced before memory barrier support was added,  
and it is only used to guarantee proper memory ordering when  
KnownAssignedXidsAdd() appends to the array without a lock.  Now  
that such memory barrier support exists, we can remove the lock and  
use barriers instead.  
  
Suggested-by: Tom Lane  
Author: Michail Nikolaev  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/CANtu0oh0si%3DjG5z_fLeFtmYcETssQ08kLEa8b6TQqDm_cinroA%40mail.gmail.com  

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

doc: mention libpq regression tests

commit   : a899d07b24a6e519790041eeea5d96cc534f384e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 Sep 2023 13:05:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 Sep 2023 13:05:28 -0400    

Click here for diff

Reported-by: Ryo Matsumura  
  
Discussion: https://postgr.es/m/TYCPR01MB11316B3FB56EE54D70BF0CEF6E8E4A@TYCPR01MB11316.jpnprd01.prod.outlook.com  
  
Backpatch-through: 11  

M doc/src/sgml/regress.sgml

Unify gratuitously different error messages

commit   : f234b8cd16a4ba6e12cc51a36c8e499661d535bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2023 11:36:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2023 11:36:55 +0200    

Click here for diff

Fixup for commit 37188cea0c.  

M src/bin/pg_dump/pg_dump.c

Remove the "snapshot too old" feature.

commit   : f691f5b80a85c66d715b4340ffabb503eb19393e    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 5 Sep 2023 18:26:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 5 Sep 2023 18:26:12 +1200    

Click here for diff

Remove the old_snapshot_threshold setting and mechanism for producing  
the error "snapshot too old", originally added by commit 848ef42b.  
Unfortunately it had a number of known problems in terms of correctness  
and performance, mostly reported by Andres in the course of his work on  
snapshot scalability.  We agreed to remove it, after a long period  
without an active plan to fix it.  
  
This is certainly a desirable feature, and someone might propose a new  
or improved implementation in the future.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CACG%3DezYV%2BEvO135fLRdVn-ZusfVsTY6cH1OZqWtezuEYH6ciQA%40mail.gmail.com  
Discussion: https://postgr.es/m/20200401064008.qob7bfnnbu4w5cw4%40alap3.anarazel.de  
Discussion: https://postgr.es/m/CA%2BTgmoY%3Daqf0zjTD%2B3dUWYkgMiNDegDLFjo%2B6ze%3DWtpik%2B3XqA%40mail.gmail.com  

M contrib/Makefile
M contrib/bloom/blscan.c
M contrib/meson.build
D contrib/old_snapshot/Makefile
D contrib/old_snapshot/meson.build
D contrib/old_snapshot/old_snapshot–1.0.sql
D contrib/old_snapshot/old_snapshot.control
D contrib/old_snapshot/time_mapping.c
M doc/src/sgml/config.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
D doc/src/sgml/oldsnapshot.sgml
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginget.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/spgist/spgscan.c
M src/backend/catalog/index.c
M src/backend/commands/vacuum.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/errcodes.txt
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/time/snapmgr.c
M src/include/access/heapam.h
M src/include/storage/bufmgr.h
D src/include/utils/old_snapshot.h
M src/include/utils/snapmgr.h
M src/test/modules/Makefile
M src/test/modules/meson.build
D src/test/modules/snapshot_too_old/.gitignore
D src/test/modules/snapshot_too_old/Makefile
D src/test/modules/snapshot_too_old/expected/sto_using_cursor.out
D src/test/modules/snapshot_too_old/expected/sto_using_hash_index.out
D src/test/modules/snapshot_too_old/expected/sto_using_select.out
D src/test/modules/snapshot_too_old/meson.build
D src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec
D src/test/modules/snapshot_too_old/specs/sto_using_hash_index.spec
D src/test/modules/snapshot_too_old/specs/sto_using_select.spec
D src/test/modules/snapshot_too_old/sto.conf
M src/tools/pgindent/typedefs.list

Improve description of keys in tsvector

commit   : aa0d3504560d40f4300a3d49d1c6c3bfc3b894e5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Sep 2023 13:57:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Sep 2023 13:57:44 +0900    

Click here for diff

If all the bits of a key in a tsvector are true (marked with ALLISTRUE),  
gtsvectorout() would show the following description:  
"0 true bits, 0 false bits"  
  
This is confusing, as all the bits are true, but this would be  
equivalent to the information if siglen is 0.  
  
This commit improves the output so as "all true bits" show instead in  
this case.  Alexander has proposed a regression test for pageinspect,  
not included here as it is rather expensive compared to its coverage  
value.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix out-of-bound read in gtsvector_picksplit()

commit   : ae10dbb0c5e09bff9e26412de7940271ef501164    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Sep 2023 14:55:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Sep 2023 14:55:37 +0900    

Click here for diff

This could lead to an imprecise choice when splitting an index page of a  
GiST index on a tsvector, deciding which entries should remain on the  
old page and which entries should move to a new page.  
  
This is wrong since tsearch2 has been moved into core with commit  
140d4ebcb46e, so backpatch all the way down.  This error has been  
spotted by valgrind.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Fix typo in decode.c.

commit   : e70ed4b1b87d22b47955c2bdee567ef8424e6df8    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 4 Sep 2023 09:06:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 4 Sep 2023 09:06:15 +0530    

Click here for diff

Author: Hou Zhijie  
Discussion: http://postgr.es/m/OS0PR01MB57162DFFFCFCDA2E4B95899394E4A@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Fix handling of shared statistics with dropped databases

commit   : 2b8e5273e949003f299ddcae5f8c4b44c6eb9edc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Sep 2023 08:04:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Sep 2023 08:04:22 +0900    

Click here for diff

Dropping a database while a connection is attempted on it was able to  
lead to the presence of valid database entries in shared statistics.  
The issue is that MyDatabaseId was getting set too early than it should,  
as, if the connection attempted on the dropped database fails when  
renamed or dropped, the shutdown callback of the shared statistics would  
finish by re-inserting a correct entry related to the database already  
dropped.  
  
As analyzed by the bug reporters, this issue could lead to phantom  
entries in the database list maintained by the autovacuum launcher  
(in rebuild_database_list()) if the database dropped was part of the  
database list when it was still valid.  After the database was dropped,  
it would remain the highest on the list of databases to considered by  
the autovacuum worker as things to process.  This would prevent  
autovacuum jobs to happen on all the other databases still present.  
  
The commit fixes this issue by delaying setting MyDatabaseId until the  
database existence has been re-checked with the second scan on  
pg_database after getting a shared lock on it, and by switching  
pgstat_update_dbstats() so as nothing happens if MyDatabaseId is not  
valid.  
  
Issue introduced by 5891c7a8ed8f, so backpatch down to 15.  
  
Reported-by: Will Mortensen, Jacob Speidel  
Analyzed-by: Will Mortensen, Jacob Speidel  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/init/postinit.c

Fix not-null constraint test

commit   : d0ec2ddbe088f6da35444fad688a62eae4fbd840    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2023 19:49:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2023 19:49:20 +0200    

Click here for diff

When a partitioned table has a primary key, trying to find the  
corresponding not-null constraint for that column would come up empty,  
causing code that's trying to check said not-null constraint to crash.  
Fix by only running the check when the not-null constraint exists.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

ATPrepAddPrimaryKey: ignore non-PK constraints

commit   : e09d763e25dccc40695bc824ddda9abea791d66f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2023 14:21:27 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Sep 2023 14:21:27 +0200    

Click here for diff

Because of lack of test coverage, this function added by b0e96f311985  
wasn't ignoring constraint types other than primary keys, which it  
should have.  Add some lines to a test for it.  
  
Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs48bc-k_-1fh0dZpAhp_LiR5MfEX9haystmoBboR_4czCQ@mail.gmail.com  

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

Report syncscan position at end of scan.

commit   : e8d74ad625f7344f6b715254d3869663c1569a51    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 31 Aug 2023 13:02:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 31 Aug 2023 13:02:15 +0300    

Click here for diff

The comment in heapgettup_advance_block() says that it reports the  
scan position before checking for end of scan, but that didn't match  
the code. The code was refactored in commit 7ae0ab0ad9, which  
inadvertently changed the order of the check and reporting. Change it  
back.  
  
This caused a few regression test failures with a small shared_buffers  
setting like 10 MB. The 'portals' and 'cluster' tests perform seqscans  
that are large enough that sync seqscans kick in. When the sync scan  
position is not updated at end of scan, the next seq scan doesn't  
start at the beginning of the table, and the test queries are  
sensitive to that.  
  
Reviewed-by: Melanie Plageman, David Rowley  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Backpatch-through: 16  

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

Correct ObjectProperty entry for transforms

commit   : d7ceb41b9b84092517bbd7aa1ea6c446f023504e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 11:11:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 11:11:59 +0200    

Click here for diff

There was some confusion in the ObjectProperty entry for transforms.  
Some fields had values that were apparently meant for a different  
field.  Also, some fields were not assigned, which is okay for most  
fields, but not for all.  In particular, for .oid_catcache_id,  
.name_catcache_id, and .objtype, zero is a valid value, so we need to  
use -1 if not applicable.  It has apparently been like that from the  
very beginning (commit cac7658205).  The faulty values were not  
actually reachable, so it's not a big problem in practice, but we  
should make it correct.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/objectaddress.c

genbki.pl: Factor out boilerplate generation

commit   : f94dec76cc7aa1dc1636708e81581f9b84e7e15c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 10:21:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 10:21:34 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/genbki.pl

Restructure DECLARE_INDEX arguments

commit   : 226d0a6b989bec6cb0cc3bfc07df9fd417644782    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 08:14:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2023 08:14:57 +0200    

Click here for diff

Separate the table name from the index declaration.  We need that  
anyway later for the ALTER TABLE / USING INDEX commands, so we might  
as well structure the declarations like that to begin with.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/genbki.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h

Fix some shadow variables in src/backend/replication/

commit   : b5934bfd6071fed3a38cea0cfaa93afda63d9c0c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 31 Aug 2023 08:07:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 31 Aug 2023 08:07:48 +0900    

Click here for diff

The code is able to compile already without warnings under  
-Wshadow=compatible-local, which is itself already enabled in the tree,  
and the ones fixed here showed up with the more restrictive -Wshadow.  
  
There are more of these that we may want to look at, and the ones fixed  
here made the code confusing.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PuR0y4ofNOxi691VTVWmBfScHV9AaBMGSpeh8+DKp81Nw@mail.gmail.com  

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

Use actual backend IDs in pg_stat_get_backend_subxact().

commit   : d0fe3046eec3913829ccd5010849b25acd25fce4    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 30 Aug 2023 14:47:01 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 30 Aug 2023 14:47:01 -0700    

Click here for diff

Unlike the other pg_stat_get_backend* functions,  
pg_stat_get_backend_subxact() looks up the backend entry by using  
its integer argument as a 1-based index in an internal array.  The  
other functions look for the entry with the matching session  
backend ID.  These numbers often match, but that isn't reliably  
true.  
  
This commit resolves this discrepancy by introducing  
pgstat_get_local_beentry_by_backend_id() and using it in  
pg_stat_get_backend_subxact().  We cannot use  
pgstat_get_beentry_by_backend_id() because it returns a  
PgBackendStatus, which lacks the locally computed additions  
available in LocalPgBackendStatus that are required by  
pg_stat_get_backend_subxact().  
  
Author: Ian Barwick  
Reviewed-by: Sami Imseih, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/CAB8KJ%3Dj-ACb3H4L9a_b3ZG3iCYDW5aEu3WsPAzkm2S7JzS1Few%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h

Rename some support functions for pgstat* views.

commit   : 3d51cb5197ea7eabc65f5e0184aae60b8f7f9528    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 30 Aug 2023 14:46:52 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 30 Aug 2023 14:46:52 -0700    

Click here for diff

Presently, pgstat_fetch_stat_beentry() accepts a session's backend  
ID as its argument, and pgstat_fetch_stat_local_beentry() accepts a  
1-based index in an internal array as its argument.  The former is  
typically used wherever a user must provide a backend ID, and the  
latter is usually used internally when looping over all entries in  
the array.  This difference was first introduced by d7e39d72ca.  
Before that commit, both functions accepted a 1-based index to the  
internal array.  
  
This commit renames these two functions to make it clear whether  
they use the backend ID or the 1-based index to look up the entry.  
This is preparatory work for a follow-up change that will introduce  
a function for looking up a LocalPgBackendStatus using a backend  
ID.  
  
Reviewed-by: Ian Barwick, Sami Imseih, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/CAB8KJ%3Dj-ACb3H4L9a_b3ZG3iCYDW5aEu3WsPAzkm2S7JzS1Few%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h

Fix possible compiler warning

commit   : fe39f433528c7a5648a4b94bf11773f9c51e28ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2023 16:20:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2023 16:20:44 +0200    

Click here for diff

related to 1fa9241bdd  

M src/backend/commands/sequence.c

Doc: Improve documentation for creating custom scan paths.

commit   : 7ef5f5fb324096c7822c922ad59fd7fdd76f57b1    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 30 Aug 2023 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 30 Aug 2023 17:45:00 +0900    

Click here for diff

This improves the documentation related to parallel query a little bit.  
  
Reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/CAPmGK159eJShAR4ek4Db8oHD4%2BZ18zwJkisEWkqRN-80BdDGFQ%40mail.gmail.com  

M doc/src/sgml/custom-scan.sgml

postgres_fdw: Fix test for parameterized foreign scan.

commit   : 05c821294e6c52609a999aefbe6c53f79f39c81e    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 30 Aug 2023 17:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 30 Aug 2023 17:15:00 +0900    

Click here for diff

Commit e4106b252 should have updated this test, but did not; back-patch  
to all supported branches.  
  
Reviewed by Richard Guo.  
  
Discussion: http://postgr.es/m/CAPmGK15nR0NXLSCKQAcqbZbTzrzd5MozowWnTnGfPkayndF43Q%40mail.gmail.com  

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

Add bc6041b61f to .git-blame-ignore-revs.

commit   : 5ed593e5b76c177ea5cecb70e9fd2a223da32f21    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 16:06:12 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 16:06:12 +0900    

Click here for diff

M .git-blame-ignore-revs

Fix code indentation vioaltion introduced in commit 3c662643c4.

commit   : bc6041b61f6678d32a5cfb70744653cd8f8d01c0    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 15:56:22 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 15:56:22 +0900    

Click here for diff

Per buildfarm member koel  

M src/bin/pgbench/pgbench.c

Fix misuse of PqMsg_Close.

commit   : 6475e663b3c67895aa76acac27fd931bf8a6c0f1    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 29 Aug 2023 18:32:38 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 29 Aug 2023 18:32:38 -0700    

Click here for diff

EndCommand() and EndReplicationCommand() should use  
PqMsg_CommandComplete instead.  Oversight in commit f4b54e1ed9.  
  
Reported-by: Pavel Stehule, Tatsuo Ishii  
Author: Pavel Stehule  
Reviewed-by: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/CAFj8pRAMDCJXjnwiCkCB1yO1f7NPggFY8PwwAJDnugu-Z2G-Cg%40mail.gmail.com  

M src/backend/tcop/dest.c

Allow pgbench to exit immediately when any client is aborted.

commit   : 3c662643c4bb94aaf384e83fcfb53f6e4da0035e    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 10:03:31 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Aug 2023 10:03:31 +0900    

Click here for diff

Previously when client was aborted due to some error during  
benchmarking, other clients continued their run until certain number  
of transactions specified -t was reached or the time specified by -T  
was expired. At the end, the results are printed with caution: "Run  
was aborted; the above results are incomplete" shows.  
  
New option "--exit-on-abort" allows pgbench to exit immediately in  
this case so that users could quickly fix the cause of the failure and  
try again another round of benchmarking.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Tatsuo Ishii  
Discussion: https://postgr.es/m/flat/20230804130325.df32e60879c38c92bca64207%40sraoss.co.jp  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix comment of PQputCopyEnd()

commit   : 8bf7db0285dfbc4b505c8be4c34ab7386eb6297f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Aug 2023 08:29:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Aug 2023 08:29:08 +0900    

Click here for diff

The comment describing the error codes of this routine mentioned 0 as a  
possible value, but this error code has never been used.  
  
Author: Junwang Zhao  
Reviewed-by: Aleksander Alekseev  
Discussion: https://postgr.es/m/CAEG8a3Jt5KwMNr+_S6VN68rog4HeoG6ELvPQO8kZNQTeJeQ=rQ@mail.gmail.com  

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

Avoid possible overflow with ltsGetFreeBlock() in logtape.c

commit   : 52c6c0f19693367d542d1286c978a713ffcedd3a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Aug 2023 08:03:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Aug 2023 08:03:42 +0900    

Click here for diff

nFreeBlocks, defined as a long, stores the number of free blocks in a  
logical tape.  ltsGetFreeBlock() has been using an int to store the  
value of nFreeBlocks, which could lead to overflows on platforms where  
long and int are not the same size (in short everything except Windows  
where long is 4 bytes).  
  
The problematic intermediate variable is switched to be a long instead  
of an int.  
  
Issue introduced by c02fdc9223015, so backpatch down to 13.  
  
Author: Ranier vilela  
Reviewed-by: Peter Geoghegan, David Rowley  
Discussion: https://postgr.es/m/CAEudQApLDWCBR_xmwNjGBrDo+f+S4E87x3s7-+hoaKqYdtC4JQ@mail.gmail.com  
Backpatch-through: 13  

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

Disallow changing NO INHERIT status of a not-null constraint

commit   : 9b581c53418666205938311ef86047aa3c6b741f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 19:19:24 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 19:19:24 +0200    

Click here for diff

It makes no sense to add a NO INHERIT not-null constraint to a child  
table that already has one in that column inherited from its parent.  
Disallow that, and add tests for the relevant cases.  
  
Per complaint from Kyotaro Horiguchi.  I also used part of his proposed  
patch.  
  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Perl: Remove useless lines

commit   : 952db4979f9fea3fb4fd1eb07b310c85fdc2a8b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:25:09 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:25:09 +0200    

Click here for diff

M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

psql/t/001_basic: use locale-aware decimals in new test

commit   : 8421f6bce16cd1d58106f47e48762319e7d22ab0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:13:11 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:13:11 +0200    

Click here for diff

As cd82e5c79d14 did.  Otherwise, the test fails in locales that use  
decimal separators other than ".".  

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

Generate a locale-agnostic initdb template

commit   : db6d9891e8e4405f10d9b0bba1ebb6c51c3ab059    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:06:55 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Aug 2023 18:06:55 +0200    

Click here for diff

Fixup for 252dcb32397f.  
  
Without this, the "template" data directory created in the initial test  
steps uses a non-C locale, upsetting numerous tests that rely on parsing  
English error messages.  
  
Discussion: https://postgr.es/m/CAFj8pRB=XVWC0orWu0FbjrmyOpAMLqJiau80YyQOYQPfMj8Xxw@mail.gmail.com  

M meson.build
M src/Makefile.global.in

Rename logical_replication_mode to debug_logical_replication_streaming

commit   : 63956bed7b10fb3bb5fe3f74250a33c9e226a921    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 15:15:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 15:15:54 +0200    

Click here for diff

The logical_replication_mode GUC is intended for testing and debugging  
purposes, but its current name may be misleading and encourage users to make  
unnecessary changes.  
  
To avoid confusion, renaming the GUC to a less misleading name  
debug_logical_replication_streaming that casual users are less likely to mistakenly  
assume needs to be modified in a regular logical replication setup.  
  
Author: Hou Zhijie <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d672d774-c44b-6fec-f993-793e744f169a%40eisentraut.org  

M doc/src/sgml/config.sgml
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/misc/guc_tables.c
M src/include/replication/reorderbuffer.h
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/023_twophase_stream.pl

Allow \watch queries to stop on minimum rows returned

commit   : f347ec76e2a227e5c5b5065cce7adad16d58d209    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Aug 2023 11:30:11 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Aug 2023 11:30:11 +0200    

Click here for diff

When running a repeat query with \watch in psql, it can be  
helpful to be able to stop the watch process when the query  
no longer returns the expected amount of rows.  An example  
would be to watch for the presence of a certain event in  
pg_stat_activity and stopping when the event is no longer  
present, or to watch an index creation and stop when the  
index is created.  
  
This adds a min_rows=MIN parameter to \watch which can be  
set to a non-negative integer, and the watch query will  
stop executing when it returns less than MIN rows.  
  
Author: Greg Sabino Mullane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CAKAnmmKStATuddYxP71L+p0DHtp9Rvjze3XRoy0Dyw67VQ45UA@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/help.c
M src/bin/psql/t/001_basic.pl

Reword user-facing message for "power of two"

commit   : 95fff2abee66c16ca3609b3c1638cbd553730a90    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Aug 2023 11:21:10 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Aug 2023 11:21:10 +0200    

Click here for diff

While there are numerous instances of using "power of 2" in the code,  
translated user-facing messages use "power of two". Fix two instances  
which used "power of 2" instead.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_resetwal/pg_resetwal.c

Remove useless if condition

commit   : 6844d3275ac6b3c35d824f49362d3fe59b30f26b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:58:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:58:56 +0200    

Click here for diff

We can call GetAttributeCompression() with a NULL argument.  It  
handles that internally already.  This change makes all the callers of  
GetAttributeCompression() uniform.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Remove useless if condition

commit   : 689c66a84bb75e08462c05ffc18514895b19d48e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:52:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:52:22 +0200    

Click here for diff

This is useless because these fields are not set anywhere before, so  
we can assign them unconditionally.  This also makes this more  
consistent with ATExecAddColumn().  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Make more use of makeColumnDef()

commit   : 1fa9241bdd0e44d2b602b2dd4b6f0a4d0d402e76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:41:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:41:04 +0200    

Click here for diff

Since we already have it, we might as well make full use of it,  
instead of assembling ColumnDef by hand in several places.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c

Add some const decorations

commit   : 2b088c8e4a2c9879d2f37fa4b38ae925184cea64    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:30:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Aug 2023 08:30:45 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Initialize ListenSocket array earlier.

commit   : 5fec3c870ec8c1e9c88c368243b1533a2d5c53e7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Aug 2023 09:09:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Aug 2023 09:09:40 +0300    

Click here for diff

After commit b0bea38705, syslogger prints 63 warnings about failing to  
close a listen socket at postmaster startup. That's because the  
syslogger process forks before the ListenSockets array is initialized,  
so ClosePostmasterPorts() calls "close(0)" 64 times. The first call  
succeeds, because fd 0 is stdin.  
  
This has been like this since commit 9a86f03b4e in version 13, which  
moved the SysLogger_Start() call to before initializing ListenSockets.  
We just didn't notice until commit b0bea38705 added the LOG message.  
  
Reported by Michael Paquier and Jeff Janes.  
  
Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/ZOvvuQe0rdj2slA9%40paquier.xyz  
Discussion: https://www.postgresql.org/message-id/[email protected]#482670177eb4eaf4c9f03c1eed963e5f  
Backpatch-through: 13  

M src/backend/postmaster/postmaster.c

Tweak pg_promote() to report failures on kill() or postmaster failures

commit   : f593c5517d14a949ae659eec470eb6bc0d2fdd5d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Aug 2023 08:45:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Aug 2023 08:45:04 +0900    

Click here for diff

Since its introduction in 10074651e335, pg_promote() has been returning  
a false status in three cases:  
- SIGUSR1 not sent to the postmaster process.  
- Postmaster death during standby promotion.  
- Standby not promoted within the specified wait time.  
  
An application calling this function will have a hard time understanding  
what a false state returned actually means.  
  
Per discussion, this switches the two first states to fail rather than  
return a "false" status, making the second case more consistent with the  
existing CHECK_FOR_INTERRUPTS in the wait loop.  False is only returned  
when the promotion is not completed within the specified time (60s by  
default).  
  
Author: Ashutosh Sharma  
Reviewed-by: Fujii Masao, Laurenz Albe, Michael Paquier  
Discussion: https://postgr.es/m/CAE9k0P=QTrwptL0t4J0fuBRDDjgsT-0PVKd-ikd96i1hyL7Bcg@mail.gmail.com  

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

Make error messages about WAL segment size more consistent

commit   : 36e4419d1f1ef06bba58a28a870aaaa8de73bb46    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2023 15:15:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2023 15:15:20 +0200    

Click here for diff

Make the primary messages more compact and make the detail messages  
uniform.  In initdb.c and pg_resetwal.c, use the newish  
option_parse_int() to simplify some of the option parsing.  For the  
backend GUC wal_segment_size, add a GUC check hook to do the  
verification instead of coding it in bootstrap.c.  This might be  
overkill, but that way the check is in the right place and it becomes  
more self-documenting.  
  
In passing, make pg_controldata use the logging API for warning  
messages.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/utils/misc/guc_tables.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/utils/guc_hooks.h

Fix some typos in wait_event_names.txt

commit   : bb9002257b2211c213ad5989446d83a61c6446d3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 17:09:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 17:09:12 +0900    

Click here for diff

Noticed in passing, while hacking on a different patch touching this  
area.  

M src/backend/utils/activity/wait_event_names.txt

Convert encrypted SSL test keys to PKCS#8 format

commit   : 648c72956f980771c5a3686ee68c5e2c5b62a534    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2023 09:26:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2023 09:26:36 +0200    

Click here for diff

OpenSSL in FIPS mode rejects several encrypted private keys used in  
the test suites ssl and ssl_passphrase_callback.  This is because they  
are in a "traditional" OpenSSL format that uses MD5 for key  
generation.  The fix is to convert them to the more standard PKCS#8  
format that uses SHA1 for key derivation.  
  
This commit contains the converted keys, with the conversion done like  
this:  
  
openssl pkcs8 -topk8 -in src/test/modules/ssl_passphrase_callback/server.key -passin pass:FooBaR1 -out src/test/modules/ssl_passphrase_callback/server.key.new -passout pass:FooBaR1  
mv src/test/modules/ssl_passphrase_callback/server.key.new src/test/modules/ssl_passphrase_callback/server.key  
  
etc., as well as updated build rules to generate the keys in the new  
format if they need to be regenerated.  
  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/64de784b-8833-e055-3bd4-7420e6675351%40eisentraut.org  

M src/test/modules/ssl_passphrase_callback/Makefile
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/ssl_passphrase_callback/server.key
M src/test/ssl/ssl/client-encrypted-pem.key
M src/test/ssl/ssl/server-password.key
M src/test/ssl/sslfiles.mk

Tighten unit parsing in internal values

commit   : 617f9b7d4b10fec00a86802eeb34d7295c52d747    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 14:27:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 14:27:17 +0900    

Click here for diff

Interval values now generate an error when the user has multiple  
consecutive units or a unit without a value.  Previously, it was  
possible to specify multiple units consecutively which is contrary to  
what the documentation allows, so it was possible to finish with  
confusing interval values.  
  
This is a follow-up of the work done in 165d581f146b.  
  
Author: Joseph Koshakow  
Reviewed-by: Jacob Champion, Gurjeet Singh, Reid Thompson  
Discussion: https://postgr.es/m/CAAvxfHd-yNO+XYnUxL=GaNZ1n+eE0V-oE0+-cC1jdjdU0KS3iw@mail.gmail.com  

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

Tighten handling of "ago" in interval values

commit   : 165d581f146b09543b832513ee00fead132ba6b1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 13:49:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 13:49:55 +0900    

Click here for diff

This commit Restrict the unit "ago" to only appear at the end of the  
interval.  According to the documentation, a direction can only be  
defined at the end of an interval, but it was possible to define it in  
the middle of the string or define it multiple times.  
  
In spirit, this is similar to the error handling improvements done in  
5b3c5953553b or bcc704b524904.  
  
Author: Joseph Koshakow  
Reviewed-by: Jacob Champion, Gurjeet Singh, Reid Thompson  
Discussion: https://postgr.es/m/CAAvxfHd-yNO+XYnUxL=GaNZ1n+eE0V-oE0+-cC1jdjdU0KS3iw@mail.gmail.com  

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

Format list of catalog files in makefile vertically

commit   : 9a0ddc39c64b8dddddf4f58eb137f53bf94eb098    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2023 06:18:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Aug 2023 06:18:39 +0200    

Click here for diff

This makes it easier to compare the lists visually with the  
corresponding meson lists.  
  
In passing, copy over some relevant comments from the makefiles to  
meson.build.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a306be82-ee71-4554-d499-49a45a654396%40eisentraut.org  

M src/backend/catalog/Makefile
M src/include/catalog/meson.build

Remove dead code in DecodeInterval()

commit   : d6d1430f404386162831bc32906ad174b2007776    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 12:53:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Aug 2023 12:53:41 +0900    

Click here for diff

This commit removes some dead code related to the unit type RESERV,  
whose last use has been removed from the unit lookup table used for  
intervals ("deltatktbl" in datetime.c) in 666cbae16da4.  Before that,  
RESERV was used as an equivalent of "invalid", but that's now  
unreachable.  
  
Author: Joseph Koshakow  
Reviewed-by: Jacob Champion, Gurjeet Singh, Reid Thompson  
Discussion: https://postgr.es/m/CAAvxfHd-yNO+XYnUxL=GaNZ1n+eE0V-oE0+-cC1jdjdU0KS3iw@mail.gmail.com  

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

Show names of DEALLOCATE as constants in pg_stat_statements

commit   : bb45156f342c2cdb88cdd7f9efdc4541e910ec86    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 27 Aug 2023 17:27:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 27 Aug 2023 17:27:44 +0900    

Click here for diff

This commit switches query jumbling so as prepared statement names are  
treated as constants in DeallocateStmt.  A boolean field is added to  
DeallocateStmt to make a distinction between ALL and named prepared  
statements, as "name" was used to make this difference before, NULL  
meaning DEALLOCATE ALL.  
  
Prior to this commit, DEALLOCATE was not tracked in pg_stat_statements,  
for the reason that it was not possible to treat its name parameter as a  
constant.  Now that query jumbling applies to all the utility nodes,  
this reason does not apply anymore.  
  
Like 638d42a3c520, this can be a huge advantage for monitoring where  
prepared statement names are randomly generated, preventing bloat in  
pg_stat_statements.  A couple of tests are added to track the new  
behavior.  
  
Author: Dagfinn Ilmari Mannsåker, Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/utility.sql
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

Generate new LOG for "trust" connections under log_connections

commit   : e48b19c5db3185e1868391176fc040df08a149fb    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Aug 2023 20:11:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Aug 2023 20:11:19 +0900    

Click here for diff

Adding an extra LOG for connections that have not set an authn ID, like  
when the "trust" authentication method is used, is useful for audit  
purposes.  
  
A couple of TAP tests for SSL and authentication need to be tweaked to  
adapt to this new LOG generated, as some scenarios expected no logs but  
they now get a hit.  
  
Reported-by: Shaun Thomas  
Author: Jacob Champion  
Reviewed-by: Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/CAFdbL1N7-GF-ZXKaB3XuGA+CkSmnjFvqb8hgjMnDfd+uhL2u-A@mail.gmail.com  

M src/backend/libpq/auth.c
M src/test/authentication/t/001_password.pl
M src/test/ssl/t/001_ssltests.pl

Avoid non-POSIX cp flags

commit   : 1a4fd77db85abac63e178506335aee74625f6499    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 25 Aug 2023 06:43:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 25 Aug 2023 06:43:37 -0700    

Click here for diff

Commit 252dcb32 used cp -a, but apparently Solaris doesn't like that.  Use cp  
-RPp instead.  
  
Author: Thomas Munro <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGL10AoQVMMqgOJ8CTjoz9MLidD8ik2e8PibzLNMz0+aRg@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/pg_regress.c

Rename test table to avoid cs_CZ locale problem

commit   : 98976d0ce0a3947427182394041f6dd0e33438b4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 25 Aug 2023 14:06:13 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 25 Aug 2023 14:06:13 +0200    

Click here for diff

Per buildfarm member Hippopotamus  

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

Catalog not-null constraints

commit   : b0e96f311985bceba79825214f8e43f65afa653a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 25 Aug 2023 13:31:24 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 25 Aug 2023 13:31:24 +0200    

Click here for diff

We now create contype='n' pg_constraint rows for not-null constraints.  
  
We propagate these constraints to other tables during operations such as  
adding inheritance relationships, creating and attaching partitions and  
creating tables LIKE other tables.  We also spawn not-null constraints  
for inheritance child tables when their parents have primary keys.  
These related constraints mostly follow the well-known rules of  
conislocal and coninhcount that we have for CHECK constraints, with some  
adaptations: for example, as opposed to CHECK constraints, we don't  
match not-null ones by name when descending a hierarchy to alter it,  
instead matching by column name that they apply to.  This means we don't  
require the constraint names to be identical across a hierarchy.  
  
For now, we omit them for system catalogs.  Maybe this is worth  
reconsidering.  We don't support NOT VALID nor DEFERRABLE clauses  
either; these can be added as separate features later (this patch is  
already large and complicated enough.)  
  
psql shows these constraints in \d+.  
  
pg_dump requires some ad-hoc hacks, particularly when dumping a primary  
key.  We now create one "throwaway" not-null constraint for each column  
in the PK together with the CREATE TABLE command, and once the PK is  
created, all those throwaway constraints are removed.  This avoids  
having to check each tuple for nullness when the dump restores the  
primary key creation.  
  
pg_upgrading from an older release requires a somewhat brittle procedure  
to create a constraint state that matches what would be created if the  
database were being created fresh in Postgres 17.  I have tested all the  
scenarios I could think of, and it works correctly as far as I can tell,  
but I could have neglected weird cases.  
  
This patch has been very long in the making.  The first patch was  
written by Bernd Helmle in 2010 to add a new pg_constraint.contype value  
('n'), which I (Álvaro) then hijacked in 2011 and 2012, until that one  
was killed by the realization that we ought to use contype='c' instead:  
manufactured CHECK constraints.  However, later SQL standard  
development, as well as nonobvious emergent properties of that design  
(mostly, failure to distinguish them from "normal" CHECK constraints as  
well as the performance implication of having to test the CHECK  
expression) led us to reconsider this choice, so now the current  
implementation uses contype='n' again.  During Postgres 16 this had  
already been introduced by commit e056c557aef4, but there were some  
problems mainly with the pg_upgrade procedure that couldn't be fixed in  
reasonable time, so it was reverted.  
  
In 2016 Vitaly Burovoy also worked on this feature[1] but found no  
consensus for his proposed approach, which was claimed to be closer to  
the letter of the standard, requiring an additional pg_attribute column  
to track the OID of the not-null constraint for that column.  
[1] https://postgr.es/m/CAKOSWNkN6HSyatuys8xZxzRCR-KL1OkHS5-b9qd9bf1Rad3PLA@mail.gmail.com  
  
Author: Álvaro Herrera <[email protected]>  
Author: Bernd Helmle <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/cluster.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

Reset the logical worker type while cleaning up other worker info.

commit   : 9c13b6814ac7943036c64b377675184b243f04e8    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 25 Aug 2023 08:57:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 25 Aug 2023 08:57:55 +0530    

Click here for diff

Commit 2a8b40e36 introduces the worker type field for logical replication  
workers, but forgot to reset the type when the worker exits. This can lead  
to recognizing a stopped worker as a valid logical replication worker.  
  
Fix it by resetting the worker type and additionally adding the safeguard  
to not use LogicalRepWorker until ->in_use is verified.  
  
Reported-by: Thomas Munro based on cfbot reports.  
Author: Hou Zhijie, Alvaro Herrera  
Reviewed-by: Amit Kapila  
Discussion: http://postgr.es/m/CA+hUKGK2RQh4LifVgBmkHsCYChP-65UwGXOmnCzYVa5aAt4GWg@mail.gmail.com  

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

Use "template" data directory in tests

commit   : 252dcb32397f64a5e1ceac05b29a271ab19aa960    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2023 14:17:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2023 14:17:03 -0700    

Click here for diff

When running all (or just many) of our tests, a significant portion of both  
CPU time and IO is spent running initdb. Most of those initdb runs don't  
specify any options influencing properties of the created data directory.  
  
Avoid most of that overhead by creating a "template" data directory, alongside  
the temporary installation. Instead of running initdb, pg_regress and tap  
tests can copy that data directory. When a tap test specifies options to  
initdb, the template data directory is not used. That could be relaxed for  
some options, but it's not clear it's worth the effort.  
  
There unfortunately is some duplication between pg_regress.c and Cluster.pm,  
but there are no easy ways of sharing that code without introducing additional  
complexity.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.tasks.yml
M meson.build
M src/Makefile.global.in
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/pg_regress.c

pg_upgrade: Bump MESSAGE_WIDTH.

commit   : 9625845532ae03e7da3fc8fc592c6ec333b93166    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 24 Aug 2023 10:13:31 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 24 Aug 2023 10:13:31 -0700    

Click here for diff

Commit 7b378237aa added a status message to pg_upgrade that is 60  
characters wide.  Since the MESSAGE_WIDTH macro is currently set to  
60, there is no space between this new status message and the "ok"  
or "failed" indicator appended when the step completes.  To fix  
this problem, this commit increases the value of MESSAGE_WIDTH to  
62.  
  
Suggested-by: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/CALj2ACVVvk1cYLtWVxHv%3DZ1Ubq%3DUES9fhKbUU4c9k4W%2BfEDnbw%40mail.gmail.com  
Backpatch-through: 16  

M src/bin/pg_upgrade/pg_upgrade.h

Avoid unnecessary plancache revalidation of utility statements.

commit   : d8b2fcc9d4b5af9704dadf00d68859229d9868ad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Aug 2023 12:02:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Aug 2023 12:02:40 -0400    

Click here for diff

Revalidation of a plancache entry (after a cache invalidation event)  
requires acquiring a snapshot.  Normally that is harmless, but not  
if the cached statement is one that needs to run without acquiring a  
snapshot.  We were already aware of that for TransactionStmts,  
but for some reason hadn't extrapolated to the other statements that  
PlannedStmtRequiresSnapshot() knows mustn't set a snapshot.  This can  
lead to unexpected failures of commands such as SET TRANSACTION  
ISOLATION LEVEL.  We can fix it in the same way, by excluding those  
command types from revalidation.  
  
However, we can do even better than that: there is no need to  
revalidate for any statement type for which parse analysis, rewrite,  
and plan steps do nothing interesting, which is nearly all utility  
commands.  To mechanize this, invent a parser function  
stmt_requires_parse_analysis() that tells whether parse analysis does  
anything beyond wrapping a CMD_UTILITY Query around the raw parse  
tree.  If that's what it does, then rewrite and plan will just  
skip the Query, so that it is not possible for the same raw parse  
tree to produce a different plan tree after cache invalidation.  
  
stmt_requires_parse_analysis() is basically equivalent to the  
existing function analyze_requires_snapshot(), except that for  
obscure reasons that function omits ReturnStmt and CallStmt.  
It is unclear whether those were oversights or intentional.  
I have not been able to demonstrate a bug from not acquiring a  
snapshot while analyzing these commands, but at best it seems mighty  
fragile.  It seems safer to acquire a snapshot for parse analysis of  
these commands too, which allows making stmt_requires_parse_analysis  
and analyze_requires_snapshot equivalent.  
  
In passing this fixes a second bug, which is that ResetPlanCache  
would exclude ReturnStmts and CallStmts from revalidation.  
That's surely *not* safe, since they contain parsable expressions.  
  
Per bug #18059 from Pavel Kulakov.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/backend/utils/cache/plancache.c
M src/include/parser/analyze.h
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Add test for inherited CHECK constraint drop

commit   : 3da13a6257bc08b1d402c83feb2a35450f988365    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Aug 2023 16:51:43 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Aug 2023 16:51:43 +0200    

Click here for diff

This code is insufficiently covered by tests, so add a few small test  
cases to immortalize its behavior before it gets rewritten completely by  
the project to catalog NOT NULL constraints.  

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

Use FD_CLOEXEC on ListenSockets

commit   : b0bea38705b2d14e57d353a701ecfdb8a04983b1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Aug 2023 17:03:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Aug 2023 17:03:05 +0300    

Click here for diff

It's good hygiene if e.g. an extension launches a subprogram when  
being loaded. We went through some effort to close them in the child  
process in EXEC_BACKEND mode, but it's better to not hand them down to  
the child process in the first place. We still need to close them  
after fork when !EXEC_BACKEND, but it's a little simpler.  
  
In the passing, LOG a message if closing the client connection or  
listen socket fails. Shouldn't happen, but if it does, would be nice  
to know.  
  
Reviewed-by: Tristan Partin, Andres Freund, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c

Fix lack of message pluralization

commit   : d71e6055e45318b5cff2094025d641b954517fa9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 14:22:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 14:22:02 +0200    

Click here for diff

M src/backend/replication/slot.c

Update DECLARE_INDEX documentation

commit   : 3c09d115948cf33d398e9f3fe9c413cf6bbaa802    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 13:59:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 13:59:40 +0200    

Click here for diff

Update source code comment changes belonging to the changes in  
6a6389a08b.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/catalog/genbki.h

Rename hook functions for debug_io_direct to match variable name.

commit   : 4f3514f201cf007a3e0c0abbf21b70a711269ab0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2023 14:12:45 +0200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 22 Aug 2023 14:12:45 +0200    

Click here for diff

Commit 319bae9a renamed the GUC.  Rename the check and assign functions  
to match, and alphabetize.  
  
Back-patch to 16.  
  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/2769341e-fa28-c2ee-3e4b-53fdcaaf2271%40eisentraut.org  

M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h

Add proargnames to multi-argument aggregate functions

commit   : b575a26c66e438225f1c0f95ed8c5efc793d3a14    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Aug 2023 11:53:42 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Aug 2023 11:53:42 +0200    

Click here for diff

Having argument names makes it easier to understand how to use the  
aggregate functions when inspecting them with \dfa or similar.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Reviewed-by: Jim Jones <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the error message when failing to restore the snapshot.

commit   : 27449ccc4d3a6ee77cbd13bed65f8fbea49486c1    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 24 Aug 2023 14:37:29 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 24 Aug 2023 14:37:29 +0530    

Click here for diff

The SnapBuildRestoreContents() used a const value in the error message to  
indicate the size in bytes it was expecting to read from the serialized  
snapshot file. Fix it by reporting the size that was actually passed.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Backpatch-through: 16  
Discussion: http://postgr.es/m/OS0PR01MB5716D408364F7DF32221C08D941FA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Fix translation markers

commit   : 9efcf442b9a4035be2692525be81a23224288d1b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 10:24:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 10:24:38 +0200    

Click here for diff

Conditionals cannot be inside gettext trigger functions, they must be  
applied outside.  

M src/backend/parser/parse_expr.c

pg_upgrade: Improve one log message

commit   : f9f3bea168496990037c55dd6961010e1acbba92    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 08:23:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2023 08:23:43 +0200    

Click here for diff

The parenthesized plural is unnecessary here and inconsistent with  
nearby similar messages.  

M src/bin/pg_upgrade/check.c

Meson: check for pg_config_paths.h left over from make

commit   : 6ff385f20c4ed2af707d523ceb2bea694668c123    
  
author   : David Rowley <[email protected]>    
date     : Thu, 24 Aug 2023 10:33:53 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 24 Aug 2023 10:33:53 +1200    

Click here for diff

The meson build scripts attempt to find files left over from configure  
and fail, mentioning that "make maintainer-clean" should be run to remove  
these.  This seems to have been done for files generated from configure.  
pg_config_paths.h is generated during the actual make build, so seems to  
have been missed.  This would result in compilation using the wrong  
pg_config_paths.h file.  
  
Here we just add this file to generated_sources_ac so that meson errors  
out if pg_config_paths.h exists.  
  
Likely this wasn't noticed before because make maintainer-clean will  
remove pg_config_paths.h, however, people using the MSVC build scripts  
are more likely to run into issues and they have to manually remove  
these files and pg_config_paths.h wasn't listed as a conflicting file to  
remove in the meson log.  
  
Backpatch-through: 16, where meson support was added  
Discussion: https://postgr.es/m/CAApHDvqjYOxZfmLKAOWKFEE7LOr9_E6UA6YNmx9r8nxStcS3gg@mail.gmail.com  

M src/port/meson.build

ci: Make compute resources for CI configurable

commit   : a28166df8c5a00ec3d9b3550a4f6598593ebf873    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    

Click here for diff

See prior commit for an explanation for the goal of the change and why it had  
to be split into two commits.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.tasks.yml
A .cirrus.yml
M src/tools/ci/README

ci: Prepare to make compute resources for CI configurable

commit   : 19cc96503d23c79900162396077a900e7507c4d3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    

Click here for diff

cirrus-ci will soon restrict the amount of free resources every user gets (as  
have many other CI providers). For most users of CI that should not be an  
issue. But e.g. for cfbot it will be an issue.  
  
To allow configuring different resources on a per-repository basis, introduce  
infrastructure for overriding the task execution environment. Unfortunately  
this is not entirely trivial, as yaml anchors have to be defined before their  
use, and cirrus-ci only allows injecting additional contents at the end of  
.cirrus.yml.  
  
To deal with that, move the definition of the CI tasks to  
.cirrus.tasks.yml. The main .cirrus.yml is loaded first, then, if defined, the  
file referenced by the REPO_CI_CONFIG_GIT_URL variable, will be added,  
followed by the contents of .cirrus.tasks.yml. That allows  
REPO_CI_CONFIG_GIT_URL to override the yaml anchors defined in .cirrus.yml.  
  
Unfortunately git's default merge / rebase strategy does not handle copied  
files, just renamed ones. To avoid painful rebasing over this change, this  
commit just renames .cirrus.yml to .cirrus.tasks.yml, without adding a new  
.cirrus.yml. That's done in the followup commit, which moves the relevant  
portion of .cirrus.tasks.yml to .cirrus.yml.  Until that is done,  
REPO_CI_CONFIG_GIT_URL does not fully work.  
  
The subsequent commit adds documentation for how to configure custom compute  
resources to src/tools/ci/README  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

A .cirrus.star
R100 .cirrus.yml .cirrus.tasks.yml

Bump catversion for to_bin() and to_oct().

commit   : d7f249020a11a87cedad04fb071f3287321d5f20    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 23 Aug 2023 14:19:58 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 23 Aug 2023 14:19:58 -0700    

Click here for diff

Missed in 260a1f18da.  

M src/include/catalog/catversion.h

ci: Use VMs for SanityCheck and CompilerWarnings

commit   : b2c91d841f1f58f6f553d9e6832fdfaedec00402    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    

Click here for diff

The main reason for this change is to reduce different ways of executing  
tasks, making it easier to use custom compute resources for cfbot. A secondary  
benefit is that the tasks seem slightly faster this way, apparently the  
increased startup overhead is outweighed by reduced runtime overhead.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Move execution method of tasks into yaml templates

commit   : 119ee6ab1b0081e339cac08d18ae625fcc77bcd1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    

Click here for diff

This is done in preparation for making the compute resources for CI  
configurable. It also looks cleaner.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Don't specify amount of memory

commit   : 794e14e219c7997c7f59ea8b7923daee95d2a3a6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:25:56 -0700    

Click here for diff

The number of CPUs is the cost-determining factor. Most instance types that  
run tests have more memory/core than what we specified, there's no real  
benefit in wasting that.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

Avoid use of Perl getprotobyname

commit   : 01226c682ce6cc130c1057fcd5b0f24b2b622d39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 20:48:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 20:48:48 +0200    

Click here for diff

getprotobyname returns undefined on some CI machines.  It's not clear  
why.  The code overall still works, but it raises a warning.  
  
In PostgreSQL C code, we always call socket() with 0 for the protocol  
argument, so we should be able to do the same in Perl (since the Perl  
documentation says that the arguments of the socket function are the  
same as in C).  So do that, to avoid the issue.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org  

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

Fix _bt_allequalimage() call within critical section.

commit   : bf8bf6d0bddbbaa9dc6c27b383f026273064d2a2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Aug 2023 18:08:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Aug 2023 18:08:40 +0300    

Click here for diff

_bt_allequalimage() does complicated things, so it's not OK to call it  
in a critical section. Per buildfarm failure on 'prion', which uses  
-DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE options.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Backpatch-through: 16, like commit ccadf73163 that introduced this  

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

Add to_bin() and to_oct().

commit   : 260a1f18dae8729f99cefe4e1f759193fd6bedd0    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 23 Aug 2023 07:49:03 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 23 Aug 2023 07:49:03 -0700    

Click here for diff

This commit introduces functions for converting numbers to their  
equivalent binary and octal representations.  Also, the base  
conversion code for these functions and to_hex() has been moved to  
a common helper function.  
  
Co-authored-by: Eric Radman  
Reviewed-by: Ian Barwick, Dag Lem, Vignesh C, Tom Lane, Peter Eisentraut, Kirk Wolak, Vik Fearing, John Naylor, Dean Rasheed  
Discussion: https://postgr.es/m/Y6IyTQQ/TsD5wnsH%40vm3.eradman.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/varlena.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Use the buffer cache when initializing an unlogged index.

commit   : ccadf73163ca88bdaa74b8223d4dde05d17f550b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Aug 2023 17:21:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Aug 2023 17:21:31 +0300    

Click here for diff

Some of the ambuildempty functions used smgrwrite() directly, followed  
by smgrimmedsync(). A few small problems with that:  
  
Firstly, one is supposed to use smgrextend() when extending a  
relation, not smgrwrite(). It doesn't make much difference in  
production builds. smgrextend() updates the relation size cache, so  
you miss that, but that's harmless because we never use the cached  
relation size of an init fork. But if you compile with  
CHECK_WRITE_VS_EXTEND, you get an assertion failure.  
  
Secondly, the smgrwrite() calls were performed before WAL-logging, so  
the page image written to disk had 0/0 as the LSN, not the LSN of the  
WAL record. That's also harmless in practice, but seems sloppy.  
  
Thirdly, it's better to use the buffer cache, because then you don't  
need to smgrimmedsync() the relation to disk, which adds latency.  
Bypassing the cache makes sense for bulk operations like index  
creation, but not when you're just initializing an empty index.  
Creation of unlogged tables is hardly performance bottleneck in any  
real world applications, but nevertheless.  
  
Backpatch to v16, but no further. These issues should be harmless in  
practice, so better to not rock the boat in older branches.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spginsert.c

doc: Replace list of drivers and PLs with wiki link

commit   : ee99330a0b39c47a7ac44c6c8fdd74e3da841ba5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 14:13:07 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 14:13:07 +0200    

Click here for diff

The list of external language drivers and procedural languages was  
never complete or exhaustive, and rather than attempting to manage  
it the content has migrated to the wiki.  This replaces the tables  
altogether with links to the wiki as we regularly get requests for  
adding various projects,  which we reject without any clear policy  
for why or how the content should be managed.  
  
The threads linked to below are the most recent discussions about  
this, the archives contain many more.  
  
Backpatch to all supported branches since the list on the wiki  
applies to all branches.  
  
Author: Jonathan Katz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v11  

M doc/src/sgml/external-projects.sgml

doc: Add more ICU rules examples

commit   : 17ec2c5dfa8dc6fee3df749d214238d34ee681c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    

Click here for diff

In particular, add an example EBCDIC collation.  
  
Author: Daniel Verite <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_database.sgml

Fix wording in comment

commit   : 27a36f79b6d15cb2b267d16084007aa9d6917aec    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 10:22:55 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 10:22:55 +0200    

Click here for diff

The comment for the DSM_OP_CREATE paramater read "the a new handle"  
which is confusing. Fix by rewording to indicate what the parameter  
means for DSM_OP_CREATE.  
  
Reported-by: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3J2bc197ym-M_ykOXb9ox2eNn-QNKNeoSAoHYSw2NCOnw@mail.gmail.com  

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

pg_upgrade: Avoid shadowing global var in function

commit   : d0e408313536d4d4a0fb4516f2596adbe06a0e60    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 09:41:22 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Aug 2023 09:41:22 +0200    

Click here for diff

The new_cluster parameter in check_for_new_tablespace_dir was  
shadowing the globally defined new_cluster variable, causing  
compiler warnings when running with -Wshadow. The function is  
only applicable to the new cluster, so remove the parameter  
rather than rename to match check_new_cluster_is_empty which  
also only applies to the new cluster.  
  
Author: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/CAHut+PvS_PHLntWy1yTgXv0O1tWm4iVcKBQFzpoQRDsm2Ce_Fg@mail.gmail.com  

M src/bin/pg_upgrade/check.c

doc: Improve ICU external link

commit   : ed057fb68720dfeffc03e2b156c274f8ed10583a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 08:25:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 08:25:56 +0200    

Click here for diff

It previously pointed to the collation API documentation, which our  
users don't need, but the containing chapter seems useful.  

M doc/src/sgml/charset.sgml

Improve vertical spacing of documentation markup

commit   : ed9330cff57bf38df2c38ea4d4cbb44e1378d4d4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 08:12:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 08:12:50 +0200    

Click here for diff

M doc/src/sgml/charset.sgml

Some vertical reformatting

commit   : ae556c44163b900aa5dfcca023dfbcdb1e2fd5fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    

Click here for diff

Remove some line breaks that have become unnecessary after some  
variable renaming.  
  
Discussion: https://www.postgresql.org/message-id/flat/5ed89c69-f4e6-5dab-4003-63bde7460e5e%40eisentraut.org  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c

Rename some function arguments for better clarity

commit   : 23382b0f8b21e3f5330d765d1abfcef58d086111    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    

Click here for diff

Especially make sure that array arguments have plural names.  
  
Discussion: https://www.postgresql.org/message-id/flat/5ed89c69-f4e6-5dab-4003-63bde7460e5e%40eisentraut.org  

M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/include/catalog/index.h
M src/include/commands/defrem.h

Add const decorations

commit   : 11af63fb48d278b86aa948a5b57f136ef03c2bb7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 06:14:11 +0200    

Click here for diff

in index.c and indexcmds.c and some adjacent places.  This especially  
makes it easier to understand for some complicated function signatures  
which are the input and the output arguments.  
  
Discussion: https://www.postgresql.org/message-id/flat/5ed89c69-f4e6-5dab-4003-63bde7460e5e%40eisentraut.org  

M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/commands/indexcmds.c
M src/include/bootstrap/bootstrap.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/namespace.h
M src/include/commands/defrem.h

Introduce macros for protocol characters.

commit   : f4b54e1ed9853ab9aff524494866823f951b1e7f    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 22 Aug 2023 19:16:12 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 22 Aug 2023 19:16:12 -0700    

Click here for diff

This commit introduces descriptively-named macros for the  
identifiers used in wire protocol messages.  These new macros are  
placed in a new header file so that they can be easily used by  
third-party code.  
  
Author: Dave Cramer  
Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com  

M src/backend/access/common/printsimple.c
M src/backend/access/transam/parallel.c
M src/backend/backup/basebackup_copy.c
M src/backend/commands/async.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/include/Makefile
M src/include/libpq/pqcomm.h
A src/include/libpq/protocol.h
M src/include/meson.build
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-trace.c
M src/tools/msvc/Install.pm

ExtendBufferedWhat -> BufferManagerRelation.

commit   : 711479115836b2180f50c00bbf0773220848a7f5    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 23 Aug 2023 12:10:18 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 23 Aug 2023 12:10:18 +1200    

Click here for diff

Commit 31966b15 invented a way for functions dealing with relation  
extension to accept a Relation in online code and an SMgrRelation in  
recovery code.  It seems highly likely that future bufmgr.c interfaces  
will face the same problem, and need to do something similar.  
Generalize the names so that each interface doesn't have to re-invent  
the wheel.  
  
Back-patch to 16.  Since extension AM authors might start using the  
constructor macros once 16 ships, we agreed to do the rename in 16  
rather than waiting for 17.  
  
Reviewed-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B6tLD2BhpRWycEoti6LVLyQq457UL4ticP5xd8LqHySA%40mail.gmail.com  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/sequence.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/freespace/freespace.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Fix pg_dump assertion failure when dumping pg_catalog.

commit   : 37188cea0c16f3f27ec65b526ffe12f6469142fc    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 22 Aug 2023 11:21:36 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 22 Aug 2023 11:21:36 -0700    

Click here for diff

Commit 396d348b04 did not account for the default collation.  
  
Also, use pg_log_warning() instead of Assert().  
  
Discussion: https://postgr.es/m/ce071503fee88334aa70f360e6e4ea14d48305ee.camel%40j-davis.com  
Reviewed-by: Michael Paquier  
Backpatch-through: 15  

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

Cache by-reference missing values in a long lived context

commit   : a68458108512890d03da39f0132b829ddd5a69ab    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Aug 2023 11:57:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Aug 2023 11:57:08 -0400    

Click here for diff

Attribute missing values might be needed past the lifetime of the tuple  
descriptors from which they are extracted. To avoid possibly using  
pointers for by-reference values which might thus be left dangling, we  
cache a datumCopy'd version of the datum in the TopMemoryContext. Since  
we first search for the value this only needs to be done once per  
session for any such value.  
  
Original complaint from Tom Lane, idea for mitigation by Andrew Dunstan,  
tweaked by Tom Lane.  
  
Backpatch to version 11 where missing values were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/tools/pgindent/typedefs.list

Add comment missing in a4a232b1e702

commit   : 757fa45c86bdadc36cae34fca383e715e73eec67    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 22 Aug 2023 12:22:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 22 Aug 2023 12:22:03 +0200    

Click here for diff

Noticed while studying nearby code  

M src/backend/catalog/heap.c

Simplify the logical worker type checks by using the switch on worker type.

commit   : 1cdc6d86bfc3bbe2189a4d9d54a4fa8b6c98ea0a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 22 Aug 2023 08:44:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 22 Aug 2023 08:44:09 +0530    

Click here for diff

The current code uses if/else statements at various places to take worker  
specific actions. Change those to use the switch on worker type added by  
commit 2a8b40e368. This makes code easier to read and understand.  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila, Hou Zhijie  
Discussion: http://postgr.es/m/CAHut+PttPSuP0yoZ=9zLDXKqTJ=d0bhxwKaEaNcaym1XqcvDEg@mail.gmail.com  

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

Fix pg_stat_reset_single_table_counters() for shared relations

commit   : 6fde2d9a005a5bc04aa059d3faeb865c8dd322ce    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 21 Aug 2023 13:32:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 21 Aug 2023 13:32:14 +0900    

Click here for diff

This commit fixes the function of $subject for shared relations.  This  
feature has been added by e042678.  Unfortunately, this new behavior got  
removed by 5891c7a when moving statistics to shared memory.  
  
Reported-by: Mitsuru Hinata  
Author: Masahiro Ikeda  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Bump catalog version for pg_wait_events

commit   : 1951d21b29939ddcb0e30a018cf413b949e40d97    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 20 Aug 2023 15:44:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 20 Aug 2023 15:44:48 +0900    

Click here for diff

Missed in 1e68e43, because I cannot correctly merge a branch.  

M src/include/catalog/catversion.h

Add system view pg_wait_events

commit   : 1e68e43d3f0ff1dcf4a5926f9d6336b86bda034d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 20 Aug 2023 15:35:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 20 Aug 2023 15:35:02 +0900    

Click here for diff

This new view, wrapped around a SRF, shows some information known about  
wait events, as of:  
- Name.  
- Type (Activity, I/O, Extension, etc.).  
- Description.  
  
All the information retrieved comes from wait_event_names.txt, and the  
description is the same as the documentation with filters applied to  
remove any XML markups.  This view is useful when joined with  
pg_stat_activity to get the description of a wait event reported.  
  
Custom wait events for extensions are included in the view.  
  
Original idea by Yves Colin.  
  
Author: Bertrand Drouvot  
Reviewed-by: Kyotaro Horiguchi, Masahiro Ikeda, Tom Lane, Michael  
Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/system-views.sgml
M src/backend/Makefile
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/.gitignore
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/wait_event.c
A src/backend/utils/activity/wait_event_funcs.c
M src/include/catalog/pg_proc.dat
M src/include/utils/meson.build
M src/include/utils/wait_event.h
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

ci: macos: use cached macports install

commit   : a2a6249cf1a4210caac534e8454a1614d0dd081a    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Aug 2023 12:40:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Aug 2023 12:40:45 -0700    

Click here for diff

A significant chunk of the time on the macos CI task is spent installing  
packages using homebrew. The downloads of the packages are cached, but the  
installation needs to happen every time. We can't cache the whole homebrew  
installation, because it is too large due to pre-installed packages.  
  
Speed this up by installing packages using macports and caching the  
installation as .dmg. That's a lot faster than unpacking a tarball.  
  
In addition, don't install llvm - it wasn't enabled when building, so it's  
just a waste of time/space.  
  
This substantially speeds up the mac CI time, both in the cold cache and in  
the warm cache case (the latter from ~1m20s to ~5s).  
  
It doesn't seem great to have diverging sources of packages for CI between  
branches, so backpatch to 15 (where CI was added).  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI was added  

M .cirrus.yml
A src/tools/ci/ci_macports_packages.sh

Remove dubious warning message from SQL/JSON functions

commit   : 881cd9e581c2c40023f82edcd1cd2335691b78f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Aug 2023 07:41:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Aug 2023 07:41:14 +0200    

Click here for diff

There was a warning that FORMAT JSON has no effect on json/jsonb  
types, which is true, but it's not clear why we should issue a warning  
about it.  The SQL standard does not say anything about this, which  
should generally govern the behavior here.  So remove it.  
  
Discussion: https://www.postgresql.org/message-id/flat/dfec2cae-d17e-c508-6d16-c2dba82db486%40eisentraut.org  

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

pg_upgrade: Improve style of a few verbose messages

commit   : 249d74394500e0830d45769423fe8aac7012537c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Aug 2023 09:39:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Aug 2023 09:39:55 +0900    

Click here for diff

Author: Peter Smith  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAHut+PuOB4bUwkYAjA_NkTrYaocKy6W3ZYK5Pin305R7mNSLgA@mail.gmail.com  

M src/bin/pg_upgrade/info.c

Fix format if entry in wait_event_names.txt

commit   : 00e49233a94b8945c205e55959900ac741f10766    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Aug 2023 08:11:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Aug 2023 08:11:10 +0900    

Click here for diff

The entry LockManager had two successive whitespaces between two words.  
This is not an actual bug, but let's be clean.  Thinko in fa88928.  
  
Reported-by: Masahiro Ikeda  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/wait_event_names.txt

Add a few recent commits to .git-blame-ignore-revs.

commit   : 0df7d1da40e3e639739eacccf3bca99a81803da7    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 17 Aug 2023 07:25:18 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 17 Aug 2023 07:25:18 -0700    

Click here for diff

Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/20230815203109.GA2596919%40nathanxps13  

M .git-blame-ignore-revs

Remove traces of Sun -lposix4.

commit   : 8fe4beaa21a4ab4d37bcfa7f8e2a8c76a741e478    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 16:16:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 16:16:43 +1200    

Click here for diff

This was a library on ancient Solaris systems, which was eventually  
replaced by -lrt, itself now redundant on that OS.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLLVx4drdvXats9PxH3eeB%2BE2NkJReJ%2BRGmaOpU%3D9rgEA%40mail.gmail.com  

M configure
M configure.ac
M meson.build

Don't probe extra libraries for fdatasync.

commit   : 64393a7ff9ec36164af337ae5ec33e3624d1450c    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 16:11:41 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 16:11:41 +1200    

Click here for diff

Commit d2e15083 got rid of the main configure probe and HAVE_FDATASYNC  
macro, but we still searched -lrt and -lposix4 for old Solaris systems.  
It's in the C library on modern Solaris, as on other supported systems.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLLVx4drdvXats9PxH3eeB%2BE2NkJReJ%2BRGmaOpU%3D9rgEA%40mail.gmail.com  

M configure
M configure.ac
M meson.build

Invalidate smgr_targblock in smgrrelease().

commit   : 81e36d3e0df8d3d7a3daa2e2216f96df23ffc96a    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 15:45:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Aug 2023 15:45:13 +1200    

Click here for diff

In rare circumstances involving relfilenode reuse, it might have been  
possible for smgr_targblock to finish up pointing past the end.  
  
Oversight in b74e94dc.  Back-patch to 15.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA%40mail.gmail.com  

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

sepgsql: Adjust regression expected output

commit   : d3c25ca1bf59bc4ccf589942f94bc5b945b1f46f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 17 Aug 2023 10:51:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 17 Aug 2023 10:51:26 +0900    

Click here for diff

Oversight in 352ea3a, where support for these subcommands has been  
added.  
  
Per buildfarm member rhinoceros.  

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

Add OAT hook calls for more subcommands of ALTER TABLE

commit   : 352ea3acf8a2d6e0490eb005bce38303de4564dd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 17 Aug 2023 08:54:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 17 Aug 2023 08:54:17 +0900    

Click here for diff

The OAT hooks are added in ALTER TABLE for the following subcommands:  
- { ENABLE | DISABLE | [NO] FORCE } ROW LEVEL SECURITY  
- { ENABLE | DISABLE } TRIGGER  
- { ENABLE | DISABLE } RULE.  Note that there was hook for pg_rewrite,  
but not for relation ALTER'ed in pg_class.  
  
Tests are added to test_oat_hook for all the subcommand patterns gaining  
hooks here.  Based on an ask from Legs Mansion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/test/modules/test_oat_hooks/Makefile
A src/test/modules/test_oat_hooks/expected/alter_table.out
M src/test/modules/test_oat_hooks/meson.build
A src/test/modules/test_oat_hooks/sql/alter_table.sql

Unify some error messages

commit   : dca20013ebab0f0176e610a36b846d899af1d451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 16:17:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 16:17:00 +0200    

Click here for diff

We had essentially the same error in several different wordings.  
Unify that.  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb_util.c
M src/interfaces/ecpg/test/expected/sql-sqljson.stderr
M src/test/regress/expected/sqljson.out

Improved CREATE SUBSCRIPTION message for clarity

commit   : 1e7ca1189cccff9851d4f12dacadf6ffff4b04fa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 15:09:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 15:09:50 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/CAHut+PtfzQ7JRkb0-Y_UejAxaLQ17-bGMvV4MJJHcPoP3ML2bg@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Remove incorrect field from information schema

commit   : 78806a95095c4fb9230a441925244690d9c07d23    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 13:46:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2023 13:46:26 +0200    

Click here for diff

The source code comment already said that the presence of the field  
element_types.domain_default might be a bug in the standard, since it  
never made sense there.  Indeed, the field is gone in newer versions  
of the standard.  So just remove it.  

M doc/src/sgml/information_schema.sgml
M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

Split out tiebreaker comparisons from comparetup_* functions

commit   : c9bfa40914be4a0882b904834c2bd32775a50d7b    
  
author   : John Naylor <[email protected]>    
date     : Wed, 16 Aug 2023 17:15:07 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 16 Aug 2023 17:15:07 +0700    

Click here for diff

Previously, if a specialized comparator found equal datum1 keys,  
the "comparetup" function would repeat the comparison on the  
datum before proceeding with the unabbreviated first key  
and/or additional sort keys.  
  
Move comparing additional sort keys into "tiebreak" functions so  
that specialized comparators can call these directly if needed,  
avoiding duplicate work.  
  
Reviewed by David Rowley  
  
Discussion: https://postgr.es/m/CAFBsxsGaVfUrjTghpf%3DkDBYY%3DjWx1PN-fuusVe7Vw5s0XqGdGw%40mail.gmail.com  

M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/utils/tuplesort.h

Fix code indentation vioaltion introduced in commit 9e9931d2b.

commit   : 89be0b89ae60c63856fd26d82a104781540e2312    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 15 Aug 2023 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 15 Aug 2023 17:45:00 +0900    

Click here for diff

Per buildfarm member koel  

M contrib/postgres_fdw/postgres_fdw.c

Re-allow FDWs and custom scan providers to replace joins with pseudoconstant quals.

commit   : 9e9931d2bf40e2fea447d779c2e133c2c1256ef3    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 15 Aug 2023 16:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 15 Aug 2023 16:45:00 +0900    

Click here for diff

This was disabled in commit 6f80a8d9c due to the lack of support for  
handling of pseudoconstant quals assigned to replaced joins in  
createplan.c.  To re-allow it, this patch adds the support by 1)  
modifying the ForeignPath and CustomPath structs so that if they  
represent foreign and custom scans replacing a join with a scan, they  
store the list of RestrictInfo nodes to apply to the join, as in  
JoinPaths, and by 2) modifying create_scan_plan() in createplan.c so  
that it uses that list in that case, instead of the baserestrictinfo  
list, to get pseudoconstant quals assigned to the join, as mentioned in  
the commit message for that commit.  
  
Important item for the release notes: this is non-backwards-compatible  
since it modifies the ForeignPath and CustomPath structs, as mentioned  
above, and changes the argument lists for FDW helper functions  
create_foreignscan_path(), create_foreign_join_path(), and  
create_foreign_upper_path().  
  
Richard Guo, with some additional changes by me, reviewed by Nishant  
Sharma, Suraj Kharage, and Richard Guo.  
  
Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/restrictinfo.h

De-pessimize ConditionVariableCancelSleep().

commit   : 5ffb7c775062ef18756e515ac96f06d012cbb950    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 15 Aug 2023 10:20:11 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 15 Aug 2023 10:20:11 +1200    

Click here for diff

Commit b91dd9de was concerned with a theoretical problem with our  
non-atomic condition variable operations.  If you stop sleeping, and  
then cancel the sleep in a separate step, you might be signaled in  
between, and that could be lost.  That doesn't matter for callers of  
ConditionVariableBroadcast(), but callers of ConditionVariableSignal()  
might be upset if a signal went missing like this.  
  
Commit bc971f4025c interacted badly with that logic, because it doesn't  
use ConditionVariableSleep(), which would normally put us back in the  
wait list.  ConditionVariableCancelSleep() would be confused and think  
we'd received an extra signal, and try to forward it to another backend,  
resulting in wakeup storms.  
  
New idea: ConditionVariableCancelSleep() can just return true if we've  
been signaled.  Hypothetical users of ConditionVariableSignal() would  
then still have a way to deal with rare lost signals if they are  
concerned about that problem.  
  
Back-patch to 16, where bc971f4025c arrived.  
  
Reported-by: Tomas Vondra <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/2840876b-4cfe-240f-0a7e-29ffd66711e7%40enterprisedb.com  

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

hio: Take number of prior relation extensions into account

commit   : 82a4edabd272f70d044faec8cf7fd1eab92d9991    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Aug 2023 09:54:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Aug 2023 09:54:03 -0700    

Click here for diff

The new relation extension logic, introduced in 00d1e02be24, could lead to  
slowdowns in some scenarios. E.g., when loading narrow rows into a table using  
COPY, the caller of RelationGetBufferForTuple() will only request a small  
number of pages. Without concurrency, we just extended using pwritev() in that  
case. However, if there is *some* concurrency, we switched between extending  
by a small number of pages and a larger number of pages, depending on the  
number of waiters for the relation extension logic.  However, some  
filesystems, XFS in particular, do not perform well when switching between  
extending files using fallocate() and pwritev().  
  
To avoid that issue, remember the number of prior relation extensions in  
BulkInsertState and extend more aggressively if there were prior relation  
extensions. That not just avoids the aforementioned slowdown, but also leads  
to noticeable performance gains in other situations, primarily due to  
extending more aggressively when there is no concurrency. I should have done  
it this way from the get go.  
  
Reported-by: Masahiko Sawada <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940=Kp6mszNGK3bq9yRN6g@mail.gmail.com  
Backpatch: 16-, where the new relation extension code was added  

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

pgtest: fix spacing

commit   : 94f9c087421ccda6a615df2dda6c40fb99570fa9    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 14 Aug 2023 14:03:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 14 Aug 2023 14:03:29 -0400    

Click here for diff

Backpatch-through: master  

M src/tools/pgtest

pgtest: update shell script to use more modern syntax

commit   : 50d1a6444ea789786ed673c9cd387548fc63cacb    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 14 Aug 2023 13:45:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 14 Aug 2023 13:45:29 -0400    

Click here for diff

script is src/tools/pgtest  
  
Backpatch-through: master  

M src/tools/pgtest

Change custom wait events to use dynamic shared hash tables

commit   : af720b4c50a122647182f4a030bb0ea8f750fe2f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Aug 2023 14:47:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Aug 2023 14:47:27 +0900    

Click here for diff

Currently, the names of the custom wait event must be registered for  
each backend, requiring all these to link to the shared memory area of  
an extension, even if these are not loaded with  
shared_preload_libraries.  
  
This patch relaxes the constraints related to this infrastructure by  
storing the wait events and their names in two dynamic hash tables in  
shared memory.  This has the advantage to simplify the registration of  
custom wait events to a single routine call that returns an event ID  
ready for consumption:  
uint32 WaitEventExtensionNew(const char *wait_event_name);  
  
The caller of this routine can then cache locally the ID returned, to be  
used for pgstat_report_wait_start(), WaitLatch() or a similar routine.  
  
The implementation uses two hash tables: one with a key based on the  
event name to avoid duplicates and a second using the event ID as key  
for event lookups, like on pg_stat_activity.  These tables can hold a  
minimum of 16 entries, and a maximum of 128 entries, which should be plenty  
enough.  
  
The code changes done in worker_spi show how things are simplified (most  
of the code removed in this commit comes from there):  
- worker_spi_init() is gone.  
- No more shared memory hooks required (size requested and  
initialization).  
- The custom wait event ID is cached in the process that needs to set  
it, with one single call to WaitEventExtensionNew() to retrieve it.  
  
Per suggestion from Andres Freund.  
  
Author: Masahiro Ikeda, with a few tweaks from me.  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/utils/wait_event.h
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi–1.0.sql
M src/test/modules/worker_spi/worker_spi.c
M src/tools/pgindent/typedefs.list

Simplify determining logical replication worker types.

commit   : 2a8b40e3681921943a2989fd4ec6cdbf8766566c    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 14 Aug 2023 08:38:03 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 14 Aug 2023 08:38:03 +0530    

Click here for diff

We deduce a LogicalRepWorker's type from the values of several different  
fields ('relid' and 'leader_pid') whenever logic needs to know it.  
  
In fact, the logical replication worker type is already known at the time  
of launching the LogicalRepWorker and it never changes for the lifetime of  
that process. Instead of deducing the type, it is simpler to just store it  
one time, and access it directly thereafter.  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila, Bharath Rupireddy  
Discussion: http://postgr.es/m/CAHut+PttPSuP0yoZ=9zLDXKqTJ=d0bhxwKaEaNcaym1XqcvDEg@mail.gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/include/replication/worker_internal.h
M src/tools/pgindent/typedefs.list

ci: macos: Remove use of -Dsegsize_blocks=6

commit   : 3d8d217450a63638825167c17ed791122f376176    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Aug 2023 13:09:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Aug 2023 13:09:45 -0700    

Click here for diff

The option causes a measurable slowdown. Macos is, by far, the most expensive  
platform for CI, therefore it doesn't make sense to run such a test there.  
  
d3b111e3205 used a small segment size for two tasks, one with autoconf, one  
with meson. In hindsight that is a bit overkill, it's unlikely that the option  
would silently break. Thus don't move the -Dsegsize_blocks=6, just remove  
it. I did however change the autoconf test to use 6 instead of 8 blocks, as  
long as we allow it, a non-power-of-two test seems like a good idea.  
  
While at it, add a comment explaining why we use a small segment size for CI.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where d3b111e3205 introduced the use of -Dsegsize_blocks=6  

M .cirrus.yml

ci: macos: Remove use of -DRANDOMIZE_ALLOCATED_MEMORY

commit   : 17ebbdf7de192c340762cb852ce615aefa191c95    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Aug 2023 13:06:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Aug 2023 13:06:04 -0700    

Click here for diff

RANDOMIZE_ALLOCATED_MEMORY causes a measurable slowdown. Macos is, by far, the  
most expensive platform for CI, therefore it doesn't make sense to run such a  
test there.  
  
Ubsan and asan on linux should detect most of the the cases of uninitialized  
memory, so it doesn't really seem worth using -DRANDOMIZE_ALLOCATED_MEMORY in  
another instance type.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where 89d16b635 added the use of -DRANDOMIZE_ALLOCATED_MEMORY  

M .cirrus.yml

Fix off-by-one in XLogRecordMaxSize check.

commit   : c36b636096a1aac4fd5d7c8c5d11ed2bb6349d0f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 12 Aug 2023 14:37:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 12 Aug 2023 14:37:05 -0700    

Click here for diff

pg_logical_emit_message(false, '_', repeat('x', 1069547465)) failed with  
self-contradictory message "WAL record would be 1069547520 bytes (of  
maximum 1069547520 bytes)".  There's no particular benefit from allowing  
or denying one byte in either direction; XLogRecordMaxSize could rise a  
few megabytes without trouble.  Hence, this is just for cleanliness.  
Back-patch to v16, where this check first appeared.  

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

Show GIDs of two-phase commit commands as constants in pg_stat_statements

commit   : 638d42a3c52081cf4882520f0622161bad69b40f    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 12 Aug 2023 10:44:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 12 Aug 2023 10:44:15 +0900    

Click here for diff

This relies on the "location" field added to TransactionStmt in 31de7e6,  
now applied to the "gid" field used by 2PC commands.  These commands are  
now reported like:  
COMMIT PREPARED $1  
PREPARE TRANSACTION $1  
ROLLBACK PREPARED $1  
  
Applying constants for these commands is a huge advantage for workloads  
that rely a lot on 2PC commands with different GIDs.  Some tests are  
added to track the new behavior.  
  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/pg_stat_statements.conf
M contrib/pg_stat_statements/sql/utility.sql
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

Fix code indentation violations introduced by recent commit

commit   : 5dc456b7dda4f7d0d7735b066607c190c74d174a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 11 Aug 2023 20:43:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 11 Aug 2023 20:43:34 +0900    

Click here for diff

The two culprit commits are 5765cfe and 5e0c761.  
  
Per buildfarm member koel for the first commit, while I have noticed the  
second one in passing.  

M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/bin/pgbench/pgbench.c

Transform proconfig for faster execution.

commit   : 5765cfe18c595b5d8a7df3a62d253f60a00718ce    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 10 Aug 2023 12:43:53 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 10 Aug 2023 12:43:53 -0700    

Click here for diff

Store function config settings in lists to avoid the need to parse and  
allocate for each function execution.  
  
Speedup is modest but significant. Additionally, this change also  
seems cleaner and supports some other performance improvements under  
discussion.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Nathan Bossart  

M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Remove test from commit fa2e874946.

commit   : bee263b0878cacec5e3d888ab666000edc3219de    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 10 Aug 2023 10:16:59 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 10 Aug 2023 10:16:59 -0700    

Click here for diff

The fix itself is fine, but the test revealed other problems related  
to parallel query that are not easily fixable. Remove the test for  
now to fix the buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

D src/test/isolation/expected/search-path-inval.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/search-path-inval.spec

Fix erroneous -Werror=missing-braces on old GCC

commit   : 5e0c761d0a13c7b4f7c5de618ac38560d74d74d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2023 16:55:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2023 16:55:07 +0200    

Click here for diff

The buildfarm reports that this is an error on gcc (Debian 4.7.2-5)  
4.7.2, 32-bit. The bug seems to be GCC bug 53119, which has obviously  
been fixed for years.  
  
Author: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CT6HJ3U8068R.3A8SJMV02D9BC@gonk  

M src/bin/pgbench/pgbench.c

Update Solution.pm for new LoongArch CRC symbol

commit   : f25b18500a8405e6b800fb81b1dea2b875867143    
  
author   : John Naylor <[email protected]>    
date     : Thu, 10 Aug 2023 18:37:46 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 10 Aug 2023 18:37:46 +0700    

Click here for diff

Oversight in 4d14ccd6a, per report from Amit Kapila  
and Michael Paquier.  
  
Discussion: https://postgr.es/m/CAA4eK1LsV3KuyUt8tzZDjPcUds1XfVVeW3Wpeju_59DtRV0%3DxQ%40mail.gmail.com  

M src/tools/msvc/Solution.pm

Document RelationGetIndexAttrBitmap better

commit   : b57cfb439bd377cfe6d01b4254dde00ae54412ac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 10 Aug 2023 12:04:07 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 10 Aug 2023 12:04:07 +0200    

Click here for diff

Commit 19d8e2308bc5 changed the list of set-of-columns that can be  
returned by RelationGetIndexAttrBitmap, but didn't update its  
"documentation".  That was pretty hard to read already, so rewrite to  
make it more comprehensible, adding the missing values while at it.  
  
Backpatch to 16, like that commit.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tomas Vondra <[email protected]>  

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

Use native CRC instructions on 64-bit LoongArch

commit   : 4d14ccd6af6e788a7b79ff3ed77bda5bc71d2edc    
  
author   : John Naylor <[email protected]>    
date     : Thu, 10 Aug 2023 11:36:15 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 10 Aug 2023 11:36:15 +0700    

Click here for diff

As with the Intel and Arm CRC instructions, compiler intrinsics for  
them must be supported by the compiler. In contrast, no runtime check  
is needed. Aligned memory access is faster, so use the Arm coding as  
a model.  
  
YANG Xudong  
  
Discussion: https://postgr.es/m/b522a0c5-e3b2-99cc-6387-58134fb88cbe%40ymatrix.cn  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/include/port/pg_crc32c.h
M src/port/meson.build
A src/port/pg_crc32c_loongarch.c

Recalculate search_path after ALTER ROLE.

commit   : fa2e874946c5b9f23394358c131e987df7cc8ffb    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 7 Aug 2023 15:13:24 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 7 Aug 2023 15:13:24 -0700    

Click here for diff

Renaming a role can affect the meaning of the special string $user, so  
must cause search_path to be recalculated.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Nathan Bossart, Michael Paquier  
Backpatch-through: 11  

M src/backend/catalog/namespace.c
A src/test/isolation/expected/search-path-inval.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/search-path-inval.spec

struct PQcommMethods: use C99 designated initializers

commit   : c27f8621eedf744a7bc80e37dd2d3f0f559edf1b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 Aug 2023 11:30:59 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 Aug 2023 11:30:59 +0200    

Click here for diff

As in 98afa68d9352, 2c860777656a, et al.  

M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c

Fix last remaining uninitialized memory warnings

commit   : 4a8fef0d733965c1a1836022f8a42ab1e83a721f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2023 10:00:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Aug 2023 10:00:50 +0200    

Click here for diff

gcc (version 13) fails to properly analyze the code due to the loop  
stop condition including `l != NULL`. Let's just help it out.  
  
Author: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CT6HJ3U8068R.3A8SJMV02D9BC@gonk  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

Fix pg_dumpall with in-place tablespaces

commit   : a72d613b4c91462d9405c4e1b05c42d33013c333    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Aug 2023 08:56:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Aug 2023 08:56:05 +0900    

Click here for diff

In-place tablespaces would be dumped with the path produced by  
pg_tablespace_location(), which is in this case a relative path built as  
pg_tblspc/OID, but this would fail to restore as such tablespaces need  
to use an empty string as location.  In order to detect if an in-place  
tablespace is used, this commit checks if the path returned is relative  
and adapts the dump contents in consequence.  
  
Like the other changes related to in-place tablespaces, no backpatch is  
done as these are only intended for development purposes.  Rui Zhao has  
fixed the code, while the test is from me.  
  
Author: Rui Zhao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix incorrect entries generated from wait_event_names.txt

commit   : f05b1fa1ff5b2133d636a427d00fe85eedad49b3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Aug 2023 08:17:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Aug 2023 08:17:53 +0900    

Click here for diff

fa88928 has introduced wait_event_names.txt, and some of its entries had  
some documentation fields with more information than necessary.  
  
This commit brings back the description of all the wait events to be  
consistent with the older stable branches.  Five descriptions were  
incorrect.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/wait_event_names.txt

Reject substituting extension schemas or owners matching ["$'\].

commit   : cd5f2a357014d5ed8205191f8e1fb180f1439599    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2023 06:05:56 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Aug 2023 06:05:56 -0700    

Click here for diff

Substituting such values in extension scripts facilitated SQL injection  
when @extowner@, @extschema@, or @extschema:...@ appeared inside a  
quoting construct (dollar quoting, '', or "").  No bundled extension was  
vulnerable.  Vulnerable uses do appear in a documentation example and in  
non-bundled extensions.  Hence, the attack prerequisite was an  
administrator having installed files of a vulnerable, trusted,  
non-bundled extension.  Subject to that prerequisite, this enabled an  
attacker having database-level CREATE privilege to execute arbitrary  
code as the bootstrap superuser.  By blocking this attack in the core  
server, there's no need to modify individual extensions.  Back-patch to  
v11 (all supported versions).  
  
Reported by Micah Gate, Valerie Woolard, Tim Carey-Smith, and Christoph  
Berg.  
  
Security: CVE-2023-39417  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_extschema–1.0.sql
A src/test/modules/test_extensions/test_ext_extschema.control

Translation updates

commit   : 2bdd7b262f7af28dec11684bd8998f7dc2acc793    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 12:06:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 12:06:49 +0200    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/fr.po
M src/backend/po/ja.po
M src/backend/po/sv.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/initdb/po/sv.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ka.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/ka.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/ka.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/sv.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ka.po
M src/bin/psql/po/sv.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/ka.po
M src/bin/scripts/po/sv.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ka.po
M src/interfaces/libpq/po/sv.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/ka.po
M src/pl/plpython/po/sv.po

Don't Memoize lateral joins with volatile join conditions

commit   : 990c3650c535f6fc84d53abb0bd03ad0dd16c576    
  
author   : David Rowley <[email protected]>    
date     : Mon, 7 Aug 2023 22:14:21 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 7 Aug 2023 22:14:21 +1200    

Click here for diff

The use of Memoize was already disabled in normal joins when the join  
conditions had volatile functions per the code in  
match_opclause_to_indexcol().  Ordinarily, the parameterization for the  
inner side of a nested loop will be an Index Scan or at least eventually  
lead to an index scan (perhaps nested several joins deep). However, for  
lateral joins, that's not the case and seq scans can be parameterized  
too, so we can't rely on match_opclause_to_indexcol().  
  
Here we explicitly check the parameterization for volatile functions and  
don't consider the generation of a Memoize path when such functions  
are present.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49nHFnHbpepLsv_yF3qkpCS4BdB-v8HoJVv8_=Oat0u_w@mail.gmail.com  
Backpatch-through: 14, where Memoize was introduced  

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

Fix RLS policy usage in MERGE.

commit   : c2e08b04c9e71ac6aabdc7d9b3f8e785e164d770    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 7 Aug 2023 09:28:47 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 7 Aug 2023 09:28:47 +0100    

Click here for diff

If MERGE executes an UPDATE action on a table with row-level security,  
the code incorrectly applied the WITH CHECK clauses from the target  
table's INSERT policies to new rows, instead of the clauses from the  
table's UPDATE policies. In addition, it failed to check new rows  
against the target table's SELECT policies, if SELECT permissions were  
required (likely to always be the case).  
  
In addition, if MERGE executes a DO NOTHING action for matched rows,  
the code incorrectly applied the USING clauses from the target table's  
DELETE policies to existing target tuples. These policies were applied  
as checks that would throw an error, if they did not pass.  
  
Fix this, so that a MERGE UPDATE action applies the same RLS policies  
as a plain UPDATE query with a WHERE clause, and a DO NOTHING action  
does not apply any RLS checks (other than adding clauses from SELECT  
policies to the join).  
  
Back-patch to v15, where MERGE was introduced.  
  
Dean Rasheed, reviewed by Stephen Frost.  
  
Security: CVE-2023-39418  

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

Remove configure check for z_streamp

commit   : eeb4eeea2c525c51767ffeafda0070b946f26ae8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 09:06:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 09:06:52 +0200    

Click here for diff

This is surely obsolete.  zlib version 1.0.4, which includes  
z_streamp, was released 1996-07-24.  When this check was put in in  
2001 (19c97b8579), the commit was already labeling that release as  
ancient.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/33462926-bb1e-7cc9-8d92-d86318e8ed1d%40eisentraut.org  

M configure
M configure.ac
M meson.build

Improve const use in zlib-using code

commit   : 67c0ef9752ade6dc252a19be8d2259847d4eb78d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 09:06:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Aug 2023 09:06:52 +0200    

Click here for diff

If we define ZLIB_CONST before including zlib.h, zlib augments some  
interfaces with const decorations.  By doing that we can keep our own  
interfaces cleaner and can remove some unconstify calls.  
  
ZLIB_CONST was introduced in zlib 1.2.5.2 (17 Dec 2011).  When  
compiling with older zlib releases, you might now get compiler  
warnings about discarding qualifiers.  
  
CentOS 6 has zlib 1.2.3, but in 8e278b6576, we removed support for the  
OpenSSL release in CentOS 6, so it seems ok to de-support the zlib  
release in CentOS 6 as well.  
  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/33462926-bb1e-7cc9-8d92-d86318e8ed1d%40eisentraut.org  

M contrib/pgcrypto/pgp-compress.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/walmethods.c
M src/include/c.h

Fix misleading comment in paraminfo_get_equal_hashops

commit   : fdd79d8992d600d38eecfab568b27f6d04e4dfb3    
  
author   : David Rowley <[email protected]>    
date     : Mon, 7 Aug 2023 18:16:46 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 7 Aug 2023 18:16:46 +1200    

Click here for diff

The comment mistakenly claimed the code was checking PlaceHolderVars for  
volatile functions when the code was actually checking lateral vars.  
  
Update the comment to reflect the reality of the code.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs48HZGZOV85g0fx8z1qDx6NNKHexJPT2FCnKnZhxBWkd-A@mail.gmail.com  

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

Tidy up join_search_one_level code

commit   : 6c00d2c9d4c533dad4e0afe28cfde0e12e4eb4e0    
  
author   : David Rowley <[email protected]>    
date     : Sun, 6 Aug 2023 21:51:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 6 Aug 2023 21:51:54 +1200    

Click here for diff

The code in join_search_one_level was a bit convoluted.  With a casual  
glance, you might think that other_rels_list was being set to something  
other than joinrels[1] when level == 2, however, joinrels[level - 1] is  
joinrels[1] when level == 2, so nothing special needs to happen to set  
other_rels_list.  Let's clean that up to avoid confusing anyone.  
  
In passing, we may as well modernize the loop in  
make_rels_by_clause_joins() and instead of passing in the ListCell to  
start looping from, let's just pass in the index where to start from and  
make use of for_each_from().  Ever since 1cff1b95a, Lists are arrays  
under the hood. lnext() and list_head() both seem a little too linked-list  
like.  
  
Author: Alex Hsieh, David Rowley, Richard Guo  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CANWNU8x9P9aCXGF%3DaT-A_8mLTAT0LkcZ_ySYrGbcuHzMQw2-1g%40mail.gmail.com  

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

Simplify some of the logical replication worker-type checks.

commit   : 81ccbe520f42a9873734c614e4eb521190d8f8e4    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 4 Aug 2023 08:15:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 4 Aug 2023 08:15:07 +0530    

Click here for diff

Author: Peter Smith  
Reviewed-by: Hou Zhijie  
Discussion: http://postgr.es/m/CAHut+Pv-xkEpuPzbEJ=ZSi7Hp2RoGJf=VA-uDRxLi1KHSneFjg@mail.gmail.com  

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

Attempt to stabilize new window agg regression test

commit   : 7516056c584e3f7e04269f2e80835d1433e869c4    
  
author   : David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 13:27:19 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 13:27:19 +1200    

Click here for diff

This test was recently added in 3900a02c9.  It appears to be unstable in  
regards to the join order presumably due to the relations at either side  
of the join being equal in side.  Here we add a qual to make one of them  
smaller so the planner is more likely to choose to hash the smaller of the  
two.  
  
Reported-by: Nathan Bossart, Tom Lane  
Discussion: https://www.postgr.es/m/20230803235403.GC1238296@nathanxps13  

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

Minor adjustments to WindowAgg startup cost code

commit   : 3fd19a9b23c2906da52f3f3732dbc533477f284d    
  
author   : David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 10:47:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 10:47:54 +1200    

Click here for diff

This is a follow-on of 3900a02c9 containing some changes which I forgot  
to commit locally before forming a patch with git format-patch.  
  
Discussion: https://postgr.es/m/CAApHDvrB0S5BMv+0-wTTqWFE-BJ0noWqTnDu9QQfjZ2VSpLv_g@mail.gmail.com  

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

Account for startup rows when costing WindowAggs

commit   : 3900a02c97c7cc0e211578dc733cff0f4a2b2213    
  
author   : David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 09:27:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 4 Aug 2023 09:27:38 +1200    

Click here for diff

Here we adjust the costs for WindowAggs so that they properly take into  
account how much of their subnode they must read before outputting the  
first row.  Without this, we always assumed that the startup cost for the  
WindowAgg was not much more expensive than the startup cost of its  
subnode, however, that's going to be completely wrong in many cases.  The  
WindowAgg may have to read *all* of its subnode to output a single row  
with certain window bound options.  
  
Here we estimate how many rows we'll need to read from the WindowAgg's  
subnode and proportionally add more of the subnode's run costs onto the  
WindowAgg's startup costs according to how much of it we expect to have to  
read in order to produce the first WindowAgg row.  
  
The reason this is more important than we might have initially thought is  
that we may end up making use of a path from the lower planner that works  
well as a cheap startup plan when the query has a LIMIT clause, however,  
the WindowAgg might mean we need to read far more rows than what the LIMIT  
specifies.  
  
No backpatch on this so as not to cause plan changes in released  
versions.  
  
Bug: #17862  
Reported-by: Tim Palmer  
Author: David Rowley  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAApHDvrB0S5BMv+0-wTTqWFE-BJ0noWqTnDu9QQfjZ2VSpLv_g@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/cost.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Doc: update documentation for creating custom scan paths.

commit   : 74a2dfee2255a1bace9b0053d014c4efa2823f4d    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 3 Aug 2023 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 3 Aug 2023 17:45:00 +0900    

Click here for diff

Commit f49842d1e added a new callback for custom scan paths, but missed  
updating the documentation.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAPmGK15ODkN%2B%3DhkBCufj1HBW0x5OTb65Xuy7ryXchMdiCMpx_g%40mail.gmail.com  

M doc/src/sgml/custom-scan.sgml

Update comments on CustomPath struct.

commit   : 20f90a0e4d86d69808fd73e1e7c701a357846ec1    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 3 Aug 2023 17:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 3 Aug 2023 17:15:00 +0900    

Click here for diff

Commit e7cb7ee14 allowed custom scan providers to create CustomPath  
paths for join relations as well, but missed updating the comments.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAPmGK15ODkN%2B%3DhkBCufj1HBW0x5OTb65Xuy7ryXchMdiCMpx_g%40mail.gmail.com  

M src/include/nodes/pathnodes.h

Refactor to split Apply and Tablesync Workers code.

commit   : 02c1b64fb15ca018f0c159a0152497c8d6704d40    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 3 Aug 2023 08:59:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 3 Aug 2023 08:59:50 +0530    

Click here for diff

Both apply and tablesync workers were using ApplyWorkerMain() as entry  
point. As the name implies, ApplyWorkerMain() should be considered as  
the main function for apply workers. Tablesync worker's path was hidden  
and does not have enough in common to share the same main function with  
apply worker.  
  
Also, most of the code shared by both worker types is already combined  
in LogicalRepApplyLoop(). There is no need to combine the rest in  
ApplyWorkerMain() anymore.  
  
This patch introduces TablesyncWorkerMain() as a new entry point for  
tablesync workers. This aims to increase code readability and would help  
with future improvements like the reuse of tablesync workers in the  
initial synchronization.  
  
Author: Melih Mutlu based on suggestions by Melanie Plageman  
Reviewed-by: Peter Smith, Kuroda Hayato, Amit Kapila  
Discussion: http://postgr.es/m/CAGPVpCTq=rUDd4JUdaRc1XUWf4BrH2gdSNf3rtOMUGj9rPpfzQ@mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalworker.h
M src/include/replication/worker_internal.h

Fix ReorderBufferCheckMemoryLimit() comment.

commit   : 0125c4e21d7e9c8b3da95ffcd3e34c0f61c9b69a    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 2 Aug 2023 15:01:13 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 2 Aug 2023 15:01:13 +0900    

Click here for diff

Commit 7259736a6 updated the comment but it was not correct since  
ReorderBufferLargestStreamableTopTXN() returns only top-level  
transactions.  
  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoA9XB7OR86BqvrCe2dMYX%2BZv3-BvVmjF%3DGY2z6jN-kqjg%40mail.gmail.com  
Backpatch-through: 14  

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

Fix performance regression in pg_strtointNN_safe functions

commit   : 3845577cb55eab3e06b3724e307ebbcac31f4841    
  
author   : David Rowley <[email protected]>    
date     : Wed, 2 Aug 2023 12:05:41 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 2 Aug 2023 12:05:41 +1200    

Click here for diff

Between 6fcda9aba and 1b6f632a3, the pg_strtoint functions became quite  
a bit slower in v16, despite efforts in 6b423ec67 to speed these up.  
  
Since the majority of cases for these functions will only contain  
base-10 digits, perhaps prefixed by a '-', it makes sense to have a  
special case for this and just fall back on the more complex version  
which processes hex, octal, binary and underscores if the fast path  
version fails to parse the string.  
  
While we're here, update the header comments for these functions to  
mention that hex, octal and binary formats along with underscore  
separators are now supported.  
  
Author: Andres Freund, David Rowley  
Reported-by: Masahiko Sawada  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com  
Backpatch-through: 16, where 6fcda9aba and 1b6f632a3 were added  

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

Fix pg_stat_io buffer reuse test instability

commit   : 36ab831f9abc6f6b0ab74dd62e0faad75dbf42bf    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 1 Aug 2023 11:22:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 1 Aug 2023 11:22:03 -0700    

Click here for diff

The stats regression test attempts to ensure that Buffer Access Strategy  
"reuses" are being counted in pg_stat_io by vacuuming a table which is larger  
than the size of the strategy ring. However, when shared buffers are in  
sufficiently high demand, another backend could evict one of the blocks in the  
strategy ring before the first backend has a chance to reuse the buffer. The  
backend using the strategy would then evict another shared buffer and add that  
buffer to the strategy ring. This counts as an eviction and not a reuse in  
pg_stat_io. Count both evictions and reuses in the test to ensure it does not  
fail incorrectly.  
  
Reported-by: Jeff Davis <[email protected]>,  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_bNG27AxG9TdPtwsL6wg8AWbVckjmTL2t1HF=miDQuNtw@mail.gmail.com  

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

Add and use symbolic constants for tar header offsets and file types.

commit   : 6050b6a92d1e6b5a234e96382ea711683e67d280    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Aug 2023 13:50:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Aug 2023 13:50:42 -0400    

Click here for diff

Because symbolic constants in a header file are better than magic  
constants embedded in the code.  
  
Patch by me, reviewed by Tom Lane, Dagfinn Ilmari Mannsåker, and  
Tristan Partin.  
  
Discussion: http://postgr.es/m/CA+TgmoZNbLwhmCrNtkJAvi8FLkwFdMeVU3myV2HQQpA5bvbRZg@mail.gmail.com  

M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_dump/pg_backup_tar.c
M src/include/pgtar.h
M src/port/tar.c

Fix overly strict Assert in jsonpath code

commit   : deae1657ee6dd6f7b3effab3d44429d5434f5bbf    
  
author   : David Rowley <[email protected]>    
date     : Wed, 2 Aug 2023 01:39:47 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 2 Aug 2023 01:39:47 +1200    

Click here for diff

This was failing for queries which try to get the .type() of a  
jpiLikeRegex.  For example:  
  
select jsonb_path_query('["string", "string"]',  
                        '($[0] like_regex ".{7}").type()');  
  
Reported-by: Alexander Kozhemyakin  
Bug: #18035  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12, where SQL/JSON path was added.  

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

Rename OverrideSearchPath to SearchPathMatcher.

commit   : d3a38318ac614f20a9e2e163bba083d15be54f06    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 31 Jul 2023 17:04:47 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 31 Jul 2023 17:04:47 -0700    

Click here for diff

The previous commit removed the "override" APIs.  Surviving APIs facilitate  
plancache.c to snapshot search_path and test whether the current value equals  
a remembered snapshot.  
  
Aleksander Alekseev.  Reported by Alexander Lakhin and Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/backend/utils/cache/plancache.c
M src/include/catalog/namespace.h
M src/include/utils/plancache.h
M src/tools/pgindent/typedefs.list

Remove PushOverrideSearchPath() and PopOverrideSearchPath().

commit   : 7c5c4e1c0396b0617a6f9b659dd7375fb0bfb9dc    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 31 Jul 2023 17:04:47 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 31 Jul 2023 17:04:47 -0700    

Click here for diff

Since commit 681d9e4621aac0a9c71364b6f54f00f6d8c4337f, they have no in-tree  
calls.  Any new calls would introduce security vulnerabilities like the one  
fixed in that commit.  
  
Alexander Lakhin, reviewed by Aleksander Alekseev.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/backend/commands/extension.c
M src/include/catalog/namespace.h
M src/tools/pgindent/typedefs.list

Support custom wait events for wait event type "Extension"

commit   : c9af054653077699189884c336a65e23a7c8aebb    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 17:09:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 17:09:24 +0900    

Click here for diff

Two backend routines are added to allow extension to allocate and define  
custom wait events, all of these being allocated in the type  
"Extension":  
* WaitEventExtensionNew(), that allocates a wait event ID computed from  
a counter in shared memory.  
* WaitEventExtensionRegisterName(), to associate a custom string to the  
wait event ID allocated.  
  
Note that this includes an example of how to use this new facility in  
worker_spi with tests in TAP for various scenarios, and some  
documentation about how to use them.  
  
Any code in the tree that currently uses WAIT_EVENT_EXTENSION could  
switch to this new facility to define custom wait events.  This is left  
as work for future patches.  
  
Author: Masahiro Ikeda  
Reviewed-by: Andres Freund, Michael Paquier, Tristan Partin, Bharath  
Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/ipci.c
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/utils/wait_event.h
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi–1.0.sql
M src/test/modules/worker_spi/worker_spi.c
M src/tools/pgindent/typedefs.list

Bring some MSVC asserts in line with other platforms

commit   : 39055cb4ccd5b521ceb802b6a8194de912a422cc    
  
author   : John Naylor <[email protected]>    
date     : Mon, 31 Jul 2023 13:34:29 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 31 Jul 2023 13:34:29 +0700    

Click here for diff

MSVC's _BitScan* functions return a boolean indicating whether any  
bits were set in the input, and we were previously asserting that  
they returned true, per our API. This is correct. However, other  
platforms simply assert that the input is non-zero, so do that to be  
more consistent.  
  
Noted while investigating a hypothesis from Ranier Vilela about  
undefined behavior, but this is not his proposed patch.  
  
Discussion: https://www.postgresql.org/message-id/CAEudQAoDhUZyKGJ1vbMGcgVUOcsixe-%3DjcVaDWarqkUg163D2w%40mail.gmail.com  

M src/include/port/pg_bitutils.h

Add WAIT_EVENT_{CLASS,ID}_MASK in wait_event.c

commit   : 7395a90db87bcb2f617d3c486657813122d3f151    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 16:14:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 16:14:47 +0900    

Click here for diff

These are useful to extract the class ID and the event ID associated to  
a single uint32 wait_event_info.  Only two code paths use them now, but  
an upcoming patch will extend their use.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid memory leak in rmtree() when path cannot be opened

commit   : f1e9f6bbfa536992eac6c094882b3afcd9e90fb4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 11:36:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Jul 2023 11:36:44 +0900    

Click here for diff

An allocation done for the directory names to recurse into for their  
deletion was done before OPENDIR(), so, assuming that a failure happens,  
this could leak a bit of memory.  
  
Author: Ranier Vilela  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAEudQAoN3-2ZKBALThnEk_q2hu8En5A0WG9O+5siJTQKVZzoWQ@mail.gmail.com  

M src/common/rmtree.c

Fix pg_rewind with in-place tablespaces when source is remote

commit   : bf227926d22b5cffba4b6724df0eb239a7037cbd    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 30 Jul 2023 15:26:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 30 Jul 2023 15:26:25 +0900    

Click here for diff

libpq_source.c would consider any result returned by  
pg_tablespace_location() as a symlink, resulting in run-time errors like  
that:  
pg_rewind: error: file "pg_tblspc/NN" is of different type in source and target  
  
In-place tablespaces are directories located in pg_tblspc/, returned as  
relative paths instead of absolute paths, so rely on that to make the  
difference with a normal tablespace and an in-place one.  If the path is  
relative, the tablespace is handled as a directory.  If the path is  
absolute, consider it as a symlink.  
  
In-place tablespaces are only intended for development purposes, so like  
363e8f9 no backpatch is done.  A test is added in pg_rewind with an  
in-place tablespace and some data in it.  
  
Author: Rui Zhao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/RewindTest.pm

worker_spi: Fix race condition in newly-added TAP tests

commit   : b68e356a680ee1155b0dc612a89655e98320121a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 29 Jul 2023 11:34:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 29 Jul 2023 11:34:53 +0900    

Click here for diff

The second portion of the tests had a race condition where it would be  
possible for the startup of the dynamic workers to fail, in the event  
where the static workers started before them with the library loading in  
shared_preload_libraries did not finish to create their respective  
schemas.  The conflict is caused by the fact that the dynamic and static  
workers used the same IDs, overlapping each other, so, for now, switch  
the dynamic workers to use different IDs, leading to different schemas  
created.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/t/001_worker_spi.pl

Harmonize password reuse in vacuumdb, clusterdb, and reindexdb.

commit   : 6d982e3b3bd4a3a26d18639b05ca1535c260e669    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 28 Jul 2023 10:07:44 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 28 Jul 2023 10:07:44 -0700    

Click here for diff

Commits 83dec5a712 and ff402ae11b taught vacuumdb to reuse  
passwords instead of prompting repeatedly.  However, the docs still  
warn about repeated prompts, and this improvement was not applied  
to clusterdb and reindexdb.  This commit allows clusterdb and  
reindexdb to reuse passwords just like vacuumdb does, and it  
expunges the aforementioned warnings from the docs.  
  
Reviewed-by: Gurjeet Singh, Zhang Mingli  
Discussion: https://postgr.es/m/20230628045741.GA1813397%40nathanxps13  

M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/fe_utils/connect_utils.c

doc: add missing <returnvalue> and whitespace

commit   : e055b6be7ebb0de35570102327717c99d91fe540    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jul 2023 16:05:44 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jul 2023 16:05:44 +0900    

Click here for diff

Missed in commit 03734a7fed.  
  
Author: Shinoda, Noriyoshi <[email protected]>  
Discussion: https://postgr.es/m/DM4PR84MB1734E58BB4DC0E1B6E2990EBEE01A%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/func.sgml

Disallow replacing joins with scans in problematic cases.

commit   : 6f80a8d9c1373f24ad308b1dee63f8d8c1787026    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 28 Jul 2023 15:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 28 Jul 2023 15:45:00 +0900    

Click here for diff

Commit e7cb7ee14, which introduced the infrastructure for FDWs and  
custom scan providers to replace joins with scans, failed to add support  
handling of pseudoconstant quals assigned to replaced joins in  
createplan.c, leading to an incorrect plan without a gating Result node  
when postgres_fdw replaced a join with such a qual.  
  
To fix, we could add the support by 1) modifying the ForeignPath and  
CustomPath structs to store the list of RestrictInfo nodes to apply to  
the join, as in JoinPaths, if they represent foreign and custom scans  
replacing a join with a scan, and by 2) modifying create_scan_plan() in  
createplan.c to use that list in that case, instead of the  
baserestrictinfo list, to get pseudoconstant quals assigned to the join;  
but #1 would cause an ABI break.  So fix by modifying the infrastructure  
to just disallow replacing joins with such quals.  
  
Back-patch to all supported branches.  
  
Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and  
Richard Guo.  
  
Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/optimizer/restrictinfo.h

Eliminate fixed token-length limit in hba.c.

commit   : 38df84c65ea4aa9110cbc797d07225fb0fac44f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2023 11:56:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jul 2023 11:56:35 -0400    

Click here for diff

Historically, hba.c limited tokens in the authentication configuration  
files (pg_hba.conf and pg_ident.conf) to less than 256 bytes.  We have  
seen a few reports of this limit causing problems; notably, for  
moderately-complex LDAP configurations.  Let's get rid of the fixed  
limit by using a StringInfo instead of a fixed-size buffer.  
This actually takes less code than before, since we can get rid of  
a nontrivial error recovery stanza.  It's doubtless a hair slower,  
but parsing the content of the HBA files should in no way be  
performance-critical.  
  
Although this is a pretty straightforward patch, it doesn't seem  
worth the risk to back-patch given the small number of complaints  
to date.  In released branches, we'll just raise MAX_TOKEN to  
ameliorate the problem.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c

worker_spi: Switch to TAP tests

commit   : 320c311fda912226bcb2e82b507b498161581dd2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 13:30:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 13:30:07 +0900    

Click here for diff

This commit moves worker_spi to use TAP tests.  sql/worker_spi.sql is  
gone, replaced by an equivalent set of queries in a TAP script, without  
worker_spi loaded in shared_preload_libraries:  
- One query to launch a worker dynamically, relying now on "postgres" as  
the default database to connect to.  
- Two wait queries with poll_query_until(), one to wait for the worker  
schema to be initialized and a second to wait for a tuple processed by  
the worker.  
- Server reload to accelerate the main loop of the spawned worker.  
  
More coverage is added for workers registered when the library is loaded  
with shared_preload_libraries, while on it, checking that these are  
connecting to the database set in the GUC worker_spi.database.  
  
A local run of these test is showing that TAP is slightly faster than  
the original, while providing more coverage (3.7s vs 4.4s).  There was  
also some discussions about keeping the SQL tests, but this would  
require initializing twice a cluster, increasing the runtime of the  
tests up to 5.6s here.  
  
These tests will be expanded more in an upcoming patch aimed at adding  
support for custom wait events for the Extension class, still under  
discussion, to check the new in-core APIs with and without a library set  
in shared_preload_libraries.  
  
Bharath has written the part where shared_preload_libraries is used,  
while I have migrated the existing SQL tests to TAP.  
  
Author: Bharath Rupireddy, Michael Paquier  
Reviewed-by: Masahiro Ikeda  
Discussion: https://postgr.es/m/CALj2ACWR9ncAiDF73unqdJF1dmsA2R0efGXX2624X+YVxcAVWg@mail.gmail.com  

M src/test/modules/worker_spi/.gitignore
M src/test/modules/worker_spi/Makefile
D src/test/modules/worker_spi/dynamic.conf
D src/test/modules/worker_spi/expected/worker_spi.out
M src/test/modules/worker_spi/meson.build
D src/test/modules/worker_spi/sql/worker_spi.sql
A src/test/modules/worker_spi/t/001_worker_spi.pl

Fix performance problem with new COPY DEFAULT code

commit   : b635ac03e80237838bec8b224eb4dea97985fda3    
  
author   : David Rowley <[email protected]>    
date     : Thu, 27 Jul 2023 14:47:05 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 27 Jul 2023 14:47:05 +1200    

Click here for diff

9f8377f7a added code to allow COPY FROM insert a column's default value  
when the input matches the DEFAULT string specified in the COPY command.  
  
Here we fix some inefficient code which needlessly palloc0'd an array to  
store if we should use the default value or input value for the given  
column.  This array was being palloc0'd and pfree'd once per row.  It's  
much more efficient to allocate this once and just reset the values once  
per row.  
  
Reported-by: Masahiko Sawada  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com  
Backpatch-through: 16, where 9f8377f7a was introduced.  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c

Add sanity asserts for index OID and attnums during cache init

commit   : f6a84546b1a0ae43c00a7f351bc45fbde342466a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 10:55:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 10:55:16 +0900    

Click here for diff

There was already a check on the relation OID, but not its index OID and  
the attributes that can be used during the syscache lookups.  The two  
assertions added by this commit are cheap, and actually useful for  
developers to fasten the detection of incorrect data in a new entry  
added in the syscache list, as these assertions are triggered during the  
initial cache loading (initdb, or just backend startup), not requiring a  
syscache that uses the new entry.  
  
While on it, the relation OID check is switched to use OidIsValid().  
  
Author: Aleksander Alekseev  
Reviewed-by: Dagfinn Ilmari Mannsåker, Zhang Mingli, Michael Paquier  
Discussion: https://postgr.es/m/CAJ7c6TOjUTJ0jxvWY6oJeP2-840OF8ch7qscZQsuVuotXTOS_g@mail.gmail.com  

M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/syscache.c

Show savepoint names as constants in pg_stat_statements

commit   : 31de7e60da34761365f94dc76cc2c1bf2172d1bc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 09:42:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Jul 2023 09:42:33 +0900    

Click here for diff

In pg_stat_statements, savepoint names now show up as constants with a  
parameter symbol, using as base query string the one added as a new  
entry to the PGSS hash table, leading to:  
RELEASE $1  
ROLLBACK TO $1  
SAVEPOINT $1  
  
Applying constants to these query parts is a huge advantage for  
workloads that generate randomly savepoint points, like ORMs (Django is  
at the origin of this patch).  The ODBC driver is a second layer that  
likes a lot savepoints, though it does not use a random naming pattern.  
  
A "location" field is added to TransactionStmt, now set only for  
savepoints.  The savepoint name is ignored by the query jumbling.  The  
location can be extended to other query patterns, if required, like 2PC  
commands.  Some tests are added to pg_stat_statements for all the query  
patterns supported by the parser.  
  
ROLLBACK, ROLLBACK TO SAVEPOINT and ROLLBACK TRANSACTION TO SAVEPOINT  
have the same Node representation, so all these are equivalents.  The  
same happens for RELEASE and RELEASE SAVEPOINT.  
  
Author: Greg Sabino Mullane  
Discussion: https://postgr.es/m/CAKAnmm+2s9PA4OaumwMJReWHk8qvJ_-g1WqxDRDAN1BSUfxyTw@mail.gmail.com  

M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/sql/utility.sql
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

Adjust extra lines generated by psql to be valid SQL comments.

commit   : 19c590f6a795831b34782a4d69fa6a52dc9d03c3    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 26 Jul 2023 17:02:39 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 26 Jul 2023 17:02:39 -0700    

Click here for diff

psql's --echo-hidden, --log-file, and --single-step options  
generate extra lines to clearly separate queries from other output.  
Presently, these extra lines are not valid SQL comments, which  
makes them a hazard for anyone trying to copy/paste the decorated  
queries into a client or query editor.  This commit replaces the  
starting and ending asterisks in these extra lines with forward  
slashes so that they are valid SQL comments that can be copy/pasted  
without incident.  
  
Author: Kirk Wolak  
Reviewed-by: Pavel Stehule, Laurenz Albe, Tom Lane, Alvaro Herrera, Andrey Borodin  
Discussion: https://postgr.es/m/CACLU5mTFJRJYtbvmZ26txGgmXWQo0hkGhH2o3hEquUPmSbGtBw%40mail.gmail.com  

M src/bin/psql/command.c
M src/bin/psql/common.c

Add more SQL/JSON constructor functions

commit   : 03734a7fed7d924679770adb78a7db8a37d14188    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 22:21:43 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 22:21:43 +0900    

Click here for diff

This Patch introduces three SQL standard JSON functions:  
  
JSON()  
JSON_SCALAR()  
JSON_SERIALIZE()  
  
JSON() produces json values from text, bytea, json or jsonb values,  
and has facilitites for handling duplicate keys.  
  
JSON_SCALAR() produces a json value from any scalar sql value,  
including json and jsonb.  
  
JSON_SERIALIZE() produces text or bytea from input which containis  
or represents json or jsonb;  
  
For the most part these functions don't add any significant new  
capabilities, but they will be of use to users wanting standard  
compliant JSON handling.  
  
Catversion bumped as this changes ruleutils.c.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby, Álvaro Herrera,  
Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/jsonfuncs.h
M src/interfaces/ecpg/test/expected/sql-sqljson.c
M src/interfaces/ecpg/test/expected/sql-sqljson.stderr
M src/interfaces/ecpg/test/expected/sql-sqljson.stdout
M src/interfaces/ecpg/test/sql/sqljson.pgc
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Rename a nonterminal used in SQL/JSON grammar

commit   : 254ac5a7c31f7e6d3908c057461db5401d2110b0    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 22:21:43 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 22:21:43 +0900    

Click here for diff

This renames json_output_clause_opt to json_returning_clause_opt,  
because the new name makes more sense given that the governing  
keyword is RETURNING.  
  
Per suggestion from Álvaro Herrera.  
  
Discussion: https://postgr.es/m/20230707122820.wy5zlmhn4tdzbojl%40alvherre.pgsql  

M src/backend/parser/gram.y

Some refactoring to export json(b) conversion functions

commit   : b22391a2ff7bdfeff4438f7a9ab26de3e33fdeff    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 21 Jul 2023 11:46:56 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 21 Jul 2023 11:46:56 +0900    

Click here for diff

This is to export datum_to_json(), datum_to_jsonb(), and  
jsonb_from_cstring(), though the last one is exported as  
jsonb_from_text().  
  
A subsequent commit to add new SQL/JSON constructor functions will  
need them for calling from the executor.  
  
Discussion: https://postgr.es/m/20230720160252.ldk7jy6jqclxfxkq%40alvherre.pgsql  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/include/utils/jsonfuncs.h

Fix crash with RemoveFromWaitQueue() when detecting a deadlock.

commit   : bd88404d3cda53810e0b0144713c4b1a1dd965a8    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 26 Jul 2023 14:41:26 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 26 Jul 2023 14:41:26 +0900    

Click here for diff

Commit 5764f611e used dclist_delete_from() to remove the proc from the  
wait queue. However, since it doesn't clear dist_node's next/prev to  
NULL, it could call RemoveFromWaitQueue() twice: when the process  
detects a deadlock and then when cleaning up locks on aborting the  
transaction. The waiting lock information is cleared in the first  
call, so it led to a crash in the second call.  
  
Backpatch to v16, where the change was introduced.  
  
Bug: #18031  
Reported-by: Justin Pryzby, Alexander Lakhin  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/ZKy4AdrLEfbqrxGJ%40telsasoft.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

worker_spi: Use term "dynamic" for bgworkers launched with worker_spi_launch()

commit   : d9eb92c7b122c4cf40e95ec45e88b27b318a2be9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Jul 2023 12:43:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Jul 2023 12:43:26 +0900    

Click here for diff

This gives a way to make a difference between workers registered when  
the library is loaded with shared_preload_libraries and when these are  
launched dynamically, in ps output or pg_stat_activity.  
  
Extracted from a larger patch by the same author.  
  
Author: Bharath Rupireddy  
Reviewed-by: Masahiro Ikeda  
Discussion: https://postgr.es/m/CALj2ACWR9ncAiDF73unqdJF1dmsA2R0efGXX2624X+YVxcAVWg@mail.gmail.com  

M src/test/modules/worker_spi/worker_spi.c

Document more assumptions of LWLock variable changes with WAL inserts

commit   : 66d86d4201b3a4b05c6d7d1bf827d4b17aa44a06    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Jul 2023 12:06:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Jul 2023 12:06:04 +0900    

Click here for diff

This commit adds a few comments about what LWLockWaitForVar() relies on  
when a backend waits for a variable update on its LWLocks for WAL  
insertions up to an expected LSN.  
  
First, LWLockWaitForVar() does not include a memory barrier, relying on  
a spinlock taken at the beginning of WaitXLogInsertionsToFinish().  This  
was hidden behind two layers of routines in lwlock.c.  This assumption  
is now documented at the top of LWLockWaitForVar(), and detailed at bit  
more within LWLockConflictsWithVar().  
  
Second, document why WaitXLogInsertionsToFinish() does not include  
memory barriers, relying on a spinlock at its top, which is, per Andres'  
input, fine for two different reasons, both depending on the fact that  
the caller of WaitXLogInsertionsToFinish() is waiting for a LSN up to a  
certain value.  
  
This area's documentation and assumptions could be improved more in the  
future, but at least that's a beginning.  
  
Author: Bharath Rupireddy, Andres Freund  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACVF+6jLvqKe6xhDzCCkr=rfd6upaGc3477Pji1Ke9G7Bg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/storage/lmgr/lwlock.c

Fix code indentation vioaltion introduced in commit d38ad8e31d.

commit   : 62e9af4c63fbd36fb9af8450fb44bece76d7766f    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 25 Jul 2023 12:35:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 25 Jul 2023 12:35:58 +0530    

Click here for diff

Per buildfarm member koel  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove unnecessary checks for indexes for REPLICA IDENTITY FULL tables.

commit   : d0ce9d0bc7f6aab6e45158bfa4f19cffdd7079a6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 25 Jul 2023 15:09:34 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 25 Jul 2023 15:09:34 +0900    

Click here for diff

Previously, when selecting an usable index for update/delete for the  
REPLICA IDENTITY FULL table, in IsIndexOnlyExpression(), we used to  
check if all index fields are not expressions. However, it was not  
necessary, because it is enough to check if only the leftmost index  
field is not an expression (and references the remote table column)  
and this check has already been done by  
RemoteRelContainsLeftMostColumnOnIdx().  
  
This commit removes IsIndexOnlyExpression() and  
RemoteRelContainsLeftMostColumnOnIdx() and all checks for usable  
indexes for REPLICA IDENTITY FULL tables are now performed by  
IsIndexUsableForReplicaIdentityFull().  
  
Backpatch this to remain the code consistent.  
  
Reported-by: Peter Smith  
Reviewed-by: Amit Kapila, Önder Kalacı  
Discussion: https://postgr.es/m/CAHut%2BPsGRE5WSsY0jcLHJEoA17MrbP9yy8FxdjC_ZOAACxbt%2BQ%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalrelation.h

Optimize WAL insertion lock acquisition and release with some atomics

commit   : 71e4cc6b8ec6a08f81973bd387fe575134cd0bdf    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Jul 2023 13:38:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Jul 2023 13:38:58 +0900    

Click here for diff

The WAL insertion lock variable insertingAt is currently being read  
and written with the help of the LWLock wait list lock to avoid any read  
of torn values.  This wait list lock can become a point of contention on  
a highly concurrent write workloads.  
  
This commit switches insertingAt to a 64b atomic variable that provides  
torn-free reads/writes.  On platforms without 64b atomic support, the  
fallback implementation uses spinlocks to provide the same guarantees  
for the values read.  LWLockWaitForVar(), through  
LWLockConflictsWithVar(), reads the new value to check if it still needs  
to wait with a u64 atomic operation.  LWLockUpdateVar() updates the  
variable before waking up the waiters with an exchange_u64 (full memory  
barrier).  LWLockReleaseClearVar() now uses also an exchange_u64 to  
reset the variable.  Before this commit, all these steps relied on  
LWLockWaitListLock() and LWLockWaitListUnlock().  
  
This reduces contention on LWLock wait list lock and improves  
performance of highly-concurrent write workloads.  Here are some  
numbers using pg_logical_emit_message() (HEAD at d6677b93) with various  
arbitrary record lengths and clients up to 1k on a rather-large machine  
(64 vCPUs, 512GB of RAM, 16 cores per sockets, 2 sockets), in terms of  
TPS numbers coming from pgbench:  
 message_size_b     |     16 |     64 |    256 |   1024  
--------------------+--------+--------+--------+-------  
 patch_4_clients    |  83830 |  82929 |  80478 |  73131  
 patch_16_clients   | 267655 | 264973 | 250566 | 213985  
 patch_64_clients   | 380423 | 378318 | 356907 | 294248  
 patch_256_clients  | 360915 | 354436 | 326209 | 263664  
 patch_512_clients  | 332654 | 321199 | 287521 | 240128  
 patch_1024_clients | 288263 | 276614 | 258220 | 217063  
 patch_2048_clients | 252280 | 243558 | 230062 | 192429  
 patch_4096_clients | 212566 | 213654 | 205951 | 166955  
 head_4_clients     |  83686 |  83766 |  81233 |  73749  
 head_16_clients    | 266503 | 265546 | 249261 | 213645  
 head_64_clients    | 366122 | 363462 | 341078 | 261707  
 head_256_clients   | 132600 | 132573 | 134392 | 165799  
 head_512_clients   | 118937 | 114332 | 116860 | 150672  
 head_1024_clients  | 133546 | 115256 | 125236 | 151390  
 head_2048_clients  | 137877 | 117802 | 120909 | 138165  
 head_4096_clients  | 113440 | 115611 | 120635 | 114361  
  
Bharath has been measuring similar improvements, where the limit of the  
WAL insertion lock begins to be felt when more than 256 concurrent  
clients are involved in this specific workload.  
  
An extra patch has been discussed to introduce a fast-exit path in  
LWLockUpdateVar() when there are no waiters, still this does not  
influence the write-heavy workload cases discussed as there are always  
waiters.  This will be considered separately.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACVF+6jLvqKe6xhDzCCkr=rfd6upaGc3477Pji1Ke9G7Bg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Fix the display of UNKNOWN message type in apply worker.

commit   : d38ad8e31dee1a69f4f6d4b6bb4e007e3751a93c    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 25 Jul 2023 09:12:29 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 25 Jul 2023 09:12:29 +0530    

Click here for diff

We include the message type while displaying an error context in the  
apply worker. Now, while retrieving the message type string if the  
message type is unknown we throw an error that will hide the original  
error. So, instead, we need to simply return the string indicating an  
unknown message type.  
  
Reported-by: Ashutosh Bapat  
Author: Euler Taveira, Amit Kapila  
Reviewed-by: Ashutosh Bapat  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CAExHW5suAEDW-mBZt_qu4RVxWZ1vL54-L+ci2zreYWebpzxYsA@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalproto.h

Fix off-by-one in LimitAdditionalPins()

commit   : f3bc5192889f6f02aa10ca9f24df4eab1f1493c1    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Jul 2023 19:07:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Jul 2023 19:07:52 -0700    

Click here for diff

Due to the bug LimitAdditionalPins() could return 0, violating  
LimitAdditionalPins()'s API ("One additional pin is always allowed"). This  
could be hit when setting shared_buffers very low and using a fair amount of  
concurrency.  
  
This bug was introduced in 31966b151e6a.  
  
Author: "Anton A. Melnikov" <[email protected]>  
Reported-by: "Anton A. Melnikov" <[email protected]>  
Reported-by: Victoria Shepard  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-  

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

Make test_decoding ddl.out shorter

commit   : d6677b93c79b19bf3772cb32fcea0a77d8520db9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jul 2023 17:48:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jul 2023 17:48:06 +0200    

Click here for diff

Some of the test_decoding test output was extremely wide, because it  
deals with massive toasted values, and the aligned mode causes psql to  
produce 200kB of whitespace and dashes. Change to unaligned mode  
temporarily to avoid that behavior.  
  
Backpatch to 14, where it applies cleanly.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql

Compare only major versions in AdjustUpgrade.pm

commit   : 6061adedf53cbe0f94a52dd02465abf8c7c9fb43    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jul 2023 17:14:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jul 2023 17:14:22 +0200    

Click here for diff

Because PostgreSQL::Version is very nuanced about development version  
numbers, the comparison to 16beta2 makes it think that that release is  
older than 16, therefore applying a database tweak that doesn't work  
there (the comparison is only supposed to match when run on version 15).  
As suggested by Andrew Dunstan, fix by having AdjustUpgrade.pm public  
methods create a separate PostgreSQL::Version object to use for these  
comparisons, that only carries the major version number.  
  
While at it, have the same methods ensure that the objects given are of  
the expected type.  
  
Backpatch to 16.  This module goes all the way back to 9.2, but there's  
probably no need for this fix except where betas still live.  
  
Co-authored-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

pgbench: Use COPY for client-side data generation

commit   : e35cc3b3f2d081e2de3a0e077715d12b3580cc74    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Jul 2023 13:48:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Jul 2023 13:48:22 +0900    

Click here for diff

This commit switches the client-side data generation from INSERT queries  
to COPY for the two tables pgbench_branches and pgbench_tellers.  
pgbench_accounts was already using COPY.  
  
COPY is a better interface for bulk loading or high latency connections  
(this point can be countered with the option for server-side data  
generation, still client-side is the default), and measurements have  
proved that using it for these two other tables can lead to improvements  
during initialization.  I did not notice slowdowns at large scale  
numbers on a local setup, either, most of the work happening for the  
accounts table.  
  
Previously COPY was only used for the pgbench_accounts table because the  
amount of data was much larger than the two other tables.  The code is  
refactored so as all three tables use the same code path to execute the  
COPY queries, with a callback to build data rows.  
  
Author: Tristan Partin  
Discussion: https://postgr.es/m/CSTU5P82ONZ1.19XFUGHMXHBRY@c3po  

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

pgbench: Add TAP tests to check consistency of data generated

commit   : 29836df323d752d534deb7b922cd48f08132e044    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 23 Jul 2023 20:03:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 23 Jul 2023 20:03:35 +0900    

Click here for diff

The tables created by pgbench rely on a few assumptions for TPC-B, where  
the "filler" attribute is used to comply with this benchmark's rules as  
well as pgbencn historical behavior.  The data generated for each table  
uses this filler in a different way:  
- pgbench_accounts uses it as a blank-padded empty string.  
- pgbench_tellers and pgbench_branches use it as a NULL value.  
  
There were no checks done about the consistency of the data initialized,  
and this has showed up while discussing a patch that changes the logic  
in charge of the client-side data generation (pgbench documents all that  
already in its comments).  This commit adds some checks on the data  
generated for both the server-side and client-side logic.  
  
Reviewed-by: Tristan Partin  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Avoid compiler warning in non-assert builds.

commit   : bda97e47afaeaab6236f37993ce45bb369add3e5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2023 10:32:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2023 10:32:52 -0400    

Click here for diff

After 3c90dcd03, try_partitionwise_join's child_joinrelids  
variable is read only in an Assert, provoking a compiler  
warning in non-assert builds.  Rearrange code to avoid the  
warning and eliminate unnecessary work in the non-assert case.  
  
Per CI testing (via Jeff Davis and Bharath Rupireddy)  
  
Discussion: https://postgr.es/m/[email protected]  

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

ICU: remove negative test that fails to fail.

commit   : 702d003269297042903c978176c0dd1ca77d5e60    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 21 Jul 2023 15:24:19 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 21 Jul 2023 15:24:19 -0700    

Click here for diff

On OpenBSD, setlocale() does not fail on an ICU-specific  
locale. Remove the test.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Fix calculation of relid sets for partitionwise child joins.

commit   : 3c90dcd039149716454378bd270673f781b5c19f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2023 12:00:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2023 12:00:14 -0400    

Click here for diff

Applying add_outer_joins_to_relids() to a child join doesn't actually  
work, even if we've built a SpecialJoinInfo specialized to the child,  
because that function will also compare the join's relids to elements  
of the main join_info_list, which only deal in regular relids not  
child relids.  This mistake escaped detection by the existing  
partitionwise join tests because they didn't test any cases where  
add_outer_joins_to_relids() needs to add additional OJ relids (that  
is, any cases where join reordering per identity 3 is possible).  
  
Instead, let's apply adjust_child_relids() to the relids of the parent  
join.  This requires minor code reordering to collect the relevant  
AppendRelInfo structures first, but that's work we'd do shortly anyway.  
  
Report and fix by Richard Guo; cosmetic changes by me  
  
Discussion: https://postgr.es/m/CAMbWs49NCNbyubZWgci3o=_OTY=snCfAPtMnM-32f3mm-K-Ckw@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Code review for commit b6e1157e7d

commit   : 7c7412cae3ea8f8accdec1022969a9360b74f253    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 21 Jul 2023 19:15:34 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 21 Jul 2023 19:15:34 +0900    

Click here for diff

b6e1157e7d made some changes to enforce that  
JsonValueExpr.formatted_expr is always set and is the expression that  
gives a JsonValueExpr its runtime value, but that's not really  
apparent from the comments about and the code manipulating  
formatted_expr.  This commit fixes that.  
  
Per suggestion from Álvaro Herrera.  
  
Discussion: https://postgr.es/m/20230718155313.3wqg6encgt32adqb%40alvherre.pgsql  

M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h

Fix worker_spi when launching workers without shared_preload_libraries

commit   : 97ff8dd02ca788020021cdafb85d77d4fd3f3125    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Jul 2023 12:07:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Jul 2023 12:07:52 +0900    

Click here for diff

Currently, the database name to connect is initialized only when the  
module is loaded with shared_preload_libraries, causing any call of  
worker_spi_launch() to fail if the library is not loaded for a dynamic  
bgworker launch.  Rather than making the GUC defining the database to  
connect to a PGC_POSTMASTER, this commit switches worker_spi.database to  
PGC_SIGHUP, loaded even if the module's library is loaded dynamically  
for a worker.  
  
We have been discussing about the integration of more advanced tests in  
this module, with and without shared_preload_libraries set, so this  
eases a bit the work planned in this area.  
  
No backpatch is done as, while this is a bug, it changes the definition  
of worker_spi.database.  
  
Author: Masahiro Ikeda  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/worker_spi.c

Guard against null plan pointer in CachedPlanIsSimplyValid().

commit   : 9089287aa037fdecb5a52cec1926e5ae9569e9f9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2023 14:23:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jul 2023 14:23:46 -0400    

Click here for diff

If both the passed-in plan pointer and plansource->gplan are  
NULL, CachedPlanIsSimplyValid would think that the plan pointer  
is possibly-valid and try to dereference it.  For the one extant  
call site in plpgsql, this situation doesn't normally happen  
which is why we've not noticed. However, it appears to be possible  
if the previous use of the cached plan failed, as per report from  
Justin Pryzby.  Add an extra check to prevent crashing.  
Back-patch to v13 where this code was added.  
  
Discussion: https://postgr.es/m/ZLlV+STFz1l/[email protected]  

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

Revert "Add notBefore and notAfter to SSL cert info display"

commit   : 29a0ccbce97978e5d65b8f96c85a00611bb403c4    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 17:18:12 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 17:18:12 +0200    

Click here for diff

Due to an oversight in reviewing, this used functionality not  
compatible with old versions of OpenSSL.  
  
This reverts commit 75ec5e7bec700577d39d653c316e3ae6c505842c.  

M contrib/sslinfo/Makefile
M contrib/sslinfo/meson.build
D contrib/sslinfo/sslinfo–1.2–1.3.sql
M contrib/sslinfo/sslinfo.c
M contrib/sslinfo/sslinfo.control
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/test/regress/expected/rules.out
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl

Add notBefore and notAfter to SSL cert info display

commit   : 75ec5e7bec700577d39d653c316e3ae6c505842c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 17:07:32 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 17:07:32 +0200    

Click here for diff

This adds the X509 attributes notBefore and notAfter to sslinfo  
as well as pg_stat_ssl to allow verifying and identifying the  
validity period of the current client certificate.  
  
Author: Cary Huang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sslinfo/Makefile
M contrib/sslinfo/meson.build
A contrib/sslinfo/sslinfo–1.2–1.3.sql
M contrib/sslinfo/sslinfo.c
M contrib/sslinfo/sslinfo.control
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/test/regress/expected/rules.out
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl

Set fixed dates for test certificates validity

commit   : 40fad96530caf190a3babf322ca705e744c393bb    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 16:04:27 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 16:04:27 +0200    

Click here for diff

Rather than specifying a validity of 10 000 days into the future  
during test certificate generation, this hardcodes the notBefore  
and notAfter attributes to known values. This will allow writing  
tests on the validity of the certificates without knowing when a  
specific certificate was regenerated.  
  
This is done as a prerequisite for an upcoming patch which adds  
notBefore and notAfter to pg_stat_ssl and sslinfo.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/conf/cas.config
M src/test/ssl/ssl/both-cas-1.crt
M src/test/ssl/ssl/both-cas-2.crt
M src/test/ssl/ssl/client+client_ca.crt
M src/test/ssl/ssl/client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/client-dn.crt
M src/test/ssl/ssl/client-long.crt
M src/test/ssl/ssl/client-revoked-utf8.crt
M src/test/ssl/ssl/client-revoked.crt
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/client.crt
M src/test/ssl/ssl/client_ca.crt
M src/test/ssl/ssl/client_ext.crt
M src/test/ssl/ssl/root+client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/ssl/root+client_ca.crt
M src/test/ssl/ssl/root+server-crldir/a836cc2d.r0
M src/test/ssl/ssl/root+server.crl
M src/test/ssl/ssl/root+server_ca.crt
M src/test/ssl/ssl/server-cn-and-alt-names.crt
M src/test/ssl/ssl/server-cn-and-ip-alt-names.crt
M src/test/ssl/ssl/server-cn-only+server_ca.crt
M src/test/ssl/ssl/server-cn-only.crt
M src/test/ssl/ssl/server-crldir/a836cc2d.r0
M src/test/ssl/ssl/server-ip-alt-names.crt
M src/test/ssl/ssl/server-ip-cn-and-alt-names.crt
M src/test/ssl/ssl/server-ip-cn-and-dns-alt-names.crt
M src/test/ssl/ssl/server-ip-cn-only.crt
M src/test/ssl/ssl/server-ip-in-dnsname.crt
M src/test/ssl/ssl/server-multiple-alt-names.crt
M src/test/ssl/ssl/server-no-names.crt
M src/test/ssl/ssl/server-revoked.crt
M src/test/ssl/ssl/server-single-alt-name.crt
M src/test/ssl/ssl/server.crl
M src/test/ssl/ssl/server_ca.crt

pg_upgrade: include additional detail in cluster check

commit   : a3f695e645d0363d845a828db45deac5af1b4c0e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 14:55:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Jul 2023 14:55:50 +0200    

Click here for diff

When the cluster failed the pg_controldata check for clean shut  
down we only reported that it did so, not why. The state of the  
cluster can be important information when diagnosing the failed  
upgrade attempt, so instead include it in the error message.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/controldata.c

Unify JSON categorize type API and export for external use

commit   : 3c152a27b06313fe27bd47079658f928e291986b    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 16:19:56 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 16:19:56 +0900    

Click here for diff

This essentially removes the JsonbTypeCategory enum and  
jsonb_categorize_type() and integrates any jsonb-specific logic that  
was in jsonb_categorize_type() into json_categorize_type(), now  
moved to jsonfuncs.c.  The remaining JsonTypeCategory enum and  
json_categorize_type() cover the needs of the callers in both json.c  
and jsonb.c.  json_categorize_type() has grown a new parameter named  
is_jsonb for callers to engage the jsonb-specific behavior of  
json_categorize_type().  
  
One notable change in the now exported API of json_categorize_type()  
is that it now always returns *outfuncoid even though a caller may  
have no need currently to see one.  
  
This is in preparation of later commits to implement additional  
SQL/JSON functions.  
  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonfuncs.h
M src/tools/pgindent/typedefs.list

Add missing ObjectIdGetDatum() in syscache lookup calls for Oids

commit   : 2a990abd79acea4717cc8f982a28f35b6b347ddb    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Jul 2023 15:18:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Jul 2023 15:18:25 +0900    

Click here for diff

Based on how postgres.h foes the Oid <-> Datum conversion, there is no  
existing bugs but let's be consistent.  17 spots have been noticed as  
incorrectly passing down Oids rather than Datums.  Aleksander got one,  
Zhang two and I the rest.  
  
Author: Michael Paquier, Aleksander Alekseev, Zhang Mingli  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/alter.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/user.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c

Fix pg_recvlogical upon signal termination

commit   : 47556a0013fa64d44add2760577d49cf2eca4cd0    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Jul 2023 10:22:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Jul 2023 10:22:46 +0900    

Click here for diff

When pg_recvlogical needs to abort on a signal like SIGINT/SIGTERM, it  
is expected to exit cleanly as the code documents.  However, the code  
forgot to clean up the state of the connection before leaving.  This  
would cause the tool to emit messages like "unexpected termination of  
replication stream" error, which is meant for really unexpected  
termination or a crash.  
  
The code is refactored to apply the same termination abort operations for  
signals, end LSN and keepalive cases, registering a "reason" for the  
termination with a message printed under --verbose adapted to the reason  
used.  
  
This is arguably a bug, but this has been this way since the tool exists  
and the signal termination can now become slower depending on the change  
being decoded when the signal is received.  
  
Reported-by: Andres Freund  
Author: Bharath Rupireddy  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Cary Huang, Michael  
Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_recvlogical.c
M src/tools/pgindent/typedefs.list

Doc: move unparenthesized syntaxes for a few commands.

commit   : ab29a7a9c6ffaddaf6788a13e83f1a249f06bb1b    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:59 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:59 -0700    

Click here for diff

Move documentation of the unparenthesized syntaxes for VACUUM,  
ANALYZE, EXPLAIN, and CLUSTER to the "Compatibility" section of  
their documentation to improve readability of the preferred,  
parenthesized syntaxes.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_bc5uHieG1976kGqJKxyWtyQt9yvktjsVX%2Bi7NOigDjOA%40mail.gmail.com  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/vacuum.sgml

Support parenthesized syntax for CLUSTER without a table name.

commit   : cdaedfc96d1488069518d42479125ceb9a5e67d0    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:52 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:52 -0700    

Click here for diff

b5913f6120 added a parenthesized syntax for CLUSTER, but it  
requires specifying a table name.  This is unlike commands such as  
VACUUM and ANALYZE, which do not require specifying a table in the  
parenthesized syntax.  This change resolves this inconsistency.  
This is preparatory work for a follow-up commit that will move the  
unparenthesized syntax to the "Compatibility" section of the  
CLUSTER documentation.  
  
Reviewed-by: Melanie Plageman, Michael Paquier  
Discussion: https://postgr.es/m/CAAKRu_bc5uHieG1976kGqJKxyWtyQt9yvktjsVX%2Bi7NOigDjOA%40mail.gmail.com  

M doc/src/sgml/ref/cluster.sgml
M src/backend/parser/gram.y

Rearrange CLUSTER rules in gram.y.

commit   : 018b61f81b4aa3c85e2d671d056681ff5c765475    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:43 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 19 Jul 2023 15:26:43 -0700    

Click here for diff

This change moves the unparenthesized syntax for CLUSTER to the end  
of the ClusterStmt rules in preparation for a follow-up commit that  
will move this syntax to the "Compatibility" section of the CLUSTER  
documentation.  The documentation for the CLUSTER syntaxes has also  
been consolidated.  
  
Suggested-by: Melanie Plageman  
Discussion https://postgr.es/m/CAAKRu_bc5uHieG1976kGqJKxyWtyQt9yvktjsVX%2Bi7NOigDjOA%40mail.gmail.com  

M doc/src/sgml/ref/cluster.sgml
M src/backend/parser/gram.y

Add psql \drg command to display role grants.

commit   : d65ddaca93f6f31e76b15bc1001f5cabb6a46c9d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2023 12:46:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2023 12:46:30 -0400    

Click here for diff

With the addition of INHERIT and SET options for role grants,  
the historical display of role memberships in \du/\dg is woefully  
inadequate.  Besides those options, there are pre-existing  
shortcomings that you can't see the ADMIN option nor the grantor.  
  
To fix this, remove the "Member of" column from \du/\dg altogether  
(making that output usefully narrower), and invent a new meta-command  
"\drg" that is specifically for displaying role memberships.  It  
shows one row for each role granted to the selected role(s), with  
the grant options and grantor.  
  
We would not normally back-patch such a feature addition post  
feature freeze, but in this case the change is mainly driven by  
v16 changes in the server, so it seems appropriate to include it  
in v16.  
  
Pavel Luzanov, with bikeshedding and review from a lot of people,  
but particularly David Johnston  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: improve description of IN and row-constructor comparisons.

commit   : 15c68cd84a2c80eed9b67ed6746ed5b91baea587    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2023 11:00:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jul 2023 11:00:34 -0400    

Click here for diff

IN and NOT IN work fine on records and arrays, so just say that  
they accept "expressions" not "scalar expressions".  I think that  
that phrasing was meant to say that they don't work on set-returning  
expressions, but that's not the common meaning of "scalar".  
  
Revise the description of row-constructor comparisons to make it  
perhaps a bit less confusing.  (This partially reverts some  
dubious wording changes made by commit f56651519.)  
  
Per gripe from Ilya Nenashev.  Back-patch to supported branches.  
In HEAD and v16, also drop a NOTE about pre-8.2 behavior, which  
is hopefully no longer of interest to anybody.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

pg_archivecleanup: Add --clean-backup-history

commit   : 3f8c98d0b631882e3c513954df42891c1c9585c7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Jul 2023 13:41:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Jul 2023 13:41:22 +0900    

Click here for diff

By default, pg_archivecleanup does not remove backup history files.  
These are just few bytes useful for debugging purposes, still keeping  
them around can bloat an archive path history files mixed with the WAL  
segments if the path has a long history.  
  
This patch adds a new option to control if backup history files are  
removed, depending on the oldest segment name to keep around.  
  
While on it, the TAP tests are refactored so as these are now able to  
handle lists of files.  Each file has a flag to track if it should still  
exist or not depending on the oldest segment defined with the command  
run.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgarchivecleanup.sgml
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl

pg_archivecleanup: Refactor loop doing old segment removals

commit   : 4a7556f77c44d295241d2432094b40156f69be1a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Jul 2023 12:23:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Jul 2023 12:23:53 +0900    

Click here for diff

This commit refactors a bit the main loop of pg_archivecleanup that  
handles the removal of old segments, reducing by one its level of  
indentation.  This will help an incoming patch that adds a new option  
related to the segment filtering logic.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_archivecleanup/pg_archivecleanup.c

Doc: Update the logical replication restriction w.r.t Replica Identity Full.

commit   : 961cf5c9055ff5f689a06aafed3346146b3cee43    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 19 Jul 2023 08:11:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 19 Jul 2023 08:11:44 +0530    

Click here for diff

Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Onder Kalaci, Sergei Kornilov, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58662174ED62648E0D611194F530A@TYAPR01MB5866.jpnprd01.prod.outlook.com  

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

Doc: fix out-of-date example of SPI usage.

commit   : 137b131d6fbd29b4acf740aba3f74220faef2678    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2023 11:59:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2023 11:59:39 -0400    

Click here for diff

The "count" argument of SPI_exec() only limits execution when  
the query is actually returning rows.  This was not the case  
before PG 9.0, so this example was correct when written; but  
we missed updating it in commit 2ddc600f8.  Extend the example  
to show the behavior both with and without RETURNING.  
  
While here, improve the commentary and markup for the rest  
of the example.  
  
David G. Johnston and Tom Lane, per report from Curt Kolovson.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CANhYJV6HWtgz_qjx_APfK0PAgLUzY-2vjLuj7i_o=TZF1LAQew@mail.gmail.com  

M doc/src/sgml/spi.sgml

Fix indentation in twophase.c

commit   : 4e465aac36ce9a9533c68dbdc83e67579880e628    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Jul 2023 14:04:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Jul 2023 14:04:31 +0900    

Click here for diff

This has been missed in cb0cca1, noticed before buildfarm member koel  
has been able to complain while poking at a different patch.  Like the  
other commit, backpatch all the way down to limit the odds of merge  
conflicts.  
  
Backpatch-through: 11  

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

Fix recovery of 2PC transaction during crash recovery

commit   : cb0cca1880723b4c90c56cdcf3842489ef036800    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Jul 2023 13:43:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Jul 2023 13:43:44 +0900    

Click here for diff

A crash in the middle of a checkpoint with some two-phase state data  
already flushed to disk by this checkpoint could cause a follow-up crash  
recovery to recover twice the same transaction, once from what has been  
found in pg_twophase/ at the beginning of recovery and a second time  
when replaying its corresponding record.  
  
This would lead to FATAL failures in the startup process during  
recovery, where the same transaction would have a state recovered twice  
instead of once:  
LOG:  recovering prepared transaction 731 from shared memory  
LOG:  recovering prepared transaction 731 from shared memory  
FATAL:  lock ExclusiveLock on object 731/0/0 is already held  
  
This issue is fixed by skipping the addition of any 2PC state coming  
from a record whose equivalent 2PC state file has already been loaded in  
TwoPhaseState at the beginning of recovery by restoreTwoPhaseData(),  
which is OK as long as the system has not reached a consistent state.  
  
The timing to get a messed up recovery processing is very racy, and  
would very unlikely happen.  The thread that has reported the issue has  
demonstrated the bug using injection points to force a PANIC in the  
middle of a checkpoint.  
  
Issue introduced in 728bd99, so backpatch all the way down.  
  
Reported-by: "suyu.cmj" <[email protected]>  
Author: "suyu.cmj" <[email protected]>  
Author: Michael Paquier  
Discussion: https://postgr.es/m/109e6994-b971-48cb-84f6-829646f18b4c.mengjuan.cmj@alibaba-inc.com  
Backpatch-through: 11  

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

Include <limits.h> in fe-auth.c, to get CHAR_BIT reliably.

commit   : 8fab4b34801331f1c59352cb0a248be436b60aef    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2023 16:54:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jul 2023 16:54:54 -0400    

Click here for diff

fe-auth.c references CHAR_BIT since commit 3a465cc67, but it  
did not #include <limits.h>, which per POSIX is where that  
symbol is defined.  This escaped notice so far because  
(a) on most platforms, <sys/param.h> pulls in <limits.h>,  
(b) even if yours doesn't, OpenSSL pulls it in, so compiling  
with --with-openssl masks the omission.  
  
Per bug #18026 from Marcel Hofstetter.  Back-patch to v16.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove db_user_namespace.

commit   : 884eee5bfb5ab902413dc00ccee5b3e3f1c505d0    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 17 Jul 2023 11:44:59 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 17 Jul 2023 11:44:59 -0700    

Click here for diff

This feature was intended to be a temporary measure to support  
per-database user names.  A better one hasn't materialized in the  
~21 years since it was added, and nobody claims to be using it, so  
let's just remove it.  
  
Reviewed-by: Michael Paquier, Magnus Hagander  
Discussion: https://postgr.es/m/20230630200509.GA2830328%40nathanxps13  
Discussion: https://postgr.es/m/20230630215608.GD2941194%40nathanxps13  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/pqcomm.h

Shrink memory contexts struct sizes

commit   : 2c2eb0d6b27f498851bace47fc19e4c7fc90af4f    
  
author   : David Rowley <[email protected]>    
date     : Mon, 17 Jul 2023 11:16:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 17 Jul 2023 11:16:56 +1200    

Click here for diff

Here we reduce the block size fields in AllocSetContext, GenerationContext  
and SlabContext from Size down to uint32.  Ever since c6e0fe1f2, blocks  
for non-dedicated palloc chunks can no longer be larger than 1GB, so  
there's no need to store the various block size fields as 64-bit values.  
32 bits are enough to store 2^30.  
  
Here we also further reduce the memory context struct sizes by getting rid  
of the 'keeper' field which stores a pointer to the context's keeper  
block.  All the context types which have this field always allocate the  
keeper block in the same allocation as the memory context itself, so the  
keeper block always comes right at the end of the context struct.  Add  
some macros to calculate that address rather than storing it in the  
context.  
  
Overall, in AllocSetContext and GenerationContext, this saves 20 bytes on  
64-bit builds which for ALLOCSET_SMALL_SIZES can sometimes mean the  
difference between having to allocate a 2nd block and storing all the  
required allocations on the keeper block alone.  Such contexts are used  
in relcache to store cache entries for indexes, of which there can be  
a large number in a single backend.  
  
Author: Melih Mutlu  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAGPVpCSOW3uJ1QJmsMR9_oE3X7fG_z4q0AoU4R_w+2RzvroPFg@mail.gmail.com  

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

Simplify option handling in pg_ctl.

commit   : 03d1080d8a95d7ced90043f3aaad7d2aaeaedb1b    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 14 Jul 2023 12:35:54 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 14 Jul 2023 12:35:54 -0700    

Click here for diff

Now that the in-tree getopt_long() moves non-options to the end of  
argv (see commit 411b720343), we can remove pg_ctl's workaround for  
getopt_long() implementations that don't reorder argv.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20230713034903.GA991765%40nathanxps13  

M src/bin/pg_ctl/pg_ctl.c

Allow plan nodes with initPlans to be considered parallel-safe.

commit   : e08d74ca1342cb9e6047daad2019b550ecf54877    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 17:30:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 17:30:14 -0400    

Click here for diff

If the plan itself is parallel-safe, and the initPlans are too,  
there's no reason anymore to prevent the plan from being marked  
parallel-safe.  That restriction (dating to commit ab77a5a45) was  
really a special case of the fact that we couldn't transmit subplans  
to parallel workers at all.  We fixed that in commit 5e6d8d2bb and  
follow-ons, but this case never got addressed.  
  
We still forbid attaching initPlans to a Gather node that's  
inserted pursuant to debug_parallel_query = regress.  That's because,  
when we hide the Gather from EXPLAIN output, we'd hide the initPlans  
too, causing cosmetic regression diffs.  It seems inadvisable to  
kluge EXPLAIN to the extent required to make the output look the  
same, so just don't do it in that case.  
  
Along the way, this also takes care of some sloppiness about updating  
path costs to match when we move initplans from one place to another  
during createplan.c and setrefs.c.  Since all the planning decisions  
are already made by that point, this is just cosmetic; but it seems  
good to keep EXPLAIN output consistent with where the initplans are.  
  
The diff in query_planner() might be worth remarking on.  I found that  
one because after fixing things to allow parallel-safe initplans, one  
partition_prune test case changed plans (as shown in the patch) ---  
but only when debug_parallel_query was active.  The reason proved to  
be that we only bothered to mark Result nodes as potentially  
parallel-safe when debug_parallel_query is on.  This neglects the fact  
that parallel-safety may be of interest for a sub-query even though  
the Result itself doesn't parallelize.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/subselect.h
M src/test/regress/expected/partition_prune.out

Account for optimized MinMax aggregates during SS_finalize_plan.

commit   : d0d44049d1262aed2eee906d26af852948206db0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 16:50:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 16:50:13 -0400    

Click here for diff

We are capable of optimizing MIN() and MAX() aggregates on indexed  
columns into subqueries that exploit the index, rather than the normal  
thing of scanning the whole table.  When we do this, we replace the  
Aggref node(s) with Params referencing subquery outputs.  Such Params  
really ought to be included in the per-plan-node extParam/allParam  
sets computed by SS_finalize_plan.  However, we've never done so  
up to now because of an ancient implementation choice to perform  
that substitution during set_plan_references, which runs after  
SS_finalize_plan, so that SS_finalize_plan never sees these Params.  
  
This seems like clearly a bug, yet there have been no field reports  
of problems that could trace to it.  This may be because the types  
of Plan nodes that could contain Aggrefs do not have any of the  
rescan optimizations that are controlled by extParam/allParam.  
Nonetheless it seems certain to bite us someday, so let's fix it  
in a self-contained patch that can be back-patched if we find a  
case in which there's a live bug pre-v17.  
  
The cleanest fix would be to perform a separate tree walk to do  
these substitutions before SS_finalize_plan runs.  That seems  
unattractive, first because a whole-tree mutation pass is expensive,  
and second because we lack infrastructure for visiting expression  
subtrees in a Plan tree, so that we'd need a new function knowing  
as much as SS_finalize_plan knows about that.  I also considered  
swapping the order of SS_finalize_plan and set_plan_references,  
but that fell foul of various assumptions that seem tricky to fix.  
So the approach adopted here is to teach SS_finalize_plan itself  
to check for such Aggrefs.  I refactored things a bit in setrefs.c  
to avoid having three copies of the code that does that.  
  
Given the lack of any currently-known bug, no test case here.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/include/optimizer/planmain.h

Improve error message for MaxAllocSize overrun in accumArrayResult.

commit   : b8d3dae00f6c49d0c41abd5b36e2588a81abe5be    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2023 10:35:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Jul 2023 10:35:24 -0400    

Click here for diff

Before, if you went past about 64M array elements in array_agg() and  
allied functions, you got a generic "invalid memory alloc request  
size" error.  This patch replaces that with "array size exceeds the  
maximum allowed", which seems more user-friendly since it points you  
to needing to reduce the size of your array result.  (This is the  
same error text you'd get from construct_md_array in the event of  
overrunning the maximum physical size for the finished array.)  
  
Per question from Shaozhong Shi.  Since this hasn't come up often,  
I don't feel a need to back-patch.  
  
Discussion: https://postgr.es/m/CA+i5JwYtVS9z2E71PcNKAVPbOn4R2wuj-LqbJsYr_XOz73q7dQ@mail.gmail.com  

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

Add missing initializations of p_perminfo

commit   : 00f2a2556c9b23050e4f987e5d563b6856b83fc2    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 14 Jul 2023 14:28:38 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 14 Jul 2023 14:28:38 +0900    

Click here for diff

In a61b1f74823, we failed to update transformFromClauseItem() and  
buildNSItemFromLists() to set ParseNamespaceItem.p_perminfo causing  
it to point to garbage.  
  
Pointed out by Tom Lane.  
  
Reported-by: Farias de Oliveira <[email protected]>  
Discussion: https://postgr.es/m/3173476.1689286373%40sss.pgh.pa.us  
Backpatch-through: 16  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c

Fix privilege check for SET SESSION AUTHORIZATION.

commit   : a0363ab7aafda7d16ae59e72d86866c02ad3d657    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 13 Jul 2023 21:13:45 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 13 Jul 2023 21:13:45 -0700    

Click here for diff

Presently, the privilege check for SET SESSION AUTHORIZATION checks  
whether the original authenticated role was a superuser at  
connection start time.  Even if the role loses the superuser  
attribute, its existing sessions are permitted to change session  
authorization to any role.  
  
This commit modifies this privilege check to verify the original  
authenticated role currently has superuser.  In the event that the  
authenticated role loses superuser within a session authorization  
change, the authorization change will remain in effect, which means  
the user can still take advantage of the target role's privileges.  
However, [RE]SET SESSION AUTHORIZATION will only permit switching  
to the original authenticated role.  
  
Author: Joseph Koshakow  
Discussion: https://postgr.es/m/CAAvxfHc-HHzONQ2oXdvhFF9ayRnidPwK%2BfVBhRzaBWYYLVQL-g%40mail.gmail.com  

M doc/src/sgml/ref/set_session_auth.sgml
M src/backend/commands/variable.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Move privilege check for SET SESSION AUTHORIZATION.

commit   : 9987a7bf34061ed5cffc4e5113da056358976e94    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 13 Jul 2023 21:10:36 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 13 Jul 2023 21:10:36 -0700    

Click here for diff

Presently, the privilege check for SET SESSION AUTHORIZATION is  
performed in session_authorization's assign_hook.  A relevant  
comment states, "It's OK because the check does not require catalog  
access and can't fail during an end-of-transaction GUC  
reversion..."  However, we plan to add a catalog lookup to this  
privilege check in a follow-up commit.  
  
This commit moves this privilege check to the check_hook for  
session_authorization.  Like check_role(), we do not throw a hard  
error for insufficient privileges when the source is PGC_S_TEST.  
  
Author: Joseph Koshakow  
Discussion: https://postgr.es/m/CAAvxfHc-HHzONQ2oXdvhFF9ayRnidPwK%2BfVBhRzaBWYYLVQL-g%40mail.gmail.com  

M src/backend/commands/variable.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Allow the use of a hash index on the subscriber during replication.

commit   : edca3424342da323499a1998d18a888283e52ac7    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 14 Jul 2023 08:21:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 14 Jul 2023 08:21:54 +0530    

Click here for diff

Commit 89e46da5e5 allowed using BTREE indexes that are neither  
PRIMARY KEY nor REPLICA IDENTITY on the subscriber during apply of  
update/delete. This patch extends that functionality to also allow HASH  
indexes.  
  
We explored supporting other index access methods as well but they don't  
have a fixed strategy for equality operation which is required by the  
current infrastructure in logical replication to scan the indexes.  
  
Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Onder Kalaci, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58669D7414E59664E17A5827F522A@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c
M src/backend/utils/cache/lsyscache.c
M src/include/executor/executor.h
M src/include/utils/lsyscache.h
M src/test/subscription/t/032_subscribe_use_index.pl

Add indisreplident to fields refreshed by RelationReloadIndexInfo()

commit   : a5ea825f958c2de9fadb825cbf16bf9b1360f0df    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 11:15:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 11:15:34 +0900    

Click here for diff

RelationReloadIndexInfo() is a fast-path used for index reloads in the  
relation cache, and it has always forgotten about updating  
indisreplident, which is something that would happen after an index is  
selected for a replica identity.  This can lead to incorrect cache  
information provided when executing a command in a transaction context  
that updates indisreplident.  
  
None of the code paths currently on HEAD that need to check upon  
pg_index.indisreplident fetch its value from the relation cache, always  
relying on a fresh copy on the syscache.  Unfortunately, this may not be  
the case of out-of-core code, that could see out-of-date value.  
  
Author: Shruthi Gowda  
Reviewed-by: Robert Haas, Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/CAASxf_PBcxax0wW-3gErUyftZ0XrCs3Lrpuhq4-Z3Fak1DoW7Q@mail.gmail.com  
Backpatch-through: 11  

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

Fix updates of indisvalid for partitioned indexes

commit   : 38ea6aa90e615fc91c138fc1efbc981ef3b434f8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 10:12:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 10:12:48 +0900    

Click here for diff

indisvalid is switched to true for partitioned indexes when all its  
partitions have valid indexes when attaching a new partition, up to the  
top-most parent if all its leaves are themselves valid when dealing with  
multiple layers of partitions.  
  
The copy of the tuple from pg_index used to switch indisvalid to true  
came from the relation cache, which is incorrect.  Particularly, in the  
case reported by Shruthi Gowda, executing a series of commands in a  
single transaction would cause the validation of partitioned indexes to  
use an incorrect version of a pg_index tuple, as indexes are reloaded  
after an invalidation request with RelationReloadIndexInfo(), a much  
faster version than a full index cache rebuild.  In this case, the  
limited information updated in the cache leads to an incorrect version  
of the tuple used.  One of the symptoms reported was the following  
error, with a replica identity update, for instance:  
"ERROR: attempted to update invisible tuple"  
  
This is incorrect since 8b08f7d, so backpatch all the way down.  
  
Reported-by: Shruthi Gowda  
Author: Michael Paquier  
Reviewed-by: Shruthi Gowda, Dilip Kumar  
Discussion: https://postgr.es/m/CAASxf_PBcxax0wW-3gErUyftZ0XrCs3Lrpuhq4-Z3Fak1DoW7Q@mail.gmail.com  
Backpatch-through: 11  

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

Remove wal_sync_method=fsync_writethrough on Windows.

commit   : d0c28601efaa8b04f11a19506f3371bba8438acc    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Jul 2023 11:59:07 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Jul 2023 11:59:07 +1200    

Click here for diff

The "fsync" level already flushes drive write caches on Windows (as does  
"fdatasync"), so it only confuses matters to have an apparently higher  
level that isn't actually different at all.  
  
That leaves "fsync_writethrough" only for macOS, where it actually does  
something different.  
  
Reviewed-by: Magnus Hagander <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ2CG2SouPv2mca2WCTOJxYumvBARRcKPraFMB6GSEMcA%40mail.gmail.com  

M doc/src/sgml/wal.sgml
M src/backend/storage/file/fd.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/port/win32_port.h

Add information about line contents on parsing failure of wait_event_names.txt

commit   : aea7fe33fb6a96133c47cf4b3af25a7c62f49c06    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 09:09:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 09:09:23 +0900    

Click here for diff

The contents of the line whose parsing failed was not reported in the  
error message produced by generate-wait_event_types.pl, making harder  
than necessary the debugging of incorrectly-shaped entries in the file.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/generate-wait_event_types.pl

Remove double quotes from the second column of wait_event_names.txt

commit   : 183a60a628fec074372e7a53d5006c18bd7a8e53    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 08:55:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jul 2023 08:55:11 +0900    

Click here for diff

The double quotes used for the wait event names are not required, as  
the values quoted are made of single words.  The files generated by  
generate-wait_event_types.pl (pgstat_wait_event.c, wait_event_types.h  
and wait_event_types.sgml) are exactly the same before and after this  
commit, hence the wait event names and the enum elements have the same  
names as before.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/wait_event_names.txt

Handle DROP DATABASE getting interrupted

commit   : c66a7d75e652801043ece99b6a8f89fd9513eaaa    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:28 -0700    

Click here for diff

Until now, when DROP DATABASE got interrupted in the wrong moment, the removal  
of the pg_database row would also roll back, even though some irreversible  
steps have already been taken. E.g. DropDatabaseBuffers() might have thrown  
out dirty buffers, or files could have been unlinked. But we continued to  
allow connections to such a corrupted database.  
  
To fix this, mark databases invalid with an in-place update, just before  
starting to perform irreversible steps. As we can't add a new column in the  
back branches, we use pg_database.datconnlimit = -2 for this purpose.  
  
An invalid database cannot be connected to anymore, but can still be  
dropped.  
  
Unfortunately we can't easily add output to psql's \l to indicate that some  
database is invalid, it doesn't fit in any of the existing columns.  
  
Add tests verifying that a interrupted DROP DATABASE is handled correctly in  
the backend and in various tools.  
  
Reported-by: Evgeny Morozov <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, bug present in all supported versions  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/dbcommands.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/init/postinit.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/vacuumdb.c
M src/include/catalog/pg_database.h
M src/test/recovery/meson.build
A src/test/recovery/t/037_invalid_database.pl

Release lock after encountering bogs row in vac_truncate_clog()

commit   : 83ecfa9fad11448af2cbac6c9f2a03507e6317cf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:28 -0700    

Click here for diff

When vac_truncate_clog() encounters bogus datfrozenxid / datminmxid values, it  
returns early. Unfortunately, until now, it did not release  
WrapLimitsVacuumLock. If the backend later tries to acquire  
WrapLimitsVacuumLock, the session / autovacuum worker hangs in an  
uncancellable way. Similarly, other sessions will hang waiting for the  
lock. However, if the backend holding the lock exited or errored out for some  
reason, the lock was released.  
  
The bug was introduced as a side effect of 566372b3d643.  
  
It is interesting that there are no production reports of this problem. That  
is likely due to a mix of bugs leading to bogus values having gotten less  
common, process exit releasing locks and instances of hangs being hard to  
debug for "normal" users.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c

Remove unnecessary pfree() in g_intbig_compress().

commit   : 8aac9759bb855a9349ae39944901d25a858b4751    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 13:07:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 13:07:51 -0400    

Click here for diff

GiST compress functions (like all GiST opclass functions) are  
supposed to be called in short-lived memory contexts, so that  
minor memory leaks in them are not of concern, and indeed  
explicit pfree's are likely slightly counterproductive.  
But this one in g_intbig_compress() is more than  
slightly counterproductive, because it's guarded by  
"if (in != DatumGetArrayTypeP(entry->key))" which means  
that if this test succeeds, we've detoasted the datum twice.  
(And to add insult to injury, the extra detoast result is  
leaked.)  Let's just drop the whole stanza, relying on the  
GiST temporary context mechanism to clean up in good time.  
  
The analogous bit in g_int_compress() is  
       if (r != (ArrayType *) DatumGetPointer(entry->key))  
           pfree(r);  
which doesn't have the gratuitous-detoast problem so  
I left it alone.  Perhaps there is a case for removing  
unnecessary pfree's more widely, but I'm not sure if it's  
worth the code churn.  
  
The potential extra decompress seems expensive enough to  
justify calling this a (minor) performance bug and  
back-patching.  
  
Konstantin Knizhnik, Matthias van de Meent, Tom Lane  
  
Discussion: https://postgr.es/m/CAEze2Wi86=DxErfvf+SCB2UKmU2amKOF60BKuJOX=w-RojRn0A@mail.gmail.com  

M contrib/intarray/_intbig_gist.c

Add missing const qualifier

commit   : 40b3af72a787e5c7c842651a2e04e3f856b9460c    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 13 Jul 2023 22:34:52 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 13 Jul 2023 22:34:52 +0900    

Click here for diff

Missed in commit 785480c9533d9.  
  
Pointed out by Tom Lane.  
  
Discussion: https://postgr.es/m/2795364.1689221300%40sss.pgh.pa.us  

M src/backend/parser/parse_expr.c

Fix code indentation violation in commit b6e1157e7d

commit   : 328f492d2565cfbe383f13a69425d751fd79415f    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 13 Jul 2023 22:20:40 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 13 Jul 2023 22:20:40 +0900    

Click here for diff

Per buildfarm member koel via Andrew Dunstan.  

M src/backend/parser/parse_expr.c

Fix untranslatable log message assembly

commit   : e1c83e7b964f45aa39818134f8a2d46f2d03a38d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jul 2023 12:56:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jul 2023 12:56:35 +0200    

Click here for diff

We can't inject the name of the logical replication worker into a log  
message like that.  But for these messages we don't really need the  
precision of knowing what kind of worker it was, so just write  
"logical replication worker" and keep the message in one piece.  
  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPt1xwATviPGjjtJy5L631SGf3qjV9XUCmxLu16cHamfgg%40mail.gmail.com  

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

Remove duplicated assignment of LLVMJitHandle->lljit

commit   : ccfca8ea42b8be09a509f68564f6ee13859285b1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Jul 2023 16:44:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Jul 2023 16:44:17 +0900    

Click here for diff

This duplicated assignment when emiting some code not yet compiled.  
  
Oversight in 6c57f2e.  
  
Author: Matheus Alcantara  
Reviewed-by: Gurjeet Singh  
Discussion: https://postgr.es/m/La1Tfi7wirg9uGbCx_y7Qb9kl2T15mYouDXjCKAFuDqzQWnTRwH7KNLGigLLcxRs91V6dp2ySs1j_7mB4btzEZJ9NIMEAyOjUyAS7Jx-ydQ=@pm.me  

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

Doc: clarify the conditions of usable indexes for REPLICA IDENTITY FULL tables.

commit   : fd48a86c6241b994ce67c8b53a918e6b42c8063c    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 13 Jul 2023 15:03:17 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 13 Jul 2023 15:03:17 +0900    

Click here for diff

Commit 89e46da5e allowed REPLICA IDENTITY FULL tables to use an index  
on the subscriber during apply of update/delete. This commit clarifies  
in the documentation that the leftmost field of candidate indexes must  
be a column (not an expression) that references the published relation  
column.  
  
The source code comments are also updated accordingly.  
  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDJjffEvUFKXT27Q5U8-UU9JHv4rrJ9Ke8Zkc5UPWHLvA@mail.gmail.com  
Backpatch-through: 16  

M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c

Rename session_auth_is_superuser to current_role_is_superuser.

commit   : 0fef8775382886bef023aee67cb744711ed7a32f    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 12 Jul 2023 21:28:54 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 12 Jul 2023 21:28:54 -0700    

Click here for diff

This variable might've been accurately named when it was added in  
ea886339b8, but the name hasn't been accurate since at least the  
introduction of SET ROLE in e5d6b91220.  The corresponding  
documentation was fixed in eedb068c0a.  This commit renames the  
variable accordingly.  
  
Suggested-by: Joseph Koshakow  
Discussion: https://postgr.es/m/CAAvxfHc-HHzONQ2oXdvhFF9ayRnidPwK%2BfVBhRzaBWYYLVQL-g%40mail.gmail.com  

M src/backend/access/transam/parallel.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc.h

Teach in-tree getopt_long() to move non-options to the end of argv.

commit   : 411b720343005597d042fc1736ce9a3a3ee8a1fe    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 12 Jul 2023 20:34:39 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 12 Jul 2023 20:34:39 -0700    

Click here for diff

Unlike the other implementations of getopt_long() I could find, the  
in-tree implementation does not reorder non-options to the end of  
argv.  Instead, it returns -1 as soon as the first non-option is  
found, even if there are other options listed afterwards.  By  
moving non-options to the end of argv, getopt_long() can parse all  
specified options and return -1 when only non-options remain.  
This quirk is periodically missed by hackers (e.g., 869aa40a27,  
ffd398021c, and d9ddc50baf).  This commit introduces the  
aforementioned non-option reordering behavior to the in-tree  
getopt_long() implementation.  
  
Special thanks to Noah Misch for his help verifying behavior on  
AIX.  
  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20230609232257.GA121461%40nathanxps13  

M src/bin/scripts/t/040_createuser.pl
M src/port/getopt_long.c

Don't include CaseTestExpr in JsonValueExpr.formatted_expr

commit   : b6e1157e7d339c4e20d68448125a4cef42b1ac9d    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 7 Jul 2023 20:21:58 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 7 Jul 2023 20:21:58 +0900    

Click here for diff

A CaseTestExpr is currently being put into  
JsonValueExpr.formatted_expr as placeholder for the result of  
evaluating JsonValueExpr.raw_expr, which in turn is evaluated  
separately.  Though, there's no need for this indirection if  
raw_expr itself can be embedded into formatted_expr and evaluated  
as part of evaluating the latter, especially as there is no  
special reason to evaluate it separately.  So this commit makes it  
so.  As a result, JsonValueExpr.raw_expr no longer needs to be  
evaluated in ExecInterpExpr(), eval_const_exprs_mutator() etc. and  
is now only used for displaying the original "unformatted"  
expression in ruleutils.c.  
  
While at it, this also removes the function makeCaseTestExpr(),  
because the code in makeJsonConstructorExpr() looks more readable  
without it IMO and isn't used by anyone else either.  
  
Finally, a note is added in the comment above CaseTestExpr's  
definition that JsonConstructorExpr is also using it.  
  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/nodes/makefuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_expr.c
M src/include/nodes/primnodes.h

Pass constructName to transformJsonValueExpr()

commit   : 785480c9533d9a905410c1a52f857a431daec37c    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 7 Jul 2023 12:08:58 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 7 Jul 2023 12:08:58 +0900    

Click here for diff

This allows it to pass to coerce_to_specific_type() the actual name  
corresponding to the specific JSON_* function expression being  
transformed, instead of the currently hardcoded string.  
  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/parser/parse_expr.c

commit   : c17164aec88cfa2d1b949e76e05e4ebafd74936c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Jul 2023 09:09:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Jul 2023 09:09:04 +0900    

Click here for diff

The first check on the enum values was not necessary as the values set  
in wait_event_names.txt for the classes LWLock and Lock were able to  
satisfy the check.  The second check when generating the C and header  
files is now based on a match of the class names, making it simpler to  
understand.  
  
Author: Masahiro Ikeda, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/generate-wait_event_types.pl

meson: Tie adding C++ support to the llvm Meson option

commit   : 7a7f13afee9229fe738c390d39aa44c394400c04    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    

Click here for diff

In the event the llvm option is defined to be 'auto', it is possible  
that the host machine might not have a C++ compiler. If that is the  
case, then we shouldn't continue reaching for the llvm dependency.  
  
To make it easier to understand the case where LLVM support is disabled due to  
lacking a C++ compiler, add a message noting that fact.  
  
Author: Tristan Partin <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  
Backpatch: 16-, where meson support was added  

M meson.build

meson: Pass more feature option through to required kwargs

commit   : 47caa710cebe386c1ab0de89c2a9ff286c9bcb2a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    

Click here for diff

That was already done in a lot of places, but not all.  
  
Backpatch this to keep the the meson files aligned as long as reasonably  
possible.  
  
Author: Tristan Partin <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  
Backpatch: 16-, where meson support was added  

M meson.build

pg_bsd_indent: Collect test diffs in test.diffs instead of tests.diff

commit   : 2eaa54dde21058f31fd6c9169344d8ed18342250    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:02 -0700    

Click here for diff

That way CI knows to pick up the file if the test fails.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-, where the test was added  

M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl

doc: Clarify the errhint example

commit   : e68dd9e9073521235bf71be3f9d7028492bd3bbc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 12 Jul 2023 19:38:51 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 12 Jul 2023 19:38:51 +0200    

Click here for diff

The errhint example wasn't using the mandated style for errhint  
which was needlessly confusing.  Fix by rewriting it using the  
mandated style.  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Gurjeet Singh <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/sources.sgml

parallel_schedule: add comment on event_trigger test dependency

commit   : c8e43c22be271096809e561482084c6fb83e0708    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jul 2023 18:46:27 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jul 2023 18:46:27 +0200    

Click here for diff

This is cosmetic, so no backpatch.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  

M src/test/regress/parallel_schedule

Remove ancient special case code for dropping oid columns

commit   : 7ef2912519fdea0dd0f6747c4dc008c99dc51e90    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    

Click here for diff

The special handling of negative attribute numbers in  
RemoveAttributeById() was introduced to support SET WITHOUT OIDS  
(commit 24614a9880).  But that feature doesn't exist anymore, so we  
can revert to the previous, simpler version.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/heap.c

Remove ancient special case code for adding oid columns

commit   : 5eaa0e92ee2f94994c55c02d01b3feabc6c35f54    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    

Click here for diff

The special handling of negative attribute numbers in  
ATExecAddColumn() was introduced to support SET WITH OIDS (commit  
6d1e361852).  But that feature doesn't exist anymore, so we can revert  
to the previous, simpler version.  In passing, also remove an obsolete  
comment about OID support.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Remove obsolete comment about OID support

commit   : adf333b4edb24fc9134fd76cd6c2d65f9a89c3a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 16:12:34 +0200    

Click here for diff

Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/heap.c

Allow some exclusion constraints on partitions

commit   : 8c852ba9a4347c4778cc610ad5a9cb50ea701b5c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 09:24:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jul 2023 09:24:43 +0200    

Click here for diff

Previously we only allowed unique B-tree constraints on partitions  
(and only if the constraint included all the partition keys).  But we  
could allow exclusion constraints with the same restriction.  We also  
require that those columns be compared for equality, not something  
like &&.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Ronan Dunklau <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/btree_gist/Makefile
A contrib/btree_gist/expected/partitions.out
M contrib/btree_gist/meson.build
A contrib/btree_gist/sql/partitions.sql
M doc/src/sgml/ddl.sgml
M src/backend/commands/indexcmds.c
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/indexing.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql

Doc: Adjust libpq docs about thread safety.

commit   : ce0b0fa3e792cefc3ce325b10af224edbbf68ce7    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 12 Jul 2023 08:57:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 12 Jul 2023 08:57:55 +1200    

Click here for diff

Describe the situation now that --disable-thread-safety is gone.  
  
Author: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com  

M doc/src/sgml/libpq.sgml

commit   : 68a4b58eca032916e2aad78d63f717dcb147e906    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 12 Jul 2023 06:20:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 12 Jul 2023 06:20:37 +1200    

Click here for diff

All supported computers have either POSIX or Windows threads, and we no  
longer have any automated testing of --disable-thread-safety.  We define  
a vestigial ENABLE_THREAD_SAFETY macro to 1 in ecpg_config.h in case it  
is useful, but we no longer test it anywhere in PostgreSQL code, and  
associated dead code paths are removed.  
  
The Meson and perl-based Windows build scripts never had an equivalent  
build option.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/installation.sgml
M meson.build
M src/Makefile.global.in
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.in
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg-pthread-win32.h
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/descriptor.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-int.h
M src/makefiles/meson.build
M src/tools/msvc/Solution.pm
M src/tools/msvc/ecpg_regression.proj

pgbench: Move constant into format string

commit   : 11f36694091c97318e5a2bd28b35ffe9aa1c3b6a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 11 Jul 2023 14:01:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 11 Jul 2023 14:01:00 +0900    

Click here for diff

As coded, the row data strings generated for pgbench_accounts' COPY in  
the client-side data generation were always assigning 0 for one of its  
attributes.  This simplifies a bit an upcoming patch to switch  
client-side data generation of pgbench to use COPY for the teller and  
branch tables, rather than individual INSERTs.  
  
Author: Tristan Partin  
Discussion: https://postgr.es/m/CSTU5P82ONZ1.19XFUGHMXHBRY@c3po  

M src/bin/pgbench/pgbench.c

Report index vacuum progress.

commit   : 46ebdfe164c61fbac961d1eb7f40e9a684289ae6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 11 Jul 2023 12:34:01 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 11 Jul 2023 12:34:01 +0900    

Click here for diff

This commit adds two columns: indexes_total and indexes_processed, to  
pg_stat_progress_vacuum system view to show the index vacuum  
progress. These numbers are reported in the "vacuuming indexes" and  
"cleaning up indexes" phases.  
  
This uses the new parallel message type for progress reporting added  
by be06506e7.  
  
Bump catversion because this changes the definition of  
pg_stat_progress_vacuum.  
  
Author: Sami Imseih  
Reviewed by: Masahiko Sawada, Michael Paquier, Nathan Bossart, Andres Freund  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/system_views.sql
M src/backend/commands/vacuumparallel.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Add new parallel message type to progress reporting.

commit   : f1889729dd3ab0352dc0ccc2ffcc1b1901f8e39f    
  
author   : Masahiko Sawada <[email protected]>    
date     : Tue, 11 Jul 2023 12:33:54 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Tue, 11 Jul 2023 12:33:54 +0900    

Click here for diff

This commit adds a new type of parallel message 'P' to allow a  
parallel worker to poke at a leader to update the progress.  
  
Currently it supports only incremental progress reporting but it's  
possible to allow for supporting of other backend progress APIs in the  
future.  
  
There are no users of this new message type as of this commit. That  
will follow in future commits.  
  
Idea from Andres Freund.  
  
Author: Sami Imseih  
Reviewed by: Michael Paquier, Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/utils/activity/backend_progress.c
M src/include/utils/backend_progress.h

Add BEGIN/COMMIT for transactional messages during decoding.

commit   : 26dd0284b98f6bf730dc1f7f7e1f917525d71eda    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Jul 2023 08:31:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Jul 2023 08:31:11 +0530    

Click here for diff

In test_decoding module, when skip_empty_xacts option was specified, add  
BEGIN/COMMIT for transactional messages. This makes the handling of  
transactional messages consistent irrespective of whether skip_empty_xacts  
option was specified.  
  
We decided not to backpatch this change because skip_empty_xacts is  
primarily used to have consistent test results across different runs and  
this change won't help with that.  
  
Author: Vignesh C  
Reviewed-by: Ashutosh Bapat, Hou Zhijie  
Discussion: https://postgr.es/m/CAExHW5ujRhbOz6_aTq_jQA8NjeFqq9d_8G9viShWvXx8gdSXiQ@mail.gmail.com  

M contrib/test_decoding/expected/messages.out
M contrib/test_decoding/sql/messages.sql
M contrib/test_decoding/test_decoding.c

Don't expose Windows' mbstowcs_l() and wcstombs_l().

commit   : 4e9fa6d56b3e4e1b6238fb24200e6baece229401    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 11 Jul 2023 09:34:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 11 Jul 2023 09:34:22 +1200    

Click here for diff

Windows has similar functions with leading underscores.  Previously, we  
provided the rename via a macro in win32_port.h.  In fact its functions  
are not always good replacements for the Unix functions, since they  
can't deal with UTF-8.  They are only currently used by pg_locale.c,  
which is careful to redirect to other Windows routines for UTF-8.  Given  
that portability hazard, it seem unlikely to be a good idea to encourage  
any other code to think of these functions as being available outside  
pg_locale.c.  Any code that thinks it wants these functions probably  
wants our wchar2char() or char2wchar() routines instead, or it won't  
actually work on Windows in UTF-8 databases.  
  
Furthermore, some major libc implementations including glibc don't have  
them (they only have the standard variants without _l), so external code  
is very unlikely to require them to exist.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2Bt_CHPzEoPnKyARJBJgE9-GxNajJo6ZuSfRK_KWFO%2B6w%40mail.gmail.com  

M src/backend/utils/adt/pg_locale.c
M src/include/port/win32_port.h

Be more rigorous about local variables in PostgresMain().

commit   : a8b7424684b3e9634703d1974c6b45805ac86b5d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2023 12:14:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jul 2023 12:14:34 -0400    

Click here for diff

Since PostgresMain calls sigsetjmp, any local variables that are not  
marked "volatile" have a risk of unspecified behavior.  In practice  
this means that when control returns via longjmp, such variables might  
get reset to their values as of the time of sigsetjmp, depending on  
whether the compiler chose to put them in registers or on the stack.  
We were careful about this for "send_ready_for_query", but not the  
other local variables.  
  
In the case of the timeout_enabled flags, resetting them to  
their initial "false" states is actually good, since we do  
"disable_all_timeouts()" in the longjmp cleanup code path.  If that  
does not happen, we risk uselessly calling "disable_timeout()" later,  
which is harmless but a little bit expensive.  Let's explicitly reset  
these flags so that the behavior is correct and platform-independent.  
(This change means that we really don't need the new "volatile"  
markings after all, but let's install them anyway since any change  
in this logic could re-introduce a problem.)  
  
There is no issue for "firstchar" and "input_message" because those  
are explicitly reinitialized each time through the query processing  
loop.  To make that clearer, move them to be declared inside the loop.  
That leaves us with all the function-lifespan locals except the  
sigjmp_buf itself marked as volatile, which seems like a good policy  
to have going forward.  
  
Because of the possibility of extra disable_timeout() calls, this  
seems worth back-patching.  
  
Sergey Shinderuk and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

Fix pgindent

commit   : a44d96add2eb377ab70055a54b713c5c78380383    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jul 2023 12:05:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jul 2023 12:05:32 +0200    

Click here for diff

for commit e53a611523  

M src/backend/tcop/utility.c

Message wording improvements

commit   : e53a611523af0195d7025b979d29ea4d166ad762    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jul 2023 10:46:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jul 2023 10:46:54 +0200    

Click here for diff

M src/backend/access/common/reloptions.c
M src/backend/backup/basebackup_zstd.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/tablecmds.c
M src/backend/libpq/auth.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/misc/guc_tables.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out

Add more sanity checks with callers of changeDependencyFor()

commit   : 9b286858e3ab1647304c5fbb2b1529de6bead8f7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 10 Jul 2023 13:08:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 10 Jul 2023 13:08:10 +0900    

Click here for diff

changeDependencyFor() returns the number of pg_depend entries changed,  
or 0 if there is a problem.  The callers of this routine expect only one  
dependency to change, but they did not check for the result returned.  
The following code paths gain checks:  
- Namespace for extensions.  
- Namespace for various object types (see AlterObjectNamespace).  
- Planner support function for a function.  
  
Some existing error messages related to all that are reworded to be more  
consistent with the project style, and the new error messages added  
follow the same style.  This change has exposed one bug fixed a bit  
earlier with bd5ddbe.  
  
Reviewed-by: Heikki Linnakangas, Akshat Jaimini  
Discussion: https://postgr.es/m/ZJzD/[email protected]  

M src/backend/commands/alter.c
M src/backend/commands/cluster.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c

Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema

commit   : bd5ddbe8666a11e34ba77e4c1788c4832dcd9a50    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 10 Jul 2023 09:40:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 10 Jul 2023 09:40:07 +0900    

Click here for diff

As coded, the code would use as a base comparison the namespace OID from  
the first object scanned in pg_depend when switching its namespace  
dependency entry to the new one, and use it as a base of comparison for  
any follow-up checks.  It would also be used as the old namespace OID to  
switch *from* for the extension's pg_depend entry.  Hence, if the first  
object scanned has a namespace different than the one stored in the  
extension, we would finish by:  
- Not checking that the extension objects map with the extension's  
schema.  
- Not switching the extension -> namespace dependency entry to the new  
namespace provided by the user, making ALTER EXTENSION ineffective.  
  
This issue exists since this command has been introduced in d9572c4 for  
relocatable extension, so backpatch all the way down to 11.  The test  
case has been provided by Heikki, that I have tweaked a bit to show the  
effects on pg_depend for the extension.  
  
Reported-by: Heikki Linnakangas  
Author: Michael Paquier, Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql

doc: Use proper markup for emphasis

commit   : 3c963d33eae8dcbac0bc2e1dc0b7c1ac931dd83f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 10:02:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 10:02:15 +0200    

Click here for diff

M doc/src/sgml/config.sgml

doc: Move DEFAULT parameter on COPY reference page

commit   : be2ab58f6227ef8ea341c3d9b9f99d53d56529a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 09:46:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 09:46:24 +0200    

Click here for diff

The DEFAULT parameter seems most similar to the NULL parameter, so  
move it next to it, instead of having it at the end of the parameter  
list because it was the last one added.  

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

Remove unnecessary unbind in LDAP search+bind mode

commit   : f8d03ea727e48c894174c4e5e6ebafc3a17ab3f7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 08:22:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 9 Jul 2023 08:22:34 +0200    

Click here for diff

Comments in src/backend/libpq/auth.c say: (after successfully finding  
the final DN to check the user-supplied password against)  
  
/* Unbind and disconnect from the LDAP server */  
  
and later  
  
/*  
 * Need to re-initialize the LDAP connection, so that we can bind to  
 * it with a different username.  
 */  
  
But the protocol actually permits multiple subsequent authentications  
("binds") over a single connection.  
  
So, it seems like the whole connection re-initialization thing was  
just a confusion and can be safely removed, thus saving quite a few  
network round-trips, especially for the case of ldaps/starttls.  
  
Author: Anatoly Zaretsky <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CALbq6kmJ-1+58df4B51ctPfTOSyPbY8Qi2=ct8oR=i4TamkUoQ@mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c

Rename port/thread.c to port/user.c.

commit   : 89333db963af20988fc407463ea626b1c41404e8    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 18:12:28 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 18:12:28 +1200    

Click here for diff

Historically this module dealt with thread-safety of system interfaces,  
but now all that's left is wrapper code for user name and home directory  
lookup.  Arguably the Windows variants of this logic could be moved in  
here too, to justify its presence under port.  For now, just tidy up  
some obsolete references to multi-threading, and give the file a  
meaningful name.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com  

M configure
M configure.ac
M src/bin/psql/nls.mk
M src/include/port.h
M src/interfaces/libpq/nls.mk
M src/port/Makefile
M src/port/meson.build
R088 src/port/thread.c src/port/user.c

Doc: update old reference to "result cache"

commit   : c23e7ea4d6a44cd0f6948d362a8477f14a3f849c    
  
author   : David Rowley <[email protected]>    
date     : Sun, 9 Jul 2023 16:14:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 9 Jul 2023 16:14:00 +1200    

Click here for diff

During the PostgreSQL 14 cycle, the Memoize executor node was briefly  
called "Result Cache" until it was renamed in 83f4fcc65.  That commit  
missed one reference.  
  
Reported-by: Paul A Jungwirth  
Packpatch-through: 14, where Memoize was added  
Discussion: https://postgr.es/m/CA+renyX=40YXhsfPTzn13oNOPO3TJ12CK9GX-2P2pvnQiScefA@mail.gmail.com  

M doc/src/sgml/config.sgml

Remove obsolete comment and code from fe-auth.c.

commit   : 1aadc504bf47ade96178b98fe80803f244c1ee28    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 15:52:28 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 15:52:28 +1200    

Click here for diff

We don't use getpwuid() anymore (see commit e757cdd6), so we don't need  
locking around pg_get_user_name().  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com  

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

All supported systems have locale_t.

commit   : 8d9a9f034e925568342c7ccfd8d351a3cd20e7f3    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 11:55:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 9 Jul 2023 11:55:03 +1200    

Click here for diff

locale_t is defined by POSIX.1-2008 and SUSv4, and available on all  
targeted systems.  For Windows, win32_port.h redirects to a partial  
implementation called _locale_t.  We can now remove a lot of  
compile-time tests for HAVE_LOCALE_T, and associated comments and dead  
code branches that were needed for older computers.  
  
Since configure + MinGW builds didn't detect locale_t but now we assume  
that all systems have it, further inconsistencies among the 3 Windows build  
systems were revealed.  With this commit, we no longer define  
HAVE_WCSTOMBS_L and HAVE_MBSTOWCS_L on any Windows build system, but  
we have logic to deal with that so that replacements are available where  
appropriate.  
  
Reviewed-by: Noah Misch <[email protected]>  
Reviewed-by: Tristan Partin <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLg7_T2GKwZFAkEf0V7vbnur-NfCjZPKZb%3DZfAXSV1ORw%40mail.gmail.com  

M config/c-library.m4
M configure
M meson.build
M src/backend/commands/collationcmds.c
M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/pg_locale.c
M src/include/pg_config.h.in
M src/include/utils/pg_locale.h
M src/tools/msvc/Solution.pm

Fix tmpdir issues with commit e213de8e78

commit   : e9f15bc9db7564a29460d089c0917590bc13fffc    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 8 Jul 2023 12:34:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 8 Jul 2023 12:34:25 -0400    

Click here for diff

Commit e213de8e78 fixed a problem with path lengths to a tempdir on  
Windows, but caused problems on at least some Unix systems where the  
system tempdir is on a different file system. To work around this, only  
used the system temdir for the destination of pg_replslot on Windows,  
and otherwise restore the old behaviour.  
  
Backpatch to relase 14 like the previous patch.  
  
Problem exposed by a myriad of buildfarm animals.  

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

Use shorter location for pg_replslot in pg_basebackup test

commit   : e213de8e785aac4e2ebc44282b8dc0fcc74834e8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 8 Jul 2023 11:21:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 8 Jul 2023 11:21:58 -0400    

Click here for diff

The symlink to a longer location tripped up some Windows limit on  
buildfarm animal fairywren when running with meson, which uses slightly  
longer paths.  
  
Backpatch to release 14 to keep the script in sync. Before that the  
script skipped all symlink related tests on Windows.  

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

Fix Perl warning

commit   : 6ee01e25b7f79bdf835d12927b306ad922c55fd3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 8 Jul 2023 17:24:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 8 Jul 2023 17:24:41 +0200    

Click here for diff

Use of uninitialized value $content in concatenation (.) or string  

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

Make some indentation in gram.y consistent

commit   : 5edf438eeb00271cca5d19d0ea10a2d6e8d018c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    

Click here for diff

Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/parser/gram.y

test_extensions: sync meson.build with Makefile.

commit   : 9f6253613e8857942b1928bd7163bc1529fc9c69    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 7 Jul 2023 11:39:19 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 7 Jul 2023 11:39:19 -0700    

Click here for diff

Makefile does not specify ENCODING, meson.build should not,  
either. Oversight in commit 877bf52cff.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Michael Paquier  

M src/test/modules/test_extensions/meson.build

Revert MAINTAIN privilege and pg_maintain predefined role.

commit   : 151c22deee66a3390ca9a1c3675e29de54ae73fc    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 7 Jul 2023 11:25:13 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 7 Jul 2023 11:25:13 -0700    

Click here for diff

This reverts the following commits: 4dbdb82513, c2122aae63,  
5b1a879943, 9e1e9d6560, ff9618e82a, 60684dd834, 4441fc704d,  
and b5d6382496.  A role with the MAINTAIN privilege may be able to  
use search_path tricks to escalate privileges to the table owner.  
Unfortunately, it is too late in the v16 development cycle to apply  
the proposed fix, i.e., restricting search_path when running  
maintenance commands.  
  
Bumps catversion.  
  
Reviewed-by: Jeff Davis  
Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org  
Backpatch-through: 16  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/commands/tablecmds.h
M src/include/commands/vacuum.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/test/isolation/expected/cluster-conflict-partition.out
M src/test/isolation/specs/cluster-conflict-partition.spec
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/regress/expected/cluster.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/cluster.sql
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/privileges.sql

Document relaxed HOT for summarizing indexes

commit   : ec99d6e9c87a8ff0f4805cc0c6c12cbb89c48e06    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 7 Jul 2023 19:04:32 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 7 Jul 2023 19:04:32 +0200    

Click here for diff

Commit 19d8e2308b allowed a weaker check for HOT with summarizing  
indexes, but it did not update README.HOT. So do that now.  
  
Patch by Matthias van de Meent, minor changes by me. Backpatch to 16,  
where the optimization was introduced.  
  
Author: Matthias van de Meent  
Reviewed-by: Tomas Vondra  
Backpatch-through: 16  
Discussion: https://postgr.es/m/CAEze2WiEOm8V+c9kUeYp2BPhbEc5s473fUf51xNeqvSFGv44Ew@mail.gmail.com  

M src/backend/access/heap/README.HOT

Fix some comments in ./configure and meson setup files

commit   : da98d005cdbcd45af563d0c4ac86d0e9772cd15f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jul 2023 13:59:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jul 2023 13:59:41 +0900    

Click here for diff

The comments referring to SSL_CTX_set_cert_cb() in ./configure and  
./configure.ac were inconsistent, as `autoreconf -i` would show.  While  
on it, fix a typo on a comment related to the same check in  
meson.build.  
  
Issue introduced in 8e278b6, that removed support for OpenSSL 1.0.1.  
Per offlist report from Thomas Munro.  

M configure
M configure.ac
M meson.build

pg_regress: Remove unused variable

commit   : f863d82b2f9801c556882ca92b519982a82133e3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 6 Jul 2023 21:21:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 6 Jul 2023 21:21:37 +0200    

Click here for diff

The restrictedToken handle was set but never read, so remove the  
variable and change to a boolean style check to match other uses  
of CreateRestrictedProcess().  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Fix type of iterator variable in SH_START_ITERATE

commit   : f0a94d81e4f7d3402d4b3a6b05b7b749ff23fe54    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Jul 2023 08:34:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Jul 2023 08:34:17 -0700    

Click here for diff

Also add comment to make the reasoning behind the Assert() more explicit (per  
Tom).  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAocXNJ6s1VLz+hMamLAQAiewRoW17OJ6-+9GACKfj6iPQ@mail.gmail.com  
Backpatch: 11-  

M src/include/lib/simplehash.h

Skip pg_baseback long filename test if path too long on Windows

commit   : 1fa25ce70f0901b5b55b1fe9ca10cb3b9905db97    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 6 Jul 2023 12:27:40 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 6 Jul 2023 12:27:40 -0400    

Click here for diff

On Windows, it's sometimes difficult to create a file with a path longer  
than 255 chars, and if it can be created it might not be seen by the  
archiver. This can be triggered by the test for tar backups with  
filenames greater than 100 bytes. So we skip that test if the path would  
exceed 255.  
  
Backpatch to all live branches.  
  
Reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

WAL-log the creation of the init fork of unlogged indexes.

commit   : 3142a8845b44699761e41955a4e97ccee07c3734    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jul 2023 17:25:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jul 2023 17:25:29 +0300    

Click here for diff

We create a file, so we better WAL-log it. In practice, all the  
built-in index AMs and all extensions that I'm aware of write a  
metapage to the init fork, which is WAL-logged, and replay of the  
metapage implicitly creates the fork too. But if ambuildempty() didn't  
write any page, we would miss it.  
  
This can be seen with dummy_index_am. Set up replication, create a  
'dummy_index_am' index on an unlogged table, and look at the files  
created in the replica: the init fork is not created on the  
replica. Dummy_index_am doesn't do anything with the relation files,  
however, so it doesn't lead to any user-visible errors.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9%40iki.fi  

M src/backend/catalog/index.c

Fix code indentation vioaltion introduced in commit cc32ec24fd.

commit   : 69a674a170058e63e8178aec8a36a673efce8801    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 6 Jul 2023 11:49:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 6 Jul 2023 11:49:18 +0530    

Click here for diff

Per buildfarm member koel  
  
Discussion: https://postgr.es/m/CAA4eK1K2Y_iegdXRUNbsghY9+b-4cSOrxYt9T8TtwXkkdWMVJA@mail.gmail.com  

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

Add GUC parameter "huge_pages_status"

commit   : a14354cac0e32d5e169c1ea4225845f93922d483    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 14:42:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 14:42:36 +0900    

Click here for diff

This is useful to show the allocation state of huge pages when setting  
up a server with "huge_pages = try", where allocating huge pages would  
be attempted but the server would continue its startup sequence even if  
the allocation fails.  The effective status of huge pages is not easily  
visible without OS-level tools (or for instance, a lookup at  
/proc/N/smaps), and the environments where Postgres runs may not  
authorize that.  Like the other GUCs related to huge pages, this works  
for Linux and Windows.  
  
This GUC can report as values:  
- "on", if huge pages were allocated.  
- "off", if huge pages were not allocated.  
- "unknown", a special state that could only be seen when using for  
example postgres -C because it is only possible to know if the shared  
memory allocation worked after we can check for the GUC values, even if  
checking a runtime-computed GUC.  This value should never be seen when  
querying for the GUC on a running server.  An assertion is added to  
check that.  
  
The discussion has also turned around having a new function to grab this  
status, but this would have required more tricks for -DEXEC_BACKEND,  
something that GUCs already handle.  
  
Noriyoshi Shinoda has initiated the thread that has led to the result of  
this commit.  
  
Author: Justin Pryzby  
Reviewed-by: Nathan Bossart, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/config.sgml
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/misc/guc_tables.c
M src/include/storage/pg_shmem.h
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/005_sspi.pl

Add newline at the end of header generated by generate-wait_event_types.pl

commit   : cf05113eb0da0b65fdeaf79db0c6c27b82d3c869    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 13:35:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 13:35:50 +0900    

Click here for diff

The header file wait_event_types.h was generated without a newline at  
its end, which was inconsistent with all the other things generated  
automatically.  
  
Per offline gripe from Nathan Bossart.  

M src/backend/utils/activity/generate-wait_event_types.pl

commit   : cc32ec24fdf3b9808617439d41b0ba7f3eb16b04    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 6 Jul 2023 08:52:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 6 Jul 2023 08:52:10 +0530    

Click here for diff

This commit reverts the work done by commits 3ba59ccc89 and 72e78d831a.  
Those commits were incorrect in asserting that we never acquire any other  
heavy-weight lock after acquring page lock other than relation extension  
lock. We can acquire a lock on catalogs while doing catalog look up after  
acquring page lock.  
  
This won't impact any existing feature but we need to think some other way  
to achieve this before parallelizing other write operations or even  
improving the parallelism in vacuum (like allowing multiple workers  
for an index).  
  
Reported-by: Jaime Casanova  
Author: Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAJKUy5jffnRKNvRHKQ0LynRb0RJC-o4P8Ku3x9vGAVLwDBWumQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/backend/storage/lmgr/README
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c

Handle \v as a whitespace character in parsers

commit   : ae6d06f09684d8f8a7084514c9b35a274babca61    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 08:16:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jul 2023 08:16:24 +0900    

Click here for diff

This commit comes as a continuation of the discussion that has led to  
d522b05, as \v was handled inconsistently when parsing array values or  
anything going through the parsers, and changing a parser behavior in  
stable branches is a scary thing to do.  The parsing of array values now  
uses the more central scanner_isspace() and array_isspace() is removed.  
  
As pointing out by Peter Eisentraut, fix a confusing reference to  
horizontal space in the parsers with the term "horiz_space".  \f was  
included in this set since 3cfdd8f from 2000, but it is not horizontal.  
"horiz_space" is renamed to "non_newline_space", to refer to all  
whitespace characters except newlines.  
  
The changes impact the parsers for the backend, psql, seg, cube, ecpg  
and replication commands.  Note that JSON should not escape \v, as per  
RFC 7159, so these are not touched.  
  
Reviewed-by: Peter Eisentraut, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/cubescan.l
M contrib/hstore/expected/hstore_utf8.out
M contrib/hstore/sql/hstore_utf8.sql
M contrib/seg/segscan.l
M src/backend/parser/parse_type.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/replication/repl_scanner.l
M src/backend/utils/adt/arrayfuncs.c
M src/bin/psql/psqlscanslash.l
M src/fe_utils/psqlscan.l
M src/fe_utils/string_utils.c
M src/interfaces/ecpg/preproc/pgc.l

Fix leak of LLVM "fatal-on-oom" section counter.

commit   : 4f4d73466d71976b58f29121bab9d9fef6f3436e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 5 Jul 2023 13:13:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 5 Jul 2023 13:13:13 +0300    

Click here for diff

llvm_release_context() called llvm_enter_fatal_on_oom(), but was missing  
the corresponding llvm_leave_fatal_on_oom() call. As a result, if JIT was  
used at all, we were almost always in the "fatal-on-oom" state.  
  
It only makes a difference if you use an extension written in C++, and  
run out of memory in a C++ 'new' call. In that case, you would get a  
PostgreSQL FATAL error, instead of the default behavior of throwing a  
C++ exception.  
  
Back-patch to all supported versions.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

pg_waldump: Add test case for notice message

commit   : 088539015173a204839a53d1d0fc8fa8c96783ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 10:16:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 10:16:56 +0200    

Click here for diff

Add a test case for the "first record is after" message.  Also, this  
message should really go to stderr, so change to use pg_log_info.  
  
Reviewed-by: Tristen Raab <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAcByaKM7zyJSDkPWv6_%2BapupY4fXXM3q3SRXas9MMNVPUGcsQ%40mail.gmail.com  

M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/t/001_basic.pl

pg_waldump: Add more tests

commit   : 96063e28366b97da8c2ea02060acfea15fb7ffee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 10:16:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 10:16:56 +0200    

Click here for diff

This adds tests for most command-line options and tests for most  
rmgrdesc routines.  
  
Based on patch by Dong Wook Lee <[email protected]>.  
  
Reviewed-by: Tristen Raab <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAcByaKM7zyJSDkPWv6_%2BapupY4fXXM3q3SRXas9MMNVPUGcsQ%40mail.gmail.com  

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

Change example in pgindent README on "/*-----" comments.

commit   : 5e8068f04e13e12c182eca3e64ac4377e0c93a5d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 5 Jul 2023 10:02:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 5 Jul 2023 10:02:15 +0300    

Click here for diff

Most, but not all, of our "/*----" style comments have an end-guard  
line with dashes at the end of the comment. However, pgindent doesn't  
care about the end-guards, so they mostly just waste screen  
space. Going forward, let's not require end-guards.  
  
Remove a broken end-guard in a comment in walsender.c that led me to  
think about this. Remove the end guard from another comment in  
walsender.c for consistency, so that we use the same style in all  
comments in the file.  
  
However, we have thousands of existing "/*----" comments the repository,  
so it's not worth the code churn to change them all.  
  
Discussion: https://www.postgresql.org/message-id/fb083c91-d490-3b65-25f3-05e9118b6b0d%40iki.fi  

M src/backend/replication/walsender.c
M src/tools/pgindent/README

Rename EVT cache hash to make context name unique

commit   : a77d39d5f4b97c7d08e6786429d69eae5baec48e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Jul 2023 08:53:09 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Jul 2023 08:53:09 +0200    

Click here for diff

BuildEventTriggerCache sets up a context "EventTriggerCache" which  
house a hash named "Event Trigger Cache", which in turn creates a  
context with the table name.  This generated log output for memory  
context dumps like below:  
  
LOG:  level: 2; EventTriggerCache: 8192 total in 1 blocks; 7928 free (4 chunks); 264 used  
LOG:  level: 3; Event Trigger Cache: 8192 total in 1 blocks; 2616 free (0 chunks); 5576 used  
  
This renames the hash to ensure that the hash context has a unique  
name for easier log reading and debugging.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgstat: fix subscription stats entry leak.

commit   : 68a59f9e99831cf05a746928a955781503232bbb    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 5 Jul 2023 14:49:46 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 5 Jul 2023 14:49:46 +0900    

Click here for diff

Commit 7b64e4b3 taught DropSubscription() to drop stats entry of  
subscription that is not associated with a replication slot for apply  
worker at DROP SUBSCRIPTION but missed covering the case where the  
subscription is not associated with replication slots for both apply  
worker and tablesync worker.  
  
Also add a test to verify that the stats for slot-less subscription is  
removed at DROP SUBSCRIPTION time.  
  
Backpatch down to 15.  
  
Author: Masahiko Sawada  
Reviewed-by: Nathan Bossart, Hayato Kuroda, Melih Mutlu, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoB71zkP7uPT7JDPsZcvp0749ExEQnOJxeNKPDFisHar+w@mail.gmail.com  
Backpatch-through: 15  

M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/026_stats.pl

Clean up command argument assembly

commit   : cccdbc5d95aca276789bbe28783f3e06f9a3ba9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 06:56:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jul 2023 06:56:37 +0200    

Click here for diff

Several commands internally assemble command lines to call other  
commands.  This includes initdb, pg_dumpall, and pg_regress.  (Also  
pg_ctl, but that is different enough that I didn't consider it here.)  
This has all evolved a bit organically, with fixed-size buffers, and  
various optional command-line arguments being injected with  
confusing-looking code, and the spacing between options handled in  
inconsistent ways.  Clean all this up a bit to look clearer and be  
more easily extensible with new arguments and options.  We start each  
command with printfPQExpBuffer(), and then append arguments as  
necessary with appendPQExpBuffer().  Also standardize on using  
initPQExpBuffer() over createPQExpBuffer() where possible.  pg_regress  
uses StringInfo instead of PQExpBuffer, but many of the same ideas  
apply.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dumpall.c
M src/test/regress/pg_regress.c

commit   : fa88928470b538c0ec0289e4d69ee12356c5a8ce    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Jul 2023 10:53:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Jul 2023 10:53:11 +0900    

Click here for diff

The documentation and the code is generated automatically from a new  
file called wait_event_names.txt, formatted in sections dedicated to  
each wait event class (Timeout, Lock, IO, etc.) with three tab-separated  
fields:  
- C symbol in enums  
- Format in the system views  
- Description in the docs  
  
Using this approach has several advantages, as we have proved to be  
rather bad in maintaining this area of the tree across the years:  
- The order of each item in the documentation and the code, which should  
be alphabetical, has become incorrect multiple times, and the script  
generating the code and documentation has a few rules to enforce that,  
making the maintenance a no-brainer.  
- Some wait events were added to the code, but not documented, so this  
cannot be missed now.  
- The order of the tables for each wait event class is enforced in the  
documentation (the input .txt file does so as well for clarity, though  
this is not mandatory).  
- Less code, shaving 1.2k lines from the tree, with 1/3 of the savings  
coming from the code, the rest from the documentation.  
  
The wait event types "Lock" and "LWLock" still have their own code path  
for their code, hence only the documentation is created for them.  These  
classes are listed with a special marker called WAIT_EVENT_DOCONLY in  
the input file.  
  
Adding a new wait event now requires only an update of  
wait_event_names.txt, with "Lock" and "LWLock" treated as exceptions.  
  
This commit has been tested with configure/Makefile, the CI and VPATH  
build.  clean, distclean and maintainer-clean were working fine.  
  
Author: Bertrand Drouvot, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
M doc/src/sgml/filelist.sgml
M doc/src/sgml/meson.build
M doc/src/sgml/monitoring.sgml
M src/backend/Makefile
M src/backend/storage/lmgr/lwlocknames.txt
A src/backend/utils/activity/.gitignore
M src/backend/utils/activity/Makefile
A src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/wait_event.c
A src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/adt/lockfuncs.c
M src/common/meson.build
M src/include/Makefile
M src/include/utils/.gitignore
M src/include/utils/meson.build
M src/include/utils/wait_event.h
M src/test/ssl/t/002_scram.pl
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Fix assertion failure in snapshot building

commit   : 48efb2302bea3b2af8b4bb865edcc70132ee4250    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 4 Jul 2023 17:36:13 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 4 Jul 2023 17:36:13 +0200    

Click here for diff

Clear any potential stale next_phase_at value from the snapshot  
builder which otherwise may trip an assertion check ensuring  
that there is no next_phase_at value.  
  
This can be reproduced by running 80 concurrent sessions like  
the below where $c is a loop counter (assumes there has been  
1..$c databases created) :  
  
  echo "  
    CREATE TABLE replication_example(id SERIAL PRIMARY KEY,  
                                     somedata int,  
                                     text varchar(120));  
    SELECT 'init' FROM  
      pg_create_logical_replication_slot('regression_slot_$c',  
                                         'test_decoding');  
    SELECT data FROM  
      pg_logical_slot_get_changes('regression_slot_$c', NULL,  
                                  NULL, 'include-xids', '0',  
                                  'skip-empty-xacts', '1');  
  " | psql -d regress_$c >>psql.log &  
  
Backpatch down to v16.  
  
Bug: #17695  
Author: Masahiko Sawada <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Reported-by: bowenshi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v16  

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

Ensure that creation of an empty relfile is fsync'd at checkpoint.

commit   : 4b4798e1384ce12e19a558708e66c829276cf8d7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Jul 2023 17:57:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Jul 2023 17:57:03 +0300    

Click here for diff

If you create a table and don't insert any data into it, the relation file  
is never fsync'd. You don't lose data, because an empty table doesn't have  
any data to begin with, but if you crash and lose the file, subsequent  
operations on the table will fail with "could not open file" error.  
  
To fix, register an fsync request in mdcreate(), like we do for mdwrite().  
  
Per discussion, we probably should also fsync the containing directory  
after creating a new file. But that's a separate and much wider issue.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Andres Freund, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/d47d8122-415e-425c-d0a2-e0160829702d%40iki.fi  

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

Remove incidental md5() function uses from several tests

commit   : 657f5f223e8fd9aa12d8d9fc473faecc267b9b7a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jul 2023 14:31:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jul 2023 14:31:57 +0200    

Click here for diff

This removes md5() function calls from these test suites:  
  
- bloom  
- test_decoding  
- isolation  
- recovery  
- subscription  
  
This covers all remaining test suites where md5() calls were just used  
to generate some random data and can be replaced by appropriately  
adapted sha256() calls.  This will eventually allow these tests to  
pass in OpenSSL FIPS mode (which does not allow MD5 use).  See also  
208bf364a9.  Unlike for the main regression tests, I didn't write a  
fipshash() wrapper here, because that would have been too repetitive  
and wouldn't really save much here.  In some cases it was easier to  
remove one layer of indirection by changing column types from text to  
bytea.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql
M contrib/bloom/t/001_wal.pl
M contrib/test_decoding/expected/concurrent_stream.out
M contrib/test_decoding/specs/concurrent_stream.spec
M src/test/isolation/specs/insert-conflict-specconflict.spec
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/029_on_error.pl

Allow Incremental Sorts on GiST and SP-GiST indexes

commit   : 625d5b3ca0968c1d8c080d5210f7209184c0d134    
  
author   : David Rowley <[email protected]>    
date     : Tue, 4 Jul 2023 23:08:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 4 Jul 2023 23:08:52 +1200    

Click here for diff

Previously an "amcanorderbyop" index would only be used when the index  
could provide sorted results which satisfied all query_pathkeys.  Here  
we relax this so that we also allow these indexes to be considered by the  
planner when they only provide partially sorted results.  This allows the  
planner to later consider making use of an Incremental Sort to satisfy the  
remaining pathkeys.  This change is particularly useful for KNN-type  
queries which contain a LIMIT clause and an additional ORDER BY clause for  
a non-indexed column.  
  
Author: Miroslav Bendik  
Reviewed-by: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAPoEpV0QYDtzjwamwWUBqyWpaCVbJV2d6qOD7Uy09bWn47PJtw%40mail.gmail.com  

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

libpq: Add support for Close on portals and statements

commit   : 28b5726561841556dc3e00ffe26b01a8107ee654    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 14:48:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 14:48:10 +0900    

Click here for diff

The following routines are added to libpq:  
PGresult *PQclosePrepared(PGconn *conn, const char *stmt);  
PGresult *PQclosePortal(PGconn *conn, const char *portal);  
int PQsendClosePrepared(PGconn *conn, const char *stmt);  
int PQsendClosePortal(PGconn *conn, const char *portal);  
  
The "send" routines are non-blocking versions of the two others.  
  
Close messages are part of the protocol but they did not have a libpq  
implementation.  And, having these routines is for instance useful with  
connection poolers as these can detect more easily Close messages  
than DEALLOCATE queries.  
  
The implementation takes advantage of what the Describe routines rely on  
for portals and statements.  Some regression tests are added in  
libpq_pipeline, for the four new routines, by closing portals and  
statements created already by the tests.  
  
Author: Jelte Fennema  
Reviewed-by: Jian He, Michael Paquier  
Discussion: https://postgr.es/m/CAGECzQTb4xFAopAVokudB+L62Kt44mNAL4Z9zZ7UTrs1TRFvWA@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/prepared.trace

Re-bin segment when memory pages are freed.

commit   : 03f80daac8cff257294108caf908fe0397c40e1a    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 4 Jul 2023 15:16:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 4 Jul 2023 15:16:34 +1200    

Click here for diff

It's OK to be lazy about re-binning memory segments when allocating,  
because that can only leave segments in a bin that's too high.  We'll  
search higher bins if necessary while allocating next time, and  
also eventually re-bin, so no memory can become unreachable that way.  
  
However, when freeing memory, the largest contiguous range of free pages  
might go up, so we should re-bin eagerly to make sure we don't leave the  
segment in a bin that is too low for get_best_segment() to find.  
  
The re-binning code is moved into a function of its own, so it can be  
called whenever free pages are returned to the segment's free page map.  
  
Back-patch to all supported releases.  
  
Author: Dongming Liu <[email protected]>  
Reviewed-by: Robert Haas <[email protected]> (earlier version)  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CAL1p7e8LzB2LSeAXo2pXCW4%2BRya9s0sJ3G_ReKOU%3DAjSUWjHWQ%40mail.gmail.com  

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

Remove trailing zero words from Bitmapsets

commit   : a8c09daa8bb1d741bb8b3d31a12752448eb6fb7c    
  
author   : David Rowley <[email protected]>    
date     : Tue, 4 Jul 2023 12:34:48 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 4 Jul 2023 12:34:48 +1200    

Click here for diff

Prior to this, Bitmapsets could contain trailing words which had no  
members set.  Many places in bitmapset.c had to loop over trailing words  
to check for empty words.  If we ensure we always remove these trailing  
zero words then we can perform various optimizations such as fast  
pathing bms_is_subset to return false when 'a' has more words than 'b'.  
A similar optimization is possible in bms_equal.  Both of these together  
can yield quite significant performance increases in the query planner  
when querying a partitioned table with around 100 or more partitions.  
  
While we're at it, since the minimum number of words a Bitmapset can  
contain is 1, we can make use of do/while loops instead of for loops  
when looping over all words in a set.  This means checking the loop  
condition 1 less time, which for single-word sets cuts the loop  
condition checks in half.  
  
Author: David Rowley  
Reviewed-by: Yuya Watari  
Discussion: https://postgr.es/m/CAApHDvr5O41MuUjw0DQKqmAnv7QqvmLqXReEd5o4nXTzWp8-+w@mail.gmail.com  

M src/backend/nodes/bitmapset.c

Fix regression tests of unaccent to work without UTF8 support

commit   : 44e73a498c5f3ad7e39dc70821c2d8316d3207f2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 08:05:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 08:05:00 +0900    

Click here for diff

The tests of unaccent rely on UTF8 characters, and unlike any other test  
suite in the tree (fuzzystrmatch, citext, hstore, etc.), they would fail  
if run on a database that does not support UTF8 encoding.  
  
This commit fixes the tests of unaccent so as these are skipped when run  
on a database without UTF8 support, using the same method as the other  
test suits based on \if, getdatabaseencoding() and an alternate output  
file.  
  
This has been broken for a long time, but nobody has complained about  
that either, so no backpatch is done.  This can be reproduced with  
something like REGRESS_OPTS="--no-locale --encoding=sql_ascii", for  
instance.  To defend against that, this module's Makefile and  
meson.build enforced a UTF8 encoding without locales, but it did not  
offer protection for options given by REGRESS_OPTS.  This switch makes  
this regression test suite more consistent with all the others, as  
well.  
  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M contrib/unaccent/Makefile
M contrib/unaccent/expected/unaccent.out
A contrib/unaccent/expected/unaccent_1.out
M contrib/unaccent/meson.build
M contrib/unaccent/sql/unaccent.sql

Show information about flex (version and command path) in meson output

commit   : 72df1d3f1b9d39373edfa8ceed21a000a3cba66f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 07:25:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Jul 2023 07:25:34 +0900    

Click here for diff

Like bison, this is useful to know which version and command of flex are  
detected by meson.  For example, this was useful for me when using  
win_flex.exe on Windows.  
  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

Increase size of bgw_library_name.

commit   : 957845789bb97dde2cb1ee11c1a769984131adf6    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 3 Jul 2023 15:02:16 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 3 Jul 2023 15:02:16 -0700    

Click here for diff

This commit increases the size of the bgw_library_name member of  
the BackgroundWorker struct from BGW_MAXLEN (96) bytes to MAXPGPATH  
(default of 1024) bytes so that it can store longer file names  
(e.g., absolute paths).  
  
Author: Yurii Rashkovskii  
Reviewed-by: Daniel Gustafsson, Aleksander Alekseev  
Discussion: https://postgr.es/m/CA%2BRLCQyjFV5Y8tG5QgUb6gjteL4S3p%2B1gcyqWTqigyM93WZ9Pg%40mail.gmail.com  

M doc/src/sgml/bgworker.sgml
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/launcher.c
M src/include/postmaster/bgworker.h

Fix race in SSI interaction with gin fast path.

commit   : 126552c85c1cfb6ce6445159b8024cfa5631f33e    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:20:01 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:20:01 +1200    

Click here for diff

The ginfast.c code previously checked for conflicts in before locking  
the relevant buffer, leaving a window where a RW conflict could be  
missed.  Re-order.  
  
There was also a place where buffer ID and block number were confused  
while trying to predicate-lock a page, noted by visual inspection.  
  
Back-patch to all supported releases.  Fixes one more problem discovered  
with the reproducer from bug #17949, in this case when Dmitry tried  
other index types.  
  
Reported-by: Artem Anisimov <[email protected]>  
Reported-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c

Fix race in SSI interaction with bitmap heap scan.

commit   : bcc93a389ce3862c9a15ae2f079d87bbc6a2228f    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:18:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:18:20 +1200    

Click here for diff

When performing a bitmap heap scan, we don't want to miss concurrent  
writes that occurred after we observed the heap's rs_nblocks, but before  
we took predicate locks on index pages.  Therefore, we can't skip  
fetching any heap tuples that are referenced by the index, because we  
need to test them all with CheckForSerializableConflictOut().  The  
old optimization that would ignore any references to blocks >=  
rs_nblocks gets in the way of that requirement, because it means that  
concurrent writes in that window are ignored.  
  
Removing that optimization shouldn't affect correctness at any isolation  
level, because any new tuples shouldn't be visible to an MVCC snapshot.  
There also shouldn't be any error-causing references to heap blocks past  
the end, because we should have held at least an AccessShareLock on the  
table before the index scan.  It can't get smaller while our transaction  
is running.  For now, though, we'll keep the optimization at lower  
levels to avoid making unnecessary changes in a bug fix.  
  
Back-patch to all supported releases.  In release 11, the code is in a  
different place but not fundamentally different.  Fixes one aspect of  
bug #17949.  
  
Reported-by: Artem Anisimov <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

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

Fix race in SSI interaction with empty btrees.

commit   : f9b7fc651a99ea518650d8aca661652136b249fc    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:16:27 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 16:16:27 +1200    

Click here for diff

When predicate-locking btrees, we have a special case for completely  
empty btrees, since there is no page to lock.  This was racy, because,  
without buffer lock held, a matching key could be inserted between the  
_bt_search() and the PredicateLockRelation() calls.  
  
Fix, by rechecking _bt_search() after taking the relation-level SIREAD  
lock, if using SERIALIZABLE isolation and an empty btree is discovered.  
  
Back-patch to all supported releases.  Fixes one aspect of bug #17949.  
  
Reported-by: Artem Anisimov <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

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

Don't truncate database and user names in startup packets.

commit   : 562bee0fc13dc95710b8db6a48edad2f3d052f2e    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 3 Jul 2023 13:18:05 -0700    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 3 Jul 2023 13:18:05 -0700    

Click here for diff

Unlike commands such as CREATE DATABASE, ProcessStartupPacket()  
does not perform multibyte-aware truncation of overlength names.  
This means that connection attempts might fail even if the user  
provides the same overlength names that were used in CREATE  
DATABASE, CREATE ROLE, etc.  Ideally, we'd do the same multibyte-  
aware truncation in both code paths, but it doesn't seem worth the  
added complexity of trying to discover the encoding of the names.  
Instead, let's simply skip truncating the names in the startup  
packet and let the user/database lookup fail later on.  With this  
change, users must provide the exact names stored in the catalogs,  
even if the names were truncated.  
  
This reverts commit d18c1d1f51.  
  
Author: Bertrand Drouvot  
Reviewed-by: Kyotaro Horiguchi, Tom Lane  
Discussion: https://postgr.es/m/07436793-1426-29b2-f924-db7422a05fb7%40gmail.com  

M src/backend/postmaster/postmaster.c

Consider fillfactor when estimating relation size

commit   : 29cf61ade3f245aa40f427a1d6345287ef77e622    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 18:55:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 18:55:31 +0200    

Click here for diff

When table_block_relation_estimate_size() estimated the number of tuples  
in a relation without statistics (e.g. right after load), it did not  
consider fillfactor when calculating density. With non-default  
fillfactor values, this may result in significant overestimate of the  
number of tuples - up to 10x with the minimum 10% fillfactor. This may  
have unexpected consequences, e.g. when creating hash indexes.  
  
This considers the current fillfactor value in the "no statistics" code  
path.  If the fillfactor changes after loading data into the table, the  
estimate may be off. But that seems much less likely than changing the  
fillfactor before the data load.  
  
Reviewed-by: Corey Huinker, Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/table/tableam.c

Remove expensive test of postgres_fdw batch inserts

commit   : 087a933b21cc114653008682356e50e0ecbbd812    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 18:16:58 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 18:16:58 +0200    

Click here for diff

The test inserted 70k rows into a foreign table, in order to verify  
correct behavior with more than 65535 parameters, and was added in  
response to a bug report.  
  
However, this is rather expensive, especially when running the tests  
under valgrind, CLOBBER_CACHE_ALWAYS etc. It doesn't seem worth it to  
keep running the test, so remove it from all branches (14+).  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

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

Improve pg_basebackup long file name test Windows robustness

commit   : 9436535b08c13245d18c0d2567a7c00f958b833e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:26 -0400    

Click here for diff

Creation of a file with a very long name can create problems on Windows  
due to its file path limits. Work around that by creating the file via a  
symlink with a shorter name.  
  
Error displayed by buildfarm animal fairywren.o  
  
Backpatch to all live branches  

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

Fix code indentation violations

commit   : a4cfeeca5a97f2b5969c31aa69ba775af95ee5a3    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 12:38:30 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 3 Jul 2023 12:38:30 +0200    

Click here for diff

Commits ce5aaea8cd, 2b8b2852bb and 28d03feac3 violated the expected code  
indentation rules, upsetting the new buildfarm member "koel."  
  
Discussion: https://postgr.es/m/ZKIU4mhWpgJOM0W0%40paquier.xyz  

M src/backend/access/brin/brin_bloom.c
M src/backend/commands/trigger.c

A minor simplification for List manipulation

commit   : 6d56c501a75fe0fd0b7104b3efee55e1cea8e80a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 11:35:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 11:35:15 +0200    

Click here for diff

Fix one place that was using lfirst(list_head(list)) by using linitial(list)  
instead.  They are equivalent but the latter is simpler.  We did the same in  
9d299a49.  
  
Author: Richard Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs49dJnpezDQDDxCPKq7+=_3NyqLqGqnhqCjd+dYe4MS15w@mail.gmail.com  

M src/backend/rewrite/rewriteSearchCycle.c

Update PG_CACHE_LINE_SIZE description.

commit   : dc6070bf5deec475b7efecaabf71eb9b49633973    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2023 11:56:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Jul 2023 11:56:30 +0300    

Click here for diff

PG_CACHE_LINE_SIZE was originally only used in xlog.c, but this hasn't  
been true for a very long time and is now wildly used, so modify its  
description to not mention any explicit source code file.  
  
Author: Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/20230701074936.p3qcssl4t7murt2q@jrouhaud  

M src/include/pg_config_manual.h

cirrus/freebsd: define ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS

commit   : 9945750ae0e3b602e7d388b9370213cd22164b21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 10:08:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 10:08:40 +0200    

Click here for diff

See also: 54100f5c6052404f68de9ce7310ceb61f1c2918f  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M .cirrus.yml

Take pg_attribute out of VacAttrStats

commit   : c69bdf837f161ae3e699496be10215dbb2315917    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    

Click here for diff

The VacAttrStats structure contained the whole Form_pg_attribute for a  
column, but it actually only needs attstattarget from there.  So  
remove the Form_pg_attribute field and make a separate field for  
attstattarget.  This simplifies some code for extended statistics that  
doesn't deal with a column but an expression, which had to fake up  
pg_attribute rows to satisfy internal APIs.  Also, we can remove some  
comments that essentially said "don't look at pg_attribute directly".  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org  

M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/include/commands/vacuum.h

Add macro for maximum statistics target

commit   : 7a7f60aef8bf86b1a94908e20edd107fa9da4f3d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    

Click here for diff

The number of places where 10000 was hardcoded had grown a bit beyond  
the comfort level.  Introduce a macro MAX_STATISTICS_TARGET instead.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org  

M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/misc/guc_tables.c
M src/include/catalog/pg_attribute.h
M src/include/commands/vacuum.h
M src/include/statistics/statistics.h

Change type of pg_statistic_ext.stxstattarget

commit   : 3ee2f25d21faa123dc5bb2886a00a54bdddd1c3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jul 2023 07:09:22 +0200    

Click here for diff

Change from int32 to int16, to match attstattarget (changed in  
90189eefc1).  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/statscmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_statistic_ext.h

Remove support for OpenSSL 1.0.1

commit   : 8e278b65766446f29085fe686723961c4b216e6f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 13:20:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 13:20:27 +0900    

Click here for diff

Here are some notes about this change:  
- As X509_get_signature_nid() should always exist (OpenSSL and  
LibreSSL), hence HAVE_X509_GET_SIGNATURE_NID is now gone.  
- OPENSSL_API_COMPAT is bumped to 0x10002000L.  
- One comment related to 1.0.1e introduced by 74242c2 is removed.  
  
Upstream OpenSSL still provides long-term support for 1.0.2 in a closed  
fashion, so removing it is out of scope for a few years, at least.  
  
Reviewed-by: Jacob Champion, Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/libpq/auth-scram.c
M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/002_scram.pl
M src/tools/msvc/Solution.pm

commit   : 2aeaf80e578ed48af88d54caf2ffcf7ca62617e8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 11:01:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 11:01:02 +0900    

Click here for diff

The following changes are done:  
- Addition of WaitEventBufferPin and WaitEventExtension, that hold a  
list of wait events related to each category.  
- Addition of two functions that encapsulate the list of wait events for  
each category.  
- Rename BUFFER_PIN to BUFFERPIN (only this wait event class used an  
underscore, requiring a specific rule in the automation script).  
  
These changes make a bit easier the automatic generation of all the code  
and documentation related to wait events, as all the wait event  
categories are now controlled by consistent structures and functions.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/postgres_fdw/connection.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/worker_spi/worker_spi.c
M src/tools/pgindent/typedefs.list

Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

commit   : 8c12838001c2d974d3608fe55c228f601818a729    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:04 +0900    

Click here for diff

When set, this environment variable was only effective for data  
directories but not for all the other temporary files created by  
PostgreSQL::Test::Utils.  Keeping the temporary files after a successful  
run can be useful for debugging purposes.  
  
The documentation is updated to reflect the new behavior, with contents  
available in doc/ since v16 and in src/test/perl/README since v15.  
  
Author: Jacob Champion  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAAWbhmgHtDH1SGZ+Fw05CsXtE0mzTmjbuUxLB9mY9iPKgM6cUw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/README

Remove redundant PARTITION BY columns from WindowClauses

commit   : c65102006b686ea26194fb539d7a416a089300e0    
  
author   : David Rowley <[email protected]>    
date     : Mon, 3 Jul 2023 12:49:43 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 3 Jul 2023 12:49:43 +1200    

Click here for diff

Here we adjust the query planner to have it remove items from a window  
clause's PARTITION BY clause in cases where the pathkey for a column in  
the PARTITION BY clause is redundant.  
  
Doing this allows the optimization added in 9d9c02ccd to stop window  
aggregation early rather than going into "pass-through" mode to find  
tuples belonging to the next partition.  Also, when we manage to remove  
all PARTITION BY columns, we now no longer needlessly check that the  
current tuple belongs to the same partition as the last tuple in  
nodeWindowAgg.c.  If the pathkey was redundant then all tuples must  
contain the same value for the given redundant column, so there's no point  
in checking that during execution.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvo2ji+hdxrxfXtRtsfSVw3to2o1nCO20qimw0dUGK8hcQ@mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/parsenodes.h

Silence "missing contrecord" error.

commit   : 4637a6ac0b40fef701ab850de1be547b927c3013    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 10:53:44 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 3 Jul 2023 10:53:44 +1200    

Click here for diff

Commit dd38ff28ad added a new error message "missing contrecord" when  
we fail to reassemble a record.  Unfortunately that caused noisy  
messages to be logged by pg_waldump at end of segment, and by walsender  
when asked to shut down on a segment boundary.  
  
Remove the new error message, so that this condition signals end-of-  
WAL without a message.  It's arguably a reportable condition that should  
not be silenced while performing crash recovery, but fixing that without  
introducing noise in the other cases will require more research.  
  
Back-patch to 15.  
  
Reported-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/6a1df56e-4656-b3ce-4b7a-a9cb41df8189%40enterprisedb.com  

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

Fix oversight in handling of modifiedCols since f24523672d

commit   : ce5aaea8cd32b88451914356989f0f4ecb9e4482    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 20:29:01 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 20:29:01 +0200    

Click here for diff

Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap  
into the per-row memory context. In the case of AFTER UPDATE triggers,  
the bitmap is however referenced from an event kept until the end of the  
query, resulting in a use-after-free bug.  
  
Fixed by copying the bitmap into the AfterTriggerEvents memory context,  
which is the one where we keep the trigger events. There's only one  
place that needs to do the copy, but the memory context may not exist  
yet. Doing that in a separate function seems more readable.  
  
Report by Alexander Pyhalov, fix by me. Backpatch to 13, where the  
bitmap was added to the event by commit 71d60e2aa0.  
  
Reported-by: Alexander Pyhalov  
Backpatch-through: 13  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Fix memory leak in Incremental Sort rescans

commit   : 98640f960eb9ed80cf90de3ef5d2e829b785b3eb    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 18:54:09 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 18:54:09 +0200    

Click here for diff

The Incremental Sort had a couple issues, resulting in leaking memory  
during rescans, possibly triggering OOM. The code had a couple of  
related flaws:  
  
1. During rescans, the sort states were reset but then also set to NULL  
   (despite the comment saying otherwise). ExecIncrementalSort then  
   sees NULL and initializes a new sort state, leaking the memory used  
   by the old one.  
  
2. Initializing the sort state also automatically rebuilt the info about  
   presorted keys, leaking the already initialized info. presorted_keys  
   was also unnecessarily reset to NULL.  
  
Patch by James Coleman, based on patches by Laurenz Albe and Tom Lane.  
Backpatch to 13, where Incremental Sort was introduced.  
  
Author: James Coleman, Laurenz Albe, Tom Lane  
Reported-by: Laurenz Albe, Zu-Ming Jiang  
Backpatch-through: 13  
Discussion: https://postgr.es/m/b2bd02dff61af15e3526293e2771f874cf2a3be7.camel%40cybertec.at  
Discussion: https://postgr.es/m/db03c582-086d-e7cd-d4a1-3bc722f81765%40inf.ethz.ch  

M src/backend/executor/nodeIncrementalSort.c

Improve BRIN minmax-multi opclass test coverage

commit   : 0457109344b46f481f9bf09b85674695ba57c8e4    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:33:34 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:33:34 +0200    

Click here for diff

Per the code coverage report, the existing regression tests did not  
exercice some a couple important BRIN minmax-multi code paths.  
  
- The tests focused on testing planning with a range of scan key  
  strategies, but not the execution. Fixed by adding queries that  
  actually test query execution for both equality and inequality.  
  
- All tests created indexes after inserting data, but this only  
  exercises the CREATE INDEX strategy that sees all values at once, not  
  incremental summary updates. The new tests flip the order and create  
  the index before adding data.  
  
- The assert check(s) validating correctness of expanded ranges were  
  present only in the "union" code path, which is not covered by  
  regression tests at all (as it requires concurrency etc.). Fixed by  
  adding the asserts to a couple more places.  
  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/57020b2e-d9c9-9bc7-4892-b36d9bb07563%40enterprisedb.com  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

Introduce bloom_filter_size for BRIN bloom opclass

commit   : 2b8b2852bbc54f02e26131a966e62c432144dc93    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:24:13 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:24:13 +0200    

Click here for diff

Move the calculation of Bloom filter parameters (for BRIN indexes) into  
a separate function to make reuse easier. At the moment we only call it  
from one place, but that may change and it's easier to read anyway.  
  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/0e1f3350-c9cf-ab62-43a5-5dae314de89c%40enterprisedb.com  

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

Minor cleanups in the BRIN code

commit   : 28d03feac386c2c68ffaa47f30e6578591ef5c1b    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:18:56 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 10:18:56 +0200    

Click here for diff

BRIN bloom and minmax-multi opclasses were somewhat inconsistent when  
dealing with bool variables, assigning to them Datum values etc. While  
not a bug, it makes the code harder to understand, so fix that.  
  
While at it, update an incorrect comment copied to bloom opclass from  
minmax, talking about strategies not supported by bloom.  
  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/0e1f3350-c9cf-ab62-43a5-5dae314de89c%40enterprisedb.com  

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

Trust signalfd on illumos, again.

commit   : 4f49b3f8497d5c8c3cc06eb32942c13b8ee7209e    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 2 Jul 2023 15:23:28 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 2 Jul 2023 15:23:28 +1200    

Click here for diff

Commit 3ab4fc5d avoided choosing signalfd by default on illumos, because  
it triggered kernel panics.  That was fixed, so we can remove a kludge  
from our code.  Users/packagers can still override the default choice at  
compile time if desired, and we'll leave the back-branches unchanged so  
they keep choosing self-pipe by default, but we'll default to signalfd  
(like we do for Linux) in 17.  Fixed kernels should be everywhere by the  
time 17 ships.  
  
The illumos issues were:  
  
 * https://www.illumos.org/issues/13700  
 * https://www.illumos.org/issues/14892  
  
Discussion: https://postgr.es/m/CA+hUKG+NK-K_G_i1H3OpDTwYPEsiwQi_jw58PGcW2H+-N2eVCA@mail.gmail.com  

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

Fix test of pg_stat_io for wal_level=minimal.

commit   : 01d56eecee4cfa0f796c4ee3e2e0ac615b9350bb    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 1 Jul 2023 10:00:39 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 1 Jul 2023 10:00:39 -0700    

Click here for diff

Back-patch to v16, which introduced the test.  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/sql/check_heap.sql

Remove redundant check for fast_forward.

commit   : e251e780bfe62168d0edfec459ebdc66b991753f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jun 2023 18:31:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jun 2023 18:31:10 +0300    

Click here for diff

We already checked for it earlier in the function.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Improve comment on why we need ctid->(cmin,cmax) mapping.

commit   : a0dd4c95b9dfb9ed679ff8aa6a3beab98969034f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jun 2023 18:30:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jun 2023 18:30:32 +0300    

Click here for diff

Combocids are only part of the problem. Explain the problem in more detail.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Add a test case for a316a3bc

commit   : 054ff3b33a85d62b4d486dabb5e5718399822a18    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 30 Jun 2023 15:49:05 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 30 Jun 2023 15:49:05 +0900    

Click here for diff

a316a3bc fixed the code in build_simpl_rel() that propagates  
RelOptInfo.userid from parent to child rels so that it works  
correctly for the child rels of a UNION ALL subquery rel, though  
no tests were added in that commit.  So do so here.  
  
As noted in the discussion, coming up with a test case in the core  
regression suite for this fix has turned out to be tricky, so the  
test case is added to the postgres_fdw's suite instead.  
postgresGetForeignRelSize()'s use of user mapping for the user  
specified in RelOptInfo.userid makes it relatively easier to craft  
a test case around.  
  
Discussion: https://postgr.es/m/CA%2BHiwqH91GaFNXcXbLAM9L%3DzBwUmSyv699Mtv3i1_xtk9Xec_A%40mail.gmail.com  
Backpatch-through: 16  

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

Introduce long options in pg_archivecleanup

commit   : dd7c60f1935ad3354bc77de09431313d7b0719ef    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 15:47:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 15:47:11 +0900    

Click here for diff

This patch is a preliminary refactoring for an upcoming patch aimed at  
adding new options to this tool, and using long options for these is  
more user-friendly.  The existing short options gain long flavors, as  
of:  
* -d/--debug  
* -n/--dry-run  
* -x/--strip-extension  
  
Author: Atsushi Torikoshi  
Reviewed-by: Fujii Masao, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgarchivecleanup.sgml
M src/bin/pg_archivecleanup/pg_archivecleanup.c

Fix marking of indisvalid for partitioned indexes at creation

commit   : cfc43aeb3810ebaa8dbda4807046a4c953d9e992    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 13:54:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 13:54:48 +0900    

Click here for diff

The logic that introduced partitioned indexes missed a few things when  
invalidating a partitioned index when these are created, still the code  
is written to handle recursions:  
1) If created from scratch because a mapping index could not be found,  
the new index created could be itself invalid, if for example it was a  
partitioned index with one of its leaves invalid.  
2) A CCI was missing when indisvalid is set for a parent index, leading  
to inconsistent trees when recursing across more than one level for a  
partitioned index creation if an invalidation of the parent was  
required.  
  
This could lead to the creation of a partition index tree where some of  
the partitioned indexes are marked as invalid, but some of the parents  
are marked valid, which is not something that should happen (as  
validatePartitionedIndex() defines, indisvalid is switched to true for a  
partitioned index iff all its partitions are themselves valid).  
  
This patch makes sure that indisvalid is set to false on a partitioned  
index if at least one of its partition is invalid.  The flag is set to  
true if *all* its partitions are valid.  
  
The regression test added in this commit abuses of a failed concurrent  
index creation, marked as invalid, that maps with an index created on  
its partitioned table afterwards.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Add tab completion for CREATE SCHEMA in psql

commit   : c951e9042dd12db80cac4e9a50f198a1eead2036    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 10:28:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 10:28:08 +0900    

Click here for diff

The following patterns are added for CREATE SCHEMA:  
- AUTHORIZATION, without a schema name or after a schema name.  
- Possible list of owner roles after AUTHORIZATION.  
- CREATE and GRANT within the supported set of commands.  
- Correct object types supported in an embedded CREATE SCHEMA command.  
  
While on it, this commit adjusts the completion done after CREATE  
UNLOGGED:  
- Addition of SEQUENCE.  
- Avoid suggesting MATERIALIZED VIEW in CREATE TABLE.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Suraj Khamkar, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Use named captures in Catalog::ParseHeader()

commit   : 23d8624fe52efff0e1c8a6e809d51671f9f549d6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 09:16:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Jun 2023 09:16:27 +0900    

Click here for diff

Using at least perl 5.14 is required since 4c15327, meaning that it is  
possible to use named captures and the %+ hash instead of having to  
count parenthesis groups manually.  
  
While on it, CATALOG is made more flexible in its handling of  
whitespaces for parameter lists (see the addition of \s* in this  
case).  The generated postgres.bki remains exactly the same before and  
after this commit.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm

Stamp HEAD as 17devel.

commit   : 5bcc7e6dc8cb6fb6ab16c118a1e710fc85096f76    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Jun 2023 19:05:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Jun 2023 19:05:23 -0400    

Click here for diff

Let the hacking begin ...  

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