pgsql: Swap order of extern/static and pg_nodiscard

2025-03-13 Thread Peter Eisentraut
Swap order of extern/static and pg_nodiscard When pg_nodiscard was first added, the C standard draft had it as a function specifier, and so the code comment about placement was written with that in mind. The final C23 standard has it as an attribute and the placement rules are a bit different for

pgsql: Improve buffer manager API for backend pin limits.

2025-03-13 Thread Thomas Munro
Improve buffer manager API for backend pin limits. Previously the support functions assumed that the caller needed one pin to make progress, and could optionally use some more, allowing enough for every connection to do the same. Add a couple more functions for callers that want to know: * what

pgsql: Fix ALTER SUBSCRIPTION ... SET PUBLICATION ... command.

2025-03-13 Thread Amit Kapila
Fix ALTER SUBSCRIPTION ... SET PUBLICATION ... command. The problem is that ALTER SUBSCRIPTION ... SET PUBLICATION ... will lead to restarting of apply worker and after the restart, the apply worker will use the existing slot and replication origin corresponding to the subscription. Now, it is pos

pgsql: Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input

2025-03-13 Thread Tom Lane
Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input. If the given input_type yields valid results from both get_element_type and get_array_type, initArrayResultAny believed the former and treated the input as an array type. However this is inconsistent with what get_promoted_array_ty

pgsql: Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input

2025-03-13 Thread Tom Lane
Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input. If the given input_type yields valid results from both get_element_type and get_array_type, initArrayResultAny believed the former and treated the input as an array type. However this is inconsistent with what get_promoted_array_ty

pgsql: Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input

2025-03-13 Thread Tom Lane
Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input. If the given input_type yields valid results from both get_element_type and get_array_type, initArrayResultAny believed the former and treated the input as an array type. However this is inconsistent with what get_promoted_array_ty

pgsql: Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input

2025-03-13 Thread Tom Lane
Fix ARRAY_SUBLINK and ARRAY[] for int2vector and oidvector input. If the given input_type yields valid results from both get_element_type and get_array_type, initArrayResultAny believed the former and treated the input as an array type. However this is inconsistent with what get_promoted_array_ty

pgsql: Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES

2025-03-13 Thread Tom Lane
Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. Letting the rewriter keep RangeTblEntry.relid when expanding a view RTE, without making the outfuncs/readfuncs changes that went along with that originally, is more problematic than I realized. It causes WRITE_READ_PARSE_PLAN_TREES

pgsql: ATExecSetRelOptions: Reduce scope of 'isnull' variable

2025-03-13 Thread Álvaro Herrera
ATExecSetRelOptions: Reduce scope of 'isnull' variable Author: Nikolay Shaplov Reviewed-by: Timur Magomedov Discussion: https://postgr.es/m/1913854.tdWV9SEqCh@thinkpad-pgpro Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c7fc8808a91ed1b5810abb5f6043be7b6d58dbcf

pgsql: Doc: improve description of window function processing.

2025-03-13 Thread Tom Lane
Doc: improve description of window function processing. The previous wording talked about a "single pass over the data", which can be read as promising more than intended (to wit, that only one WindowAgg plan node will be used). What we promise is only what the SQL spec requires, namely that the

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-03-13 Thread Peter Eisentraut
On 12.03.25 09:37, David Rowley wrote: On Wed, 12 Mar 2025 at 21:15, Peter Eisentraut wrote: On 12.03.25 03:08, David Rowley wrote: This introduces a new compiler warning for compilers that don't know the ereport(ERROR) does not return. Which compiler is that? C:\Users\drowley\pg_src>cl M

pgsql: Build whole-row Vars the same way during parsing and planning.

2025-03-13 Thread Tom Lane
Build whole-row Vars the same way during parsing and planning. makeWholeRowVar() has different rules for constructing a whole-row Var depending on the kind of RTE it's representing. This turns out to be problematic because the rewriter and planner can convert view RTEs and set-returning-function R

pgsql: Prepare for Python "Limited API" in PL/Python

2025-03-13 Thread Peter Eisentraut
Prepare for Python "Limited API" in PL/Python Using the Python Limited API would allow building PL/Python against any Python 3.x version and using another Python 3.x version at run time. This commit does not activate that, but it prepares the code to only use APIs supported by the Limited API. I

pgsql: Make lwlocknames.h generated file less ugly

2025-03-13 Thread Álvaro Herrera
Make lwlocknames.h generated file less ugly We can make the output look a bit better by aligning each lock's definition, so add some padding space to achieve that. This change makes no practical difference, but casual onlookers will be less distracted by (lack of) whitespace. Author: Gurjeet Sin

pgsql: Add reverse(bytea).

2025-03-13 Thread Nathan Bossart
Add reverse(bytea). This commit introduces a function for reversing the order of the bytes in binary strings. Bumps catversion. Author: Aleksander Alekseev Discussion: https://postgr.es/m/CAJ7c6TMe0QVRuNssUArbMi0bJJK32%2BzNA3at5m3osrBQ25MHuw%40mail.gmail.com Branch -- master Details

pgsql: Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES

2025-03-13 Thread Tom Lane
Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. Letting the rewriter keep RangeTblEntry.relid when expanding a view RTE, without making the outfuncs/readfuncs changes that went along with that originally, is more problematic than I realized. It causes WRITE_READ_PARSE_PLAN_TREES

pgsql: Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES

2025-03-13 Thread Tom Lane
Repair commits 317aba70e et al for -DWRITE_READ_PARSE_PLAN_TREES. Letting the rewriter keep RangeTblEntry.relid when expanding a view RTE, without making the outfuncs/readfuncs changes that went along with that originally, is more problematic than I realized. It causes WRITE_READ_PARSE_PLAN_TREES

pgsql: Fix copy-and-paste mistake in error message

2025-03-13 Thread Peter Eisentraut
Fix copy-and-paste mistake in error message Introduced in commit a68159ff2b3. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bb25276205b45b60b5a1ddb7db3b66f501a02164 Modified Files -- src/backend/storage/file/fd.c | 2 +- 1 file changed, 1 insertion(+),

pgsql: pg_noreturn to replace pg_attribute_noreturn()

2025-03-13 Thread Peter Eisentraut
pg_noreturn to replace pg_attribute_noreturn() We want to support a "noreturn" decoration on more compilers besides just GCC-compatible ones, but for that we need to move the decoration in front of the function declaration instead of either behind it or wherever, which is the current style afforde

pgsql: Build whole-row Vars the same way during parsing and planning.

2025-03-13 Thread Tom Lane
Build whole-row Vars the same way during parsing and planning. makeWholeRowVar() has different rules for constructing a whole-row Var depending on the kind of RTE it's representing. This turns out to be problematic because the rewriter and planner can convert view RTEs and set-returning-function R

pgsql: Remove code setting wrap_non_vars to true for UNION ALL subqueri

2025-03-13 Thread Richard Guo
Remove code setting wrap_non_vars to true for UNION ALL subqueries In pull_up_simple_subquery and pull_up_constant_function, there is code that sets wrap_non_vars to true when dealing with an appendrel member. The goal is to wrap subquery outputs that are not simple Vars in PlaceHolderVars, ensur

pgsql: Fix incorrect handling of subquery pullup

2025-03-13 Thread Richard Guo
Fix incorrect handling of subquery pullup When pulling up a subquery, if the subquery's target list items are used in grouping set columns, we need to wrap them in PlaceHolderVars. This ensures that expressions retain their separate identity so that they will match grouping set columns when approp