pgsql: Remove stray semicolon at global scope

2025-09-11 Thread Peter Eisentraut
Remove stray semicolon at global scope The Sun Studio compiler complains about an empty declaration here. Note for future historians: This does not mean that this compiler is still of current interest for anyone using PostgreSQL. But we can let this small fix be its parting gift. Reviewed-by:

pgsql: Fix description of WAL record blocks in hash_xlog.h

2025-09-11 Thread Michael Paquier
Fix description of WAL record blocks in hash_xlog.h hash_xlog.h included descriptions for the blocks used in WAL records that were was not completely consistent with how the records are generated, with one block missing for SQUEEZE_PAGE, and inconsistent descriptions used for block 0 in VACUUM_ONE

pgsql: Fix description of WAL record blocks in hash_xlog.h

2025-09-11 Thread Michael Paquier
Fix description of WAL record blocks in hash_xlog.h hash_xlog.h included descriptions for the blocks used in WAL records that were was not completely consistent with how the records are generated, with one block missing for SQUEEZE_PAGE, and inconsistent descriptions used for block 0 in VACUUM_ONE

pgsql: Fix description of WAL record blocks in hash_xlog.h

2025-09-11 Thread Michael Paquier
Fix description of WAL record blocks in hash_xlog.h hash_xlog.h included descriptions for the blocks used in WAL records that were was not completely consistent with how the records are generated, with one block missing for SQUEEZE_PAGE, and inconsistent descriptions used for block 0 in VACUUM_ONE

pgsql: Fix description of WAL record blocks in hash_xlog.h

2025-09-11 Thread Michael Paquier
Fix description of WAL record blocks in hash_xlog.h hash_xlog.h included descriptions for the blocks used in WAL records that were was not completely consistent with how the records are generated, with one block missing for SQUEEZE_PAGE, and inconsistent descriptions used for block 0 in VACUUM_ONE

pgsql: Fill testing gap for possible referential integrity violation

2025-09-11 Thread Álvaro Herrera
Fill testing gap for possible referential integrity violation This commit adds a missing isolation test for (non-PERIOD) foreign keys. With REPEATABLE READ, one transaction can insert a referencing row while another deletes the referenced row, and both see a valid state. But after they have commi

pgsql: Report the correct is_temporary flag for column defaults.

2025-09-11 Thread Tom Lane
Report the correct is_temporary flag for column defaults. pg_event_trigger_dropped_objects() would report a column default object with is_temporary = false, even if it belongs to a temporary table. This seems clearly wrong, so adjust it to report the table's temp-ness. While here, refactor Event

pgsql: Fix typo in comment

2025-09-11 Thread Peter Eisentraut
Fix typo in comment Author: Alexandra Wang Discussion: https://www.postgresql.org/message-id/CAK98qZ0whQ%3Dc%2BJGXbGSEBxCtLgy6sf-YGYqsKTAGsS-wt0wj%2BA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/81a61fde84ffc74f7b3c7854ed4193cc4d31f78b Modifi

pgsql: Remove whitespace in comment of pg_stat_statements.c

2025-09-11 Thread Michael Paquier
Remove whitespace in comment of pg_stat_statements.c Introduced by 6b4d23feef6e, spotted while reading this area of the code. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/306dd13079ed616c414c9411c5deadffea273266 Modified Files -- contrib/pg_stat_stat

pgsql: Report the correct is_temporary flag for column defaults.

2025-09-11 Thread Tom Lane
Report the correct is_temporary flag for column defaults. pg_event_trigger_dropped_objects() would report a column default object with is_temporary = false, even if it belongs to a temporary table. This seems clearly wrong, so adjust it to report the table's temp-ness. While here, refactor Event

pgsql: Fix misuse of Relids for storing attribute numbers

2025-09-11 Thread Richard Guo
Fix misuse of Relids for storing attribute numbers The typedef Relids (Bitmapset *) is intended to represent set of relation identifiers, but was incorrectly used in several places to store sets of attribute numbers. This is my oversight in e2debb643. Fix that by replacing such usages with Bitma

pgsql: Remove checks for no longer supported GCC versions

2025-09-11 Thread Peter Eisentraut
Remove checks for no longer supported GCC versions Since commit f5e0186f865 (Raise C requirement to C11), we effectively require at least GCC version 4.7, so checks for older versions can be removed. Reviewed-by: Andres Freund Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/messag

pgsql: Add date and timestamp variants of random(min, max).

2025-09-11 Thread Dean Rasheed
Add date and timestamp variants of random(min, max). This adds 3 new variants of the random() function: random(min date, max date) returns date random(min timestamp, max timestamp) returns timestamp random(min timestamptz, max timestamptz) returns timestamptz Each returns a random va

pgsql: Fix corruption of pgstats shared hashtable due to OOM failures

