pgsql: Optimize pg_readv/pg_pwritev single vector case.

2023-11-28 Thread Thomas Munro
Optimize pg_readv/pg_pwritev single vector case. 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

Re: pgsql: meson: docs: Add {html,man} targets, rename install-doc-*

2023-11-28 Thread Andres Freund
Hi, On 2023-11-23 08:32:21 -0500, Andrew Dunstan wrote: > On 2023-11-20 Mo 20:53, Andres Freund wrote: > > meson: docs: Add {html,man} targets, rename install-doc-* > > > > We have toplevel html, man targets in the autoconf build as well. It'd be > > odd > > to have an 'html' target but have the

pgsql: Use larger segment file names for pg_notify

2023-11-28 Thread Alexander Korotkov
Use larger segment file names for pg_notify 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

pgsql: Make use FullTransactionId in 2PC filenames

2023-11-28 Thread Alexander Korotkov
Make use FullTransactionId in 2PC filenames 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

pgsql: Index SLRUs by 64-bit integers rather than by 32-bit integers

2023-11-28 Thread Alexander Korotkov
Index SLRUs by 64-bit integers rather than by 32-bit integers 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

pgsql: Add SLRU tests for 64-bit page case

2023-11-28 Thread Alexander Korotkov
Add SLRU tests for 64-bit page case 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:

pgsql: Clean up usage of bison precedence for non-operator keywords.

2023-11-28 Thread Tom Lane
Clean up usage of bison precedence for non-operator keywords. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

2023-11-28 Thread Tom Lane
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data. 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

pgsql: Fix comment about ressortgrouprefs being unique in setop plans.

2023-11-28 Thread Heikki Linnakangas
Fix comment about ressortgrouprefs being unique in setop plans. Author: Richard Guo, Tom Lane Discussion: https://www.postgresql.org/message-id/CAMbWs49rAfFS-yd7=QxtDUrZDFfRBGy4rGBJNyGDH7=clip...@mail.gmail.com Branch -- master Details ---

pgsql: Remove more statements from stats.sql

2023-11-28 Thread Michael Paquier
Remove more statements from stats.sql 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=qm35gbn1mqvraxag...@mail.gmail.com Branch

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: Fix assertions with RI triggers in heap_update and heap_delete.

2023-11-28 Thread Heikki Linnakangas
Fix assertions with RI triggers in heap_update and heap_delete. 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.

pgsql: psql: Add tab completion for view options.

2023-11-28 Thread Dean Rasheed
psql: Add tab completion for view options. 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.