Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-03-29 Thread Michael Paquier
On Sat, Mar 29, 2025 at 09:24:58AM -0700, Jeff Davis wrote: > This seems to have broken the pg_upgrade test when olddump/oldinstall > are set to PG14 or earlier: > > stderr: > # Failed test 'check that locales in new cluster match original > cluster' > # at > /home/jdavis/git/postgresql/src/bi

pgsql: Fix mis-attribution of checksum failure stats to the wrong datab

2025-03-29 Thread Andres Freund
Fix mis-attribution of checksum failure stats to the wrong database Checksum failure stats could be attributed to the wrong database in two cases: - when a read of a shared relation encountered a checksum error , it would be attributed to the current database, instead of the "database" represen

pgsql: localbuf: Track pincount in BufferDesc as well

2025-03-29 Thread Andres Freund
localbuf: Track pincount in BufferDesc as well For AIO on temporary table buffers the AIO subsystem needs to be able to ensure a pin on a buffer while AIO is going on, even if the IO issuing query errors out. Tracking the buffer in LocalRefCount does not work, as it would cause CheckForLocalBuffer

pgsql: aio, bufmgr: Comment fixes/improvements

2025-03-29 Thread Andres Freund
aio, bufmgr: Comment fixes/improvements Some of these comments have been wrong for a while (12f3867f5534), some I recently introduced (da7226993fd, 55b454d0e14). This includes an update to a comment in FlushBuffer(), which will be copied in a future commit. These changes seem big enough to be wor

pgsql: aio: Implement support for reads in smgr/md/fd

2025-03-29 Thread Andres Freund
aio: Implement support for reads in smgr/md/fd This implements the following: 1) An smgr AIO target, for AIO on smgr files. This should be usable not just for md.c but also other SMGR implementation if we ever get them. 2) readv support in fd.c, which requires a small bit of infrastructure wor

pgsql: pgbench: Make set_random_seed() 64-bit everywhere.

2025-03-29 Thread Peter Eisentraut
pgbench: Make set_random_seed() 64-bit everywhere. Delete an intermediate variable, a redundant cast, a use of long and a use of long long. scanf() the seed directly into a uint64, now that we can do that with SCNu64 from . The previous coding was from pre-C99 times when %lld might not have been

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-03-29 Thread Jeff Davis
On Fri, 2025-02-28 at 01:16 +, Michael Paquier wrote: > pg_upgrade: Fix inconsistency in memory freeing > Details > --- > https://git.postgresql.org/pg/commitdiff/2a083ab807db6d9e2e0e3aa82ee8f6ff9fc44c8d > This seems to have broken the pg_upgrade test when olddump/oldinstall are set to P

pgsql: amcheck: Fix indentation in verify_gin.c

2025-03-29 Thread Tomas Vondra
amcheck: Fix indentation in verify_gin.c I forgot to reindent the code after a couple last-minute adjustments just before committing 14ffaece0fb53fed8ddbc46d2b353e1c4834863a. Discussion: https://postgr.es/m/45AC9B0A-2B45-40EE-B08F-BDCF5739D1E1%40yandex-team.ru Branch -- master Details

pgsql: amcheck: Add a test with GIN index on JSONB data

2025-03-29 Thread Tomas Vondra
amcheck: Add a test with GIN index on JSONB data Extend the existing test of GIN checks to also include an index on JSONB data, using the jsonb_path_ops opclass. This is a common enough usage of GIN that it makes sense to have better test coverage for it. Author: Mark Dilger Reviewed-By: Tomas V

pgsql: amcheck: Add a GIN index to the CREATE INDEX CONCURRENTLY tests

2025-03-29 Thread Tomas Vondra
amcheck: Add a GIN index to the CREATE INDEX CONCURRENTLY tests The existing CREATE INDEX CONCURRENTLY tests checking only B-Tree, but can be cheaply extended to also check GIN. This helps increasing test coverage for GIN amcheck, especially related to handling concurrent page splits and posting l

pgsql: Fix "‘static’ is not at beginning of declaration" warning

2025-03-29 Thread Andres Freund
Fix "‘static’ is not at beginning of declaration" warning b98be8a2a2a used "const static" instead of "static const". We normally use the latter form. Discussion: https://postgr.es/m/z4mc2hzecahyq3paupfsouhuupmzmgum45md3k5my6bmo7gvn7@z5j26doqamqy Branch -- master Details --- https://git

pgsql: amcheck: Add gin_index_check() to verify GIN index

2025-03-29 Thread Tomas Vondra
amcheck: Add gin_index_check() to verify GIN index Adds a new function, validating two kinds of invariants on a GIN index: - parent-child consistency: Paths in a GIN graph have to contain consistent keys. Tuples on parent pages consistently include tuples from child pages; parent tuples do no

pgsql: Fix grammar in GIN README

2025-03-29 Thread Tomas Vondra
Fix grammar in GIN README Author: Kirill Reshke Discussion: https://postgr.es/m/CALdSSPgu9uAhVYojQ0yjG%3Dq5MaqmiSLUJPhz%2B-u7cA6K6Mc9UA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fb9dff76635d4c32198f30a3cb503588d557d156 Modified Files --

pgsql: amcheck: Move common routines into a separate module

2025-03-29 Thread Tomas Vondra
amcheck: Move common routines into a separate module Before performing checks on an index, we need to take some safety measures that apply to all index AMs. This includes: * verifying that the index can be checked - Only selected AMs are supported by amcheck (right now only B-Tree). The index has

pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.

2025-03-29 Thread Dean Rasheed
Fix MERGE with DO NOTHING actions into a partitioned table. ExecInitPartitionInfo() duplicates much of the logic in ExecInitMerge(), except that it failed to handle DO NOTHING actions. This would cause an "unknown action in MERGE WHEN clause" error if a MERGE with any DO NOTHING actions attempted

pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.

2025-03-29 Thread Dean Rasheed
Fix MERGE with DO NOTHING actions into a partitioned table. ExecInitPartitionInfo() duplicates much of the logic in ExecInitMerge(), except that it failed to handle DO NOTHING actions. This would cause an "unknown action in MERGE WHEN clause" error if a MERGE with any DO NOTHING actions attempted

pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.

2025-03-29 Thread Dean Rasheed
Fix MERGE with DO NOTHING actions into a partitioned table. ExecInitPartitionInfo() duplicates much of the logic in ExecInitMerge(), except that it failed to handle DO NOTHING actions. This would cause an "unknown action in MERGE WHEN clause" error if a MERGE with any DO NOTHING actions attempted

pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.

2025-03-29 Thread Dean Rasheed
Fix MERGE with DO NOTHING actions into a partitioned table. ExecInitPartitionInfo() duplicates much of the logic in ExecInitMerge(), except that it failed to handle DO NOTHING actions. This would cause an "unknown action in MERGE WHEN clause" error if a MERGE with any DO NOTHING actions attempted

pgsql: Use PRI?64 instead of "ll?" in format strings (continued).

2025-03-29 Thread Peter Eisentraut
Use PRI?64 instead of "ll?" in format strings (continued). Continuation of work started in commit 15a79c73, after initial trial. Author: Thomas Munro Discussion: https://postgr.es/m/b936d2fb-590d-49c3-a615-92c3a88c6c19%40eisentraut.org Branch -- master Details --- https://git.postgres