2025-09-11 Thread Michael Paquier
Fix corruption of pgstats shared hashtable due to OOM failures A new pgstats entry is created as a two-step process: - The entry is looked at in the shared hashtable of pgstats, and is inserted if not found. - When not found and inserted, its fields are then initialized. This part include a DSA c

pgsql: Move named LWLock tranche requests to shared memory.

2025-09-11 Thread Nathan Bossart
Move named LWLock tranche requests to shared memory. In EXEC_BACKEND builds, GetNamedLWLockTranche() can segfault when called outside of the postmaster process, as it might access NamedLWLockTrancheRequestArray, which won't be initialized. Given the lack of reports, this is apparently unusual, pr

pgsql: Improve comment about snapshot macros

2025-09-11 Thread Álvaro Herrera
Improve comment about snapshot macros The comment mistakenly had "the others" for "the other", but this commit also reorders the comment so it matches the macros below. Now we describe the levels in increasing strictness. In addition, it seems easier to follow if we introduce one level at a time

pgsql: Add more information for WAL records of hash index AMs

2025-09-11 Thread Michael Paquier
Add more information for WAL records of hash index AMs hashdesc.c was missing a couple of fields in its record descriptions, as of: - is_prev_bucket_same_wrt for SQUEEZE_PAGE. - procid for INIT_META_PAGE. - old_bucket_flag and new_bucket_flag for SPLIT_ALLOCATE_PAGE. The author has noted the firs

pgsql: Silence compiler warnings on clang 21

2025-09-11 Thread Peter Eisentraut
Silence compiler warnings on clang 21 Clang 21 shows some new compiler warnings, for example: warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] The fix is to initialize the variables when they are defined. This is similar

pgsql: Default to log_lock_waits=on

2025-09-11 Thread Peter Eisentraut
Default to log_lock_waits=on If someone is stuck behind a lock for more than a second, that is almost always a problem that is worth a log entry. Author: Laurenz Albe Reviewed-By: Michael Banck Reviewed-By: Robert Haas Reviewed-By: Christoph Berg Reviewed-By: Stephen Frost Discussion: https

pgsql: Silence compiler warnings on clang 21

2025-09-11 Thread Peter Eisentraut
Silence compiler warnings on clang 21 Clang 21 shows some new compiler warnings, for example: warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] The fix is to initialize the variables when they are defined. This is similar

pgsql: Improve pgbench definition of yyscan_t

2025-09-11 Thread Peter Eisentraut
Improve pgbench definition of yyscan_t It was defining yyscan_t as a macro while the rest of the code uses a typedef with #ifdef guards around it. The latter is also what the flex generated code uses. So it seems best to make it look like those other places for consistency. The old way also had

pgsql: Allow redeclaration of typedef yyscan_t

2025-09-11 Thread Peter Eisentraut
Allow redeclaration of typedef yyscan_t This is allowed in C11, so we don't need the workaround guards against it anymore. This effectively reverts commit 382092a0cd2 that put these guards in place. Reviewed-by: Chao Li Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-

pgsql: Silence compiler warnings on clang 21

2025-09-11 Thread Peter Eisentraut
Silence compiler warnings on clang 21 Clang 21 shows some new compiler warnings, for example: warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] The fix is to initialize the variables when they are defined. This is similar

pgsql: Remove traces of support for Sun Studio compiler

2025-09-11 Thread Peter Eisentraut
Remove traces of support for Sun Studio compiler Per discussion, this compiler suite is no longer maintained, and it has not been able to compile PostgreSQL since at least PostgreSQL 17. This removes all the remaining support code for this compiler. Note that the Solaris operating system continu

pgsql: Silence compiler warnings on clang 21

2025-09-11 Thread Peter Eisentraut
Silence compiler warnings on clang 21 Clang 21 shows some new compiler warnings, for example: warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] The fix is to initialize the variables when they are defined. This is similar

pgsql: Fix leak with SMgrRelations in startup process

2025-09-11 Thread Michael Paquier
Fix leak with SMgrRelations in startup process The startup process does not process shared invalidation messages, only sending them, and never calls AtEOXact_SMgr() which clean up any unpinned SMgrRelations. Hence, it is never able to free SMgrRelations on a periodic basis, bloating its hashtable

pgsql: meson: Build numeric.c with -ftree-vectorize.

2025-09-11 Thread Nathan Bossart
meson: Build numeric.c with -ftree-vectorize. autoconf builds have compiled this file with -ftree-vectorize since commit 8870917623, but meson builds seem to have missed the memo. Reviewed-by: Jeff Davis Discussion: https://postgr.es/m/aL85CeasM51-0D1h%40nathan Backpatch-through: 16 Branch

pgsql: Remove stray semicolon at global scope

2025-09-11 Thread Peter Eisentraut
Remove stray semicolon at global scope The Sun Studio compiler complains about an empty declaration here. Note for future historians: This does not mean that this compiler is still of current interest for anyone using PostgreSQL. But we can let this small fix be its parting gift. Reviewed-by: