pgsql: Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock wher

2025-08-28 Thread Masahiko Sawada
Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock where possible. Previously, we used LW_EXCLUSIVE in several places despite only reading WalSummarizerCtl fields. This patch reduces the lock level to LW_SHARED where we are only reading the shared fields. Backpatch to 17, where wal summa

pgsql: Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock wher

2025-08-28 Thread Masahiko Sawada
Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock where possible. Previously, we used LW_EXCLUSIVE in several places despite only reading WalSummarizerCtl fields. This patch reduces the lock level to LW_SHARED where we are only reading the shared fields. Backpatch to 17, where wal summa

pgsql: Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock wher

2025-08-28 Thread Masahiko Sawada
Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock where possible. Previously, we used LW_EXCLUSIVE in several places despite only reading WalSummarizerCtl fields. This patch reduces the lock level to LW_SHARED where we are only reading the shared fields. Backpatch to 17, where wal summa

pgsql: Avoid including commands/dbcommands.h in so many places

2025-08-28 Thread Álvaro Herrera
Avoid including commands/dbcommands.h in so many places This has been done historically because of get_database_name (which since commit cb98e6fb8fd4 belongs in lsyscache.c/h, so let's move it there) and get_database_oid (which is in the right place, but whose declaration should appear in pg_datab

pgsql: Fix "variable not found in subplan target lists" in semijoin de-

2025-08-28 Thread Tom Lane
Fix "variable not found in subplan target lists" in semijoin de-duplication. One mechanism we have for implementing semi-joins is to de-duplicate the output of the RHS and then treat the join as a plain inner join. Initial construction of the join's SpecialJoinInfo identifies the RHS columns that

pgsql: Fix "variable not found in subplan target lists" in semijoin de-

2025-08-28 Thread Tom Lane
Fix "variable not found in subplan target lists" in semijoin de-duplication. One mechanism we have for implementing semi-joins is to de-duplicate the output of the RHS and then treat the join as a plain inner join. Initial construction of the join's SpecialJoinInfo identifies the RHS columns that

pgsql: Glossary: improve definition of "relation"

2025-08-28 Thread Álvaro Herrera
Glossary: improve definition of "relation" Define the more general term first, then the Postgres-specific meaning. Wording from Tom Lane. Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=c3m...@mail.gmail.com Branch -- master Details --- https://git.postgre

pgsql: Fix semijoin unique-ification for child relations

2025-08-28 Thread Richard Guo
Fix semijoin unique-ification for child relations For a child relation, we should not assume that its parent's unique-ified relation (or unique-ified path in v18) always exists. In cases where all RHS columns that need to be unique-ified are equated to constants, the unique-ified relation/path fo

pgsql: Remove unneeded casts of BufferGetPage() result

2025-08-28 Thread Peter Eisentraut
Remove unneeded casts of BufferGetPage() result BufferGetPage() already returns type Page, so casting it to Page doesn't achieve anything. A sizable number of call sites does this casting; remove that. This was already done inconsistently in the code in the first import in 1996 (but didn't exist

pgsql: Fix semijoin unique-ification for child relations

2025-08-28 Thread Richard Guo
Fix semijoin unique-ification for child relations For a child relation, we should not assume that its parent's unique-ified relation (or unique-ified path in v18) always exists. In cases where all RHS columns that need to be unique-ified are equated to constants, the unique-ified relation/path fo

pgsql: Mark ItemPointer arguments as const in tuple/table lock function

2025-08-28 Thread Peter Eisentraut
Mark ItemPointer arguments as const in tuple/table lock functions The functions LockTuple, ConditionalLockTuple, UnlockTuple, and XactLockTableWait take an ItemPointer argument that they do not modify, so the argument can be const-qualified to better convey intent and allow the compiler to enforce

pgsql: Message style improvements

2025-08-28 Thread Peter Eisentraut
Message style improvements An improvement pass over the new stats import functionality. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/80f11061323499ef2d07af32ae993473115ca176 Modified Files -- src/backend/statistics/attribute_stats.c | 25 +++---

pgsql: Message style improvements

2025-08-28 Thread Peter Eisentraut
Message style improvements An improvement pass over the new stats import functionality. Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/663eecb5b6166b1a41276819affa38ba27951b5e Modified Files -- src/backend/statistics/attribute_stats.c | 25 +++