pgsql: Fix indentation issue

2025-11-12 Thread Michael Paquier
Fix indentation issue Issue introduced by 84fb27511dbe. I have missed this diff while adding pgoff_t to the typedef list of pgindent, while addressing a separate indentation issue. Per buildfarm member koel. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c2b0e3a0

pgsql: Add commit c2b0e3a0351e to .git-blame-ignore-revs.

2025-11-12 Thread Michael Paquier
Add commit c2b0e3a0351e to .git-blame-ignore-revs. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e6c9186e68382d2a91e23da9225261a781a667f7 Modified Files -- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+)

pgsql: Replace off_t by pgoff_t in I/O routines

2025-11-12 Thread Michael Paquier
Replace off_t by pgoff_t in I/O routines PostgreSQL's Windows port has never been able to handle files larger than 2GB due to the use of off_t for file offsets, only 32-bit on Windows. This causes signed integer overflow at exactly 2^31 bytes when trying to handle files larger than 2GB, for the r

pgsql: Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN varia

2025-11-12 Thread Fujii Masao
Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN variable. pg_logical_slot_get_changes_guts() previously assigned InvalidXLogRecPtr to the local variable upto_nchanges, which is of type int32, not XLogRecPtr. While this caused no functional issue since InvalidXLogRecPtr is defined as 0,

pgsql: Remove obsolete autovacuum comment.

2025-11-12 Thread Nathan Bossart
Remove obsolete autovacuum comment. This comment seems to refer to some stuff that was removed during development in 2005. Reviewed-by: David Rowley Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/aRJFDxKJLFE_1Iai%40nathan Branch -- master Details --- https://git.postgresq

pgsql: test_dsa: Avoid leaking LWLock tranches.

2025-11-12 Thread Nathan Bossart
test_dsa: Avoid leaking LWLock tranches. Since this is a test module, leaking a couple of LWLock tranches is fine, but we want to discourage that pattern in third-party code. This commit teaches the module to create only one tranche and to store its ID in shared memory for use by other backends.

pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent

2025-11-12 Thread Nathan Bossart
Teach DSM registry to ERROR if attaching to an uninitialized entry. If DSM entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, keep track of whether initialization completed, and ERROR i

pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent

2025-11-12 Thread Nathan Bossart
Teach DSM registry to ERROR if attaching to an uninitialized entry. If DSM entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, keep track of whether initialization completed, and ERROR i

pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent

2025-11-12 Thread Nathan Bossart
Teach DSM registry to ERROR if attaching to an uninitialized entry. If DSM entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, keep track of whether initialization completed, and ERROR i

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Clear 'xid' in dummy async notify entries written to fill up pag

2025-11-12 Thread Heikki Linnakangas
Clear 'xid' in dummy async notify entries written to fill up pages Before we started to freeze async notify entries (commit 8eeb4a0f7c), no one looked at the 'xid' on an entry with invalid 'dboid'. But now we might actually need to freeze it later. Initialize them with InvalidTransactionId to begi

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: Fix bug where we truncated CLOG that was still needed by LISTEN/

2025-11-12 Thread Heikki Linnakangas
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY The async notification queue contains the XID of the sender, and when processing notifications we call TransactionIdDidCommit() on the XID. But we had no safeguards to prevent the CLOG segments containing those XIDs from being

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: Escalate ERRORs during async notify processing to FATAL

2025-11-12 Thread Heikki Linnakangas
Escalate ERRORs during async notify processing to FATAL Previously, if async notify processing encountered an error, we would report the error to the client and advance our read position past the offending entry to prevent trying to process it over and over again. Trying to continue after an error

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: Fix remaining race condition with CLOG truncation and LISTEN/NOT

2025-11-12 Thread Heikki Linnakangas
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY Previous commit fixed a bug where VACUUM would truncate the CLOG that's still needed to check the commit status of XIDs in the async notify queue, but as mentioned in the commit message, it wasn't a full fix. If a backend is execu

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: doc: Document effects of ownership change on privileges

2025-11-12 Thread Daniel Gustafsson
doc: Document effects of ownership change on privileges Explicitly document that privileges are transferred along with the ownership. Backpatch to all supported versions since this behavior has always been present. Author: Laurenz Albe Reviewed-by: Daniel Gustafsson Reviewed-by: David G. Johnst

pgsql: Split out innards of pg_tablespace_location()

2025-11-12 Thread Álvaro Herrera
Split out innards of pg_tablespace_location() This creates a src/backend/catalog/pg_tablespace.c supporting file containing a new function get_tablespace_location(), which lets the code underlying pg_tablespace_location() be reused for other purposes. Author: Manni Wood Author: Nishant Sharma R

pgsql: Add tab completion support for the WAIT FOR command

2025-11-12 Thread Alexander Korotkov
Add tab completion support for the WAIT FOR command This commit implements tab completion for the WAIT FOR LSN command in psql. Discussion: https://postgr.es/m/CABPTF7WnLPKcoTGCGge1dDpOieZ2HGF7OVqhNXDcRLPPdSw%3DxA%40mail.gmail.com Author: Xuneng Zhou Reviewed-by: Alexander Korotkov Branch ---

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: Fix range for commit_siblings in sample conf

2025-11-12 Thread Daniel Gustafsson
Fix range for commit_siblings in sample conf The range for commit_siblings was incorrectly listed as starting on 1 instead of 0 in the sample configuration file. Backpatch down to all supported branches. Author: Man Zeng Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/tencent_53

pgsql: libpq: threadsafety for SSL certificate callback

2025-11-12 Thread Daniel Gustafsson
libpq: threadsafety for SSL certificate callback In order to make the errorhandling code in backend libpq be thread- safe the global variable used by the certificate verification call- back need to be replaced with passing private data. This moves the threadsafety needle a little but forwards, th

pgsql: Change coding pattern for CURL_IGNORE_DEPRECATION()

2025-11-12 Thread Álvaro Herrera
Change coding pattern for CURL_IGNORE_DEPRECATION() Instead of having to write a semicolon inside the macro argument, we can insert a semicolon with another macro layer. This no longer gives pg_bsd_indent indigestion, so we can remove the digestive aids that had to be installed in the pgindent Pe

pgsql: Change coding pattern for CURL_IGNORE_DEPRECATION()

2025-11-12 Thread Álvaro Herrera
Change coding pattern for CURL_IGNORE_DEPRECATION() Instead of having to write a semicolon inside the macro argument, we can insert a semicolon with another macro layer. This no longer gives pg_bsd_indent indigestion, so we can remove the digestive aids that had to be installed in the pgindent Pe

pgsql: Fix comments of output routines for pg_ndistinct and pg_dependen

2025-11-12 Thread Michael Paquier
Fix comments of output routines for pg_ndistinct and pg_dependencies Oversights in 7b504eb282ca (for pg_ndistinct) and 2686ee1b7ccf (for pg_dependencies). Reported-by: Man Zeng Discussion: https://postgr.es/m/176293711658.2081918.12019224686811870203.p...@coridan.postgresql.org Branch -- m

pgsql: Fix pg_upgrade around multixid and mxoff wraparound

2025-11-12 Thread Heikki Linnakangas
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, be

pgsql: Fix pg_upgrade around multixid and mxoff wraparound

2025-11-12 Thread Heikki Linnakangas
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, be

pgsql: Fix pg_upgrade around multixid and mxoff wraparound

2025-11-12 Thread Heikki Linnakangas
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, be

pgsql: Fix pg_upgrade around multixid and mxoff wraparound

2025-11-12 Thread Heikki Linnakangas
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, be

pgsql: Fix pg_upgrade around multixid and mxoff wraparound

2025-11-12 Thread Heikki Linnakangas
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, be

pgsql: Doc: Add documentation for sequence synchronization.

2025-11-12 Thread Amit Kapila
Doc: Add documentation for sequence synchronization. Add documentation describing sequence synchronization support in logical replication. It explains how sequence changes are synchronized from the publisher to the subscriber, the configuration requirements, and provide examples illustrating setup