Re: pgsql: Modularize log_connections output

2025-03-12 Thread Daniel Westermann (DWE)
Hi, >> On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) >> wrote: >>> >>> great, thanks for this. One question: >>> The current log_connections options are 'receipt', 'authentication', and >>> 'authorization'. The empty string disables all connection logging. 'all' >>> enables a

pgsql: Avoid invalidating all RelationSyncCache entries on publication

2025-03-12 Thread Amit Kapila
Avoid invalidating all RelationSyncCache entries on publication rename. On Publication rename, we need to only invalidate the RelationSyncCache entries corresponding to relations that are part of the publication being renamed. As part of this patch, we introduce a new invalidation message to inva

pgsql: Refactor convert_case() to prepare for optimizations.

2025-03-12 Thread Jeff Davis
Refactor convert_case() to prepare for optimizations. Upcoming optimizations will add complexity to convert_case(). This patch reorganizes slightly so that the complexity can be contained within the logic to convert the case of a single character, rather than mixing it in with logic to iterate thr

pgsql: Fix read_stream.c for changing io_combine_limit.

2025-03-12 Thread Thomas Munro
Fix read_stream.c for changing io_combine_limit. In a couple of places, read_stream.c assumed that io_combine_limit would be stable during the lifetime of a stream. That is not true in at least one unusual case: streams held by CURSORs where you could change the GUC between FETCH commands, with u

pgsql: Fix read_stream.c for changing io_combine_limit.

2025-03-12 Thread Thomas Munro
Fix read_stream.c for changing io_combine_limit. In a couple of places, read_stream.c assumed that io_combine_limit would be stable during the lifetime of a stream. That is not true in at least one unusual case: streams held by CURSORs where you could change the GUC between FETCH commands, with u

pgsql: Fix copy-paste error in datum_to_jsonb_internal()

2025-03-12 Thread Amit Langote
Fix copy-paste error in datum_to_jsonb_internal() Commit 3c152a27b06 mistakenly repeated JSONTYPE_JSON in a condition, omitting JSONTYPE_CAST. As a result, datum_to_jsonb_internal() failed to reject inputs that were casts (e.g., from an enum to json as in the example below) when used as keys in JS

pgsql: Fix copy-paste error in datum_to_jsonb_internal()

2025-03-12 Thread Amit Langote
Fix copy-paste error in datum_to_jsonb_internal() Commit 3c152a27b06 mistakenly repeated JSONTYPE_JSON in a condition, omitting JSONTYPE_CAST. As a result, datum_to_jsonb_internal() failed to reject inputs that were casts (e.g., from an enum to json as in the example below) when used as keys in JS

pgsql: pg_rewind: Add dbname to primary_conninfo when using --write-rec

2025-03-12 Thread Masahiko Sawada
pg_rewind: Add dbname to primary_conninfo when using --write-recovery-conf. This commit enhances pg_rewind's --write-recovery-conf option to include the dbname in the generated primary_conninfo value when specified in the --source-server option. With this modification, the rewound server can conne

pgsql: Add b955df443 to .git-blame-ignore-revs

2025-03-12 Thread David Rowley
Add b955df443 to .git-blame-ignore-revs Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cdc1471cc7626ffd44416abe92d37de038a0a0ec Modified Files -- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+)

pgsql: Fix indentation issue

2025-03-12 Thread David Rowley
Fix indentation issue Introduced recently by 9e088f7dd Per buildfarm member koel Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b955df443405e056fd9047ef819a1465654f9d79 Modified Files -- contrib/pg_logicalinspect/pg_logicalinspect.c | 2 +- 1 file chan

pgsql: Fix compiler warning in pg_logicalinspect.

2025-03-12 Thread Masahiko Sawada
Fix compiler warning in pg_logicalinspect. Oversight in bd65cb3cd48. Reported-by: David Rowley Reported-by: Nathan Bossart Author: David Rowley Discussion: https://postgr.es/m/CAApHDvqrhFfnetbcwgGkJ=z63T8HfQ_OyP=vx8byixyxfkt...@mail.gmail.com Branch -- master Details --- https://git

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

2025-03-12 Thread Masahiko Sawada
On Tue, Mar 11, 2025 at 10:18 PM Tom Lane wrote: > > Masahiko Sawada writes: > > On Tue, Mar 11, 2025 at 7:08 PM David Rowley wrote: > >> This introduces a new compiler warning for compilers that don't know > >> the ereport(ERROR) does not return. > > > Thank you for the report. Can we generate

pgsql: Remove count_one_bits() in acl.c.

2025-03-12 Thread Nathan Bossart
Remove count_one_bits() in acl.c. The only caller, select_best_grantor(), can instead use pg_popcount64(). This isn't performance-critical code, but we might as well use the centralized implementation. While at it, add some test coverage for this part of select_best_grantor(). Reviewed-by: Álva

pgsql: Increase default effective_io_concurrency to 16

2025-03-12 Thread Melanie Plageman
Increase default effective_io_concurrency to 16 The default effective_io_concurrency has been 1 since it was introduced in b7b8f0b6096d2ab6e. Referencing the associated discussion [1], it seems 1 was chosen as a conservative value that seemed unlikely to cause regressions. Experimentation on high

pgsql: Handle interrupts while waiting on Append's async subplans

2025-03-12 Thread Heikki Linnakangas
Handle interrupts while waiting on Append's async subplans We did not wake up on interrupts while waiting on async events on an async-capable append node. For example, if you tried to cancel the query, nothing would happen until one of the async subplans becomes readable. To fix, add WL_LATCH_SET

pgsql: Rename alloc/free functions in reorderbuffer.c

