pgsql: Fix assertion failure with latch wait in single-user mode

2025-07-25 Thread Michael Paquier
Fix assertion failure with latch wait in single-user mode LatchWaitSetPostmasterDeathPos, the latch event position for the postmaster death event, is initialized under IsUnderPostmaster. WaitLatch() considered it as a valid wait target in single-user mode (!IsUnderPostmaster), which was incorrect.

pgsql: Fix assertion failure with latch wait in single-user mode

2025-07-25 Thread Michael Paquier
Fix assertion failure with latch wait in single-user mode LatchWaitSetPostmasterDeathPos, the latch event position for the postmaster death event, is initialized under IsUnderPostmaster. WaitLatch() considered it as a valid wait target in single-user mode (!IsUnderPostmaster), which was incorrect.

pgsql: Fix background worker not restarting after crash-and-restart cyc

2025-07-25 Thread Fujii Masao
Fix background worker not restarting after crash-and-restart cycle. Previously, if a background worker crashed (e.g., due to a SIGKILL) and the server restarted due to restart_after_crash being enabled, the worker was not restarted as expected. Background workers without the never-restart flag sho

pgsql: Refactor grammar to create opt_utility_option_list

2025-07-25 Thread Álvaro Herrera
Refactor grammar to create opt_utility_option_list This changes the grammar for REINDEX, CHECKPOINT, CLUSTER, ANALYZE/ANALYSE; they still accept the same options as before, but the grammar is written differently for convenience of future development. Reviewed-by: Nathan Bossart Discussion: https

pgsql: Fix background worker not restarting after crash-and-restart cyc

2025-07-25 Thread Fujii Masao
Fix background worker not restarting after crash-and-restart cycle. Previously, if a background worker crashed (e.g., due to a SIGKILL) and the server restarted due to restart_after_crash being enabled, the worker was not restarted as expected. Background workers without the never-restart flag sho

pgsql: Reap the benefits of not having to avoid leaking PGresults.

2025-07-25 Thread Tom Lane
Reap the benefits of not having to avoid leaking PGresults. Remove a bunch of PG_TRY constructs, de-volatilize related variables, remove some PQclear calls in error paths. Aside from making the code simpler and shorter, this should provide some marginal performance gains. For ease of review, I di

pgsql: Create infrastructure to reliably prevent leakage of PGresults.

2025-07-25 Thread Tom Lane
Create infrastructure to reliably prevent leakage of PGresults. Commit 232d8caea fixed a case where postgres_fdw could lose track of a PGresult object, resulting in a process-lifespan memory leak. But I have little faith that there aren't other potential PGresult leakages, now or in future, in the

pgsql: Silence leakage complaint about postgres_fdw's InitPgFdwOptions.

2025-07-25 Thread Tom Lane
Silence leakage complaint about postgres_fdw's InitPgFdwOptions. Valgrind complains that the PQconninfoOption array returned by libpq is leaked. We apparently believed that we could suppress that warning by storing that array's address in a static variable. However, modern C compilers are bright

pgsql: Run pgindent on the changes of the previous patch.

2025-07-25 Thread Tom Lane
Run pgindent on the changes of the previous patch. This step can be checked mechanically. Author: Tom Lane Reviewed-by: Matheus Alcantara Discussion: https://postgr.es/m/2976982.1748049...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/73873805fb36

pgsql: Fix dynahash's HASH_FIXED_SIZE ("isfixed") option.

2025-07-25 Thread Tom Lane
Fix dynahash's HASH_FIXED_SIZE ("isfixed") option. This flag was effectively a no-op in EXEC_BACKEND (ie, Windows) builds, because it was kept in the process-local HTAB struct, and it could only ever become set in the postmaster's copy. The simplest fix is to move it to the shared HASHHDR struct.

pgsql: Add commit 73873805f to .git-blame-ignore-revs.

2025-07-25 Thread Tom Lane
Add commit 73873805f to .git-blame-ignore-revs. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/db6461b1c9aae122b90bb52430f06efb306b371a Modified Files -- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+)