pgsql: Refactor the code to create a pg_locale_t into new function.

2024-10-25 Thread Jeff Davis
Refactor the code to create a pg_locale_t into new function. Reviewed-by: Andreas Karlsson Discussion: https://postgr.es/m/59da7ee4-5e1a-4727-b464-a603c6ed8...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3aa2373c114124f62e80016d8939331fcb4d5586 Modifi

pgsql: Read extension script files in text not binary mode.

2024-10-25 Thread Tom Lane
Read extension script files in text not binary mode. This change affects only Windows, where it should cause DOS-style newlines (\r\n) to be converted to plain \n during script loading. This eliminates one potential discrepancy in the behavior of extension script files between Windows and non-Wind

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: Move EXPLAIN counter increment to heapam_scan_bitmap_next_block

2024-10-25 Thread Melanie Plageman
Move EXPLAIN counter increment to heapam_scan_bitmap_next_block Increment the lossy and exact page counters for EXPLAIN of bitmap heap scans in heapam_scan_bitmap_next_block(). Note that other table AMs will need to do this as well Pushing the counters into heapam_scan_bitmap_next_block() is requ

pgsql: Make table_scan_bitmap_next_block() async-friendly

2024-10-25 Thread Melanie Plageman
Make table_scan_bitmap_next_block() async-friendly Move all responsibility for indicating a block is exhuasted into table_scan_bitmap_next_tuple() and advance the main iterator in heap-specific code. This flow control makes more sense and is a step toward using the read stream API for bitmap heap

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: For inplace update, send nontransactional invalidations.

2024-10-25 Thread Noah Misch
For inplace update, send nontransactional invalidations. The inplace update survives ROLLBACK. The inval didn't, so another backend's DDL could then update the row without incorporating the inplace update. In the test this fixes, a mix of CREATE INDEX and ALTER TABLE resulted in a table with an

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: WAL-log inplace update before revealing it to other sessions.

2024-10-25 Thread Noah Misch
WAL-log inplace update before revealing it to other sessions. A buffer lock won't stop a reader having already checked tuple visibility. If a vac_update_datfrozenid() and then a crash happened during inplace update of a relfrozenxid value, datfrozenxid could overtake relfrozenxid. That could lea

pgsql: At end of recovery, reset all sinval-managed caches.

2024-10-25 Thread Noah Misch
At end of recovery, reset all sinval-managed caches. An inplace update's invalidation messages are part of its transaction's commit record. However, the update survives even if its transaction aborts or we stop recovery before replaying its transaction commit. After recovery, a backend that start

pgsql: doc: Fix typo in pg_restore_*_stats function documentation

2024-10-25 Thread Daniel Gustafsson
doc: Fix typo in pg_restore_*_stats function documentation Fix accidental typo from d32d146399, s/intepretation/interpretation/ Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0fe173680e148984a150326b80c322a91ffa899d Modified Files -- doc/src/sgml/func.

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-10-25 Thread Alexander Korotkov
Hi, Heikki! On Fri, Oct 25, 2024 at 9:06 AM Heikki Linnakangas wrote: > If you call this procedure on a stand-alone server, you get: > > postgres=# call pg_wal_replay_wait('1234/0'); > ERROR: recovery is not in progress > DETAIL: Recovery ended before replaying target LSN 1234/0; last replay >

pgsql: Fix concurrrently in typcache_rel_type_cache.sql

2024-10-25 Thread Alexander Korotkov
Fix concurrrently in typcache_rel_type_cache.sql All injection points there must be local. Otherwise it affects parallel tests. Reported-by: Andres Freund Discussion: https://postgr.es/m/b3ybc66l6lhmtzj2n7ypumz5yjz7njc46sddsqshdtstgj74ah%40qgtn6nzokj6a Branch -- master Details --- htt

pgsql: Generalize plpgsql's heuristic for importing expanded objects.

2024-10-25 Thread Tom Lane
Generalize plpgsql's heuristic for importing expanded objects. If a R/W expanded-object pointer is passed as a function parameter, take ownership of the object, regardless of its type. Previously this happened only for expanded arrays, but that was a result of sloppy thinking. (If the plpgsql fu

pgsql: Doc: Add a caution in alter publication.

2024-10-25 Thread Amit Kapila
Doc: Add a caution in alter publication. Clarify that altering the 'publish_via_partition_root' option can lead to data loss or duplication when a partition root table is specified as the replication target. Reported-by: Maxim Boguk Author: Hayato Kuroda Reviewed-by: Amit Kapila, Peter Smith, Vig

pgsql: Move LSN waiting declarations and definitions to better place

2024-10-25 Thread Alexander Korotkov
Move LSN waiting declarations and definitions to better place 3c5db1d6b implemented the pg_wal_replay_wait() stored procedure. Due to the patch development history, the implementation resided in src/backend/commands/waitlsn.c (src/include/commands/waitlsn.h for headers). 014f9f34d moved pg_wal_r

pgsql: Raise the minimum supported OpenSSL version to 1.1.1

2024-10-25 Thread Daniel Gustafsson
Raise the minimum supported OpenSSL version to 1.1.1 Commit a70e01d4306fdbcd retired support for OpenSSL 1.0.2 in order to get rid of the need for manual initialization of the library. This left our API usage compatible with 1.1.0 which was defined as the minimum required version. Also mention th

pgsql: Support configuring TLSv1.3 cipher suites

2024-10-25 Thread Daniel Gustafsson
Support configuring TLSv1.3 cipher suites The ssl_ciphers GUC can only set cipher suites for TLSv1.2, and lower, connections. For TLSv1.3 connections a different OpenSSL API must be used. This adds a new GUC, ssl_tls13_ciphers, which can be used to configure a colon separated list of cipher suite

pgsql: Refactor GetLockStatusData() to skip backends/groups without fas

2024-10-25 Thread Fujii Masao
Refactor GetLockStatusData() to skip backends/groups without fast-path locks. Previously, GetLockStatusData() checked all slots for every backend to gather fast-path lock data, which could be inefficient. This commit refactors it by skipping backends with PID=0 (since they don't hold fast-path loc