pgsql: Replace durable_rename_excl() by durable_rename(), take two

2024-12-19 Thread Michael Paquier
Replace durable_rename_excl() by durable_rename(), take two durable_rename_excl() attempts to avoid overwriting any existing files by using link() and unlink(), and it falls back to rename() on some platforms (aka WIN32), which offers no such overwrite protection. Most callers use durable_rename_

pgsql: Replace durable_rename_excl() by durable_rename(), take two

2024-12-19 Thread Michael Paquier
Replace durable_rename_excl() by durable_rename(), take two durable_rename_excl() attempts to avoid overwriting any existing files by using link() and unlink(), and it falls back to rename() on some platforms (aka WIN32), which offers no such overwrite protection. Most callers use durable_rename_

pgsql: Replace durable_rename_excl() by durable_rename(), take two

2024-12-19 Thread Michael Paquier
Replace durable_rename_excl() by durable_rename(), take two durable_rename_excl() attempts to avoid overwriting any existing files by using link() and unlink(), and it falls back to rename() on some platforms (aka WIN32), which offers no such overwrite protection. Most callers use durable_rename_

pgsql: Remove final mention of FREEZE_PAGE from comments

2024-12-19 Thread Melanie Plageman
Remove final mention of FREEZE_PAGE from comments b7493e1ab35 removed leftover mentions of XLOG_HEAP2_FREEZE_PAGE records from comments but neglected to remove one mention of FREEZE_PAGE. Reported off-list by Alexander Lakhin Branch -- master Details --- https://git.postgresql.org/pg/co

pgsql: Get rid of old version of BuildTupleHashTable().

2024-12-19 Thread Tom Lane
Get rid of old version of BuildTupleHashTable(). It was reasonable to preserve the old API of BuildTupleHashTable() in the back branches, but in HEAD we should actively discourage use of that version. There are no remaining callers in core, so just get rid of it. Then rename BuildTupleHashTableE

pgsql: Use ExecGetCommonSlotOps infrastructure in more places.

2024-12-19 Thread Tom Lane
Use ExecGetCommonSlotOps infrastructure in more places. Append, MergeAppend, and RecursiveUnion can all use the support functions added in commit 276279295. The first two can report a fixed result slot type if all their children return the same fixed slot type. That does nothing for the append s

pgsql: Convert SetOp to read its inputs as outerPlan and innerPlan.

2024-12-19 Thread Tom Lane
Convert SetOp to read its inputs as outerPlan and innerPlan. The original design for set operations involved appending the two input relations into one and adding a flag column that allows distinguishing which side each row came from. Then the SetOp node pries them apart again based on the flag.

pgsql: Improve planner's handling of SetOp plans.

2024-12-19 Thread Tom Lane
Improve planner's handling of SetOp plans. Remove the code for inserting flag columns in the inputs of a SetOp. That was the only reason why there would be resjunk columns in a set-operations plan tree, so we can get rid of some code that supported that, too. Get rid of choose_hashed_setop() in f

pgsql: Fix bitmap table scan crash on iterator release

2024-12-19 Thread Melanie Plageman
Fix bitmap table scan crash on iterator release 1a0da347a7ac98db replaced Bitmap Table Scan's individual private and shared iterators with a unified iterator. It neglected, however, to check if the iterator had already been cleaned up before doing so on rescan. Add this check both on rescan and en

pgsql: Remove extra prefetch iterator setup for Bitmap Table Scan

2024-12-19 Thread Melanie Plageman
Remove extra prefetch iterator setup for Bitmap Table Scan 1a0da347a7ac98db replaced Bitmap Table Scan's separate private and shared bitmap iterators with a unified iterator. It accidentally set up the prefetch iterator twice for non-parallel bitmap table scans. Remove the extra set up call to tbm

pgsql: Avoid nbtree index scan SAOP scanBehind confusion.

2024-12-19 Thread Peter Geoghegan
Avoid nbtree index scan SAOP scanBehind confusion. Consistently reset so->scanBehind at the beginning of nbtree array advancement, even during sktrig_required=false calls (calls where array advancement is triggered by an unsatisfied non-required array scan key). Otherwise, it's possible for querie

pgsql: Avoid nbtree index scan SAOP scanBehind confusion.

2024-12-19 Thread Peter Geoghegan
Avoid nbtree index scan SAOP scanBehind confusion. Consistently reset so->scanBehind at the beginning of nbtree array advancement, even during sktrig_required=false calls (calls where array advancement is triggered by an unsatisfied non-required array scan key). Otherwise, it's possible for querie

pgsql: bootstrap: pure parser and reentrant scanner

2024-12-19 Thread Peter Eisentraut
bootstrap: pure parser and reentrant scanner Use the flex %option reentrant and the bison option %pure-parser to make the generated scanner and parser pure, reentrant, and thread-safe. Make the generated scanner use palloc() etc. instead of malloc() etc. For the bootstrap scanner and parser, ree

pgsql: Small whitespace improvement

2024-12-19 Thread Peter Eisentraut
Small whitespace improvement Author: Andreas Karlsson Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/399d0f1e11b5438c6dc82e55a22a0f402855b2ac Modified File

Re: pgsql: seg: pure parser and reentrant scanner

2024-12-19 Thread Peter Eisentraut
On 18.12.24 17:57, Melanie Plageman wrote: On Wed, Dec 18, 2024 at 2:57 AM Peter Eisentraut wrote: seg: pure parser and reentrant scanner sifaka is failing [1] with cubescan.c:348:15: error: redefinition of typedef 'yyscan_t' is a C11 feature [-Werror,-Wtypedef-redefinition] 348 | typede

pgsql: Prevent redeclaration of typedef yyscan_t

2024-12-19 Thread Peter Eisentraut
Prevent redeclaration of typedef yyscan_t Fix for 1f0de66ea2a: We need to prevent redeclaration of typedef yyscan_t. (This will work with C11 but not currently with C99.) The generated scanner files provide their own typedef, but we also need to provide one for the interfaces that we expose. So