2025-03-12 Thread Heikki Linnakangas
Rename alloc/free functions in reorderbuffer.c There used to be bespoken pools for these structs to reduce the palloc/pfree overhead, but that was ripped out a long time ago and replaced with the generic, cheaper generational memory allocator (commit a4ccc1cef5). The Get/Return terminology made se

pgsql: Handle interrupts while waiting on Append's async subplans

2025-03-12 Thread Heikki Linnakangas
Handle interrupts while waiting on Append's async subplans We did not wake up on interrupts while waiting on async events on an async-capable append node. For example, if you tried to cancel the query, nothing would happen until one of the async subplans becomes readable. To fix, add WL_LATCH_SET

pgsql: Handle interrupts while waiting on Append's async subplans

2025-03-12 Thread Heikki Linnakangas
Handle interrupts while waiting on Append's async subplans We did not wake up on interrupts while waiting on async events on an async-capable append node. For example, if you tried to cancel the query, nothing would happen until one of the async subplans becomes readable. To fix, add WL_LATCH_SET

pgsql: Handle interrupts while waiting on Append's async subplans

2025-03-12 Thread Heikki Linnakangas
Handle interrupts while waiting on Append's async subplans We did not wake up on interrupts while waiting on async events on an async-capable append node. For example, if you tried to cancel the query, nothing would happen until one of the async subplans becomes readable. To fix, add WL_LATCH_SET

pgsql: Handle interrupts while waiting on Append's async subplans

2025-03-12 Thread Heikki Linnakangas
Handle interrupts while waiting on Append's async subplans We did not wake up on interrupts while waiting on async events on an async-capable append node. For example, if you tried to cancel the query, nothing would happen until one of the async subplans becomes readable. To fix, add WL_LATCH_SET

Re: pgsql: Modularize log_connections output

2025-03-12 Thread Daniel Gustafsson
> On 12 Mar 2025, at 17:07, Melanie Plageman wrote: > > Thanks for taking a look! > > On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) > wrote: >> >> >> great, thanks for this. One question: >> >>> The current log_connections options are 'receipt', 'authentication', and >>> 'authoriz

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

2025-03-12 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

Re: pgsql: Modularize log_connections output

2025-03-12 Thread Melanie Plageman
Thanks for taking a look! On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) wrote: > > > great, thanks for this. One question: > > >The current log_connections options are 'receipt', 'authentication', and > >'authorization'. The empty string disables all connection logging. 'all' > >enable

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

2025-03-12 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

Re: pgsql: Modularize log_connections output

2025-03-12 Thread Daniel Westermann (DWE)
Hi, great, thanks for this. One question: >The current log_connections options are 'receipt', 'authentication', and >'authorization'. The empty string disables all connection logging. 'all' >enables all available connection logging. ... shouldn't this be added to tab completion as well? postgre

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

2025-03-12 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: Preserve RangeTblEntry.relid when expanding a view RTE.

2025-03-12 Thread Tom Lane
Preserve RangeTblEntry.relid when expanding a view RTE. When the rewriter converts an RTE_RELATION RTE for a view into an RTE_SUBQUERY RTE containing the view's defining query, leave the relid field alone instead of zeroing it. This allows the planner to tell that the subquery came from a view ra

pgsql: Preserve RangeTblEntry.relid when expanding a view RTE.

2025-03-12 Thread Tom Lane
Preserve RangeTblEntry.relid when expanding a view RTE. When the rewriter converts an RTE_RELATION RTE for a view into an RTE_SUBQUERY RTE containing the view's defining query, leave the relid field alone instead of zeroing it. This allows the planner to tell that the subquery came from a view ra

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

2025-03-12 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: Preserve RangeTblEntry.relid when expanding a view RTE.

2025-03-12 Thread Tom Lane
Preserve RangeTblEntry.relid when expanding a view RTE. When the rewriter converts an RTE_RELATION RTE for a view into an RTE_SUBQUERY RTE containing the view's defining query, leave the relid field alone instead of zeroing it. This allows the planner to tell that the subquery came from a view ra

pgsql: Modularize log_connections output

2025-03-12 Thread Melanie Plageman
Modularize log_connections output Convert the boolean log_connections GUC into a list GUC comprised of the connection aspects to log. This gives users more control over the volume and kind of connection logging. The current log_connections options are 'receipt', 'authentication', and 'authorizat

pgsql: Add connection establishment duration logging

2025-03-12 Thread Melanie Plageman
Add connection establishment duration logging Add log_connections option 'setup_durations' which logs durations of several key parts of connection establishment and backend setup. For an incoming connection, starting from when the postmaster gets a socket from accept() and ending when the forked

pgsql: Remove initialization from PendingBackendStats

2025-03-12 Thread Michael Paquier
Remove initialization from PendingBackendStats 9a8dd2c5a6d has added an initialization to PendingBackendStats, which has been causing compilation warnings in the buildfarm. This code does not strictly require it as PendingBackendStats is always initialized with memset(0), so let's remove it. Per

pgsql: Fix snapshot used in logical replication index lookup

2025-03-12 Thread Heikki Linnakangas
Fix snapshot used in logical replication index lookup The function calls GetLatestSnapshot() to acquire a fresh snapshot, makes it active, and was meant to pass it to table_tuple_lock(), but instead called GetLatestSnapshot() again to acquire yet another snapshot. It was harmless because the heap

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

2025-03-12 Thread David Rowley
On Wed, 12 Mar 2025 at 18:18, Tom Lane wrote: > I don't know of an easy way. I experimented with doing this: > > diff --git a/src/include/c.h b/src/include/c.h > index a14c6315162..467b1f58ae8 100644 > --- a/src/include/c.h > +++ b/src/include/c.h > @@ -315,7 +315,7 @@ > #elif defined(_MSC_VER)

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

2025-03-12 Thread David Rowley
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 Microsoft (R) C/C++ Optimizing C