pgsql: Add assertion in pgstat_write_statsfile() about processes allowe

2024-07-11 Thread Michael Paquier
Add assertion in pgstat_write_statsfile() about processes allowed This routine can currently only be called from the postmaster in single-user mode or the checkpointer, but there was no sanity check to make sure that this was always the case. This has proved to be useful when hacking the zone (at

pgsql: Fix a typo in logicalrep_write_typ().

2024-07-11 Thread Amit Kapila
Fix a typo in logicalrep_write_typ(). Author: ChangAo Chen Discussion: https://postgr.es/m/tencent_cdecb843b30a8b6b5152fa6458f0f00fd...@qq.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/63909da9783a4736b01911fe3ee829651ff3c7d8 Modified Files -- sr

pgsql: Fix unstable test in 040_pg_createsubscriber.

2024-07-11 Thread Amit Kapila
Fix unstable test in 040_pg_createsubscriber. The slot synchronization failed because the local slot's (created during slot synchronization) catalog_xmin on standby is ahead of remote slot. This happens because the INSERT before slot synchronization results in the generation of a new xid that coul

pgsql: Fix unstable test in 040_pg_createsubscriber.

2024-07-11 Thread Amit Kapila
Fix unstable test in 040_pg_createsubscriber. The slot synchronization failed because the local slot's (created during slot synchronization) catalog_xmin on standby is ahead of remote slot. This happens because the INSERT before slot synchronization results in the generation of a new xid that coul

pgsql: Consider materializing the cheapest inner path in parallel nestl

2024-07-11 Thread Richard Guo
Consider materializing the cheapest inner path in parallel nestloop When generating non-parallel nestloop paths for each available outer path, we always consider materializing the cheapest inner path if feasible. Similarly, in this patch, we also consider materializing the cheapest inner path whe

pgsql: Disable clang 16's -Wcast-function-type-strict.

2024-07-11 Thread Thomas Munro
Disable clang 16's -Wcast-function-type-strict. This is a back-patch of commit 101c37cd into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1f3, which turned on -Wcast-function-type, but did not disable -Wcast-function-type-strict. This silences warnings about function pointer t

pgsql: Disable clang 16's -Wcast-function-type-strict.

2024-07-11 Thread Thomas Munro
Disable clang 16's -Wcast-function-type-strict. This is a back-patch of commit 101c37cd into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1f3, which turned on -Wcast-function-type, but did not disable -Wcast-function-type-strict. This silences warnings about function pointer t

pgsql: Improve comment of pgstat_read_statsfile()

2024-07-11 Thread Michael Paquier
Improve comment of pgstat_read_statsfile() The comment at the top of pgstat_read_statsfile() mentioned that the stats are read from the on-disk file into the pgstats dshash. This is incorrect for fix-numbered stats as these are loaded directly into shared memory. This commit simplifies the comme

pgsql: Improve logical replication connection-failure messages.

2024-07-11 Thread Tom Lane
Improve logical replication connection-failure messages. These messages mostly said "could not connect to the publisher: %s" which is lacking context. Add some verbiage to indicate which subscription or worker process is failing. Nisha Moond Discussion: https://postgr.es/m/CABdArM7q1=zqL++cYd0

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

2024-07-11 Thread Tom Lane
Add min and max aggregates for composite types (records). Like min/max for arrays, these are just thin wrappers around the existing btree comparison function for records. Aleksander Alekseev Discussion: https://postgr.es/m/CAO=ib8l4wysnxcj8gurrjqsrxeq2-zn3ficsh2lmqvwq2wc...@mail.gmail.com Bran

Re: pgsql: Avoid crashing when a JIT-inlined backend function throws an err

2024-07-11 Thread Tom Lane
Amul Sul writes: > On Fri, Jun 28, 2024 at 12:14 AM Tom Lane wrote: >> Rather than fixing this by adding pstrdup() overhead to every >> elog/ereport sequence, let's fix it by copying the risky pointers >> in CopyErrorData(). That solves it for _SPI_commit/_SPI_rollback >> because they use that f

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

pgsql: Fix possibility of logical decoding partial transaction changes.

2024-07-11 Thread Masahiko Sawada
Fix possibility of logical decoding partial transaction changes. When creating and initializing a logical slot, the restart_lsn is set to the latest WAL insertion point (or the latest replay point on standbys). Subsequently, WAL records are decoded from that point to find the start point for extra

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

2024-07-11 Thread Andrew Dunstan
Change pg_regress.c back to using diff -w on Windows This partially reverts commit 628c1d1f2c. It appears that there are non line-end differences in some regression tests on Windows. To keep the buildfarm and CI clients happy, change this back for now, pending further investigation. Per reports

Re: pgsql: Avoid crashing when a JIT-inlined backend function throws an err

2024-07-11 Thread Amul Sul
On Fri, Jun 28, 2024 at 12:14 AM Tom Lane wrote: > > Avoid crashing when a JIT-inlined backend function throws an error. > > errfinish() assumes that the __FUNC__ and __FILE__ arguments it's > passed are compile-time constant strings that can just be pointed > to rather than physically copied. Ho

pgsql: Add a new 'F' entry type for fixed-numbered stats in pgstats fil

2024-07-11 Thread Michael Paquier
Add a new 'F' entry type for fixed-numbered stats in pgstats file This new entry type is used for all the fixed-numbered statistics, making possible support for custom pluggable stats. In short, we need to be able to detect more easily if a stats kind exists or not when reading back its data from