pgsql: Add some sanity checks in executor for query ID reporting

2024-09-17 Thread Michael Paquier
Add some sanity checks in executor for query ID reporting This commit adds three sanity checks in code paths of the executor where it is possible to use hooks, checking that a query ID is reported in pg_stat_activity if compute_query_id is enabled: - ExecutorRun() - ExecutorFinish() - ExecutorEnd(

pgsql: postgres_fdw: Extend postgres_fdw_get_connections to return user

2024-09-17 Thread Fujii Masao
postgres_fdw: Extend postgres_fdw_get_connections to return user name. This commit adds a "user_name" output column to the postgres_fdw_get_connections function, returning the name of the local user mapped to the foreign server for each connection. If a public mapping is used, it returns "public."

pgsql: Extend PgStat_HashKey.objid from 4 to 8 bytes

2024-09-17 Thread Michael Paquier
Extend PgStat_HashKey.objid from 4 to 8 bytes This opens the possibility to define keys for more types of statistics kinds in PgStat_HashKey, the first case being 8-byte query IDs for statistics like pg_stat_statements. This increases the size of PgStat_HashKey from 12 to 16 bytes, while PgStatSh

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Don't enter parallel mode when holding interrupts.

2024-09-17 Thread Noah Misch
Don't enter parallel mode when holding interrupts. Doing so caused the leader to hang in wait_event=ParallelFinish, which required an immediate shutdown to resolve. Back-patch to v12 (all supported versions). Francesco Degrassi Discussion: https://postgr.es/m/CAC-SaSzHUKT=vzj8mpxydc_urpfax+yoa

pgsql: Add missing query ID reporting in extended query protocol

2024-09-17 Thread Michael Paquier
Add missing query ID reporting in extended query protocol This commit adds query ID reports for two code paths when processing extended query protocol messages: - When receiving a bind message, setting it to the first Query retrieved from a cached cache. - When receiving an execute message, settin

pgsql: Add missing query ID reporting in extended query protocol

2024-09-17 Thread Michael Paquier
Add missing query ID reporting in extended query protocol This commit adds query ID reports for two code paths when processing extended query protocol messages: - When receiving a bind message, setting it to the first Query retrieved from a cached cache. - When receiving an execute message, settin

pgsql: Add missing query ID reporting in extended query protocol

2024-09-17 Thread Michael Paquier
Add missing query ID reporting in extended query protocol This commit adds query ID reports for two code paths when processing extended query protocol messages: - When receiving a bind message, setting it to the first Query retrieved from a cached cache. - When receiving an execute message, settin

pgsql: Add missing query ID reporting in extended query protocol

2024-09-17 Thread Michael Paquier
Add missing query ID reporting in extended query protocol This commit adds query ID reports for two code paths when processing extended query protocol messages: - When receiving a bind message, setting it to the first Query retrieved from a cached cache. - When receiving an execute message, settin

pgsql: Add missing query ID reporting in extended query protocol

2024-09-17 Thread Michael Paquier
Add missing query ID reporting in extended query protocol This commit adds query ID reports for two code paths when processing extended query protocol messages: - When receiving a bind message, setting it to the first Query retrieved from a cached cache. - When receiving an execute message, settin

pgsql: Allow ReadStream to be consumed as raw block numbers.

2024-09-17 Thread Thomas Munro
Allow ReadStream to be consumed as raw block numbers. Commits 041b9680 and 6377e12a changed the interface of scan_analyze_next_block() to take a ReadStream instead of a BlockNumber and a BufferAccessStrategy, and to return a value to indicate when the stream has run out of blocks. This caused int

pgsql: Allow ReadStream to be consumed as raw block numbers.

2024-09-17 Thread Thomas Munro
Allow ReadStream to be consumed as raw block numbers. Commits 041b9680 and 6377e12a changed the interface of scan_analyze_next_block() to take a ReadStream instead of a BlockNumber and a BufferAccessStrategy, and to return a value to indicate when the stream has run out of blocks. This caused int

Re: pgsql: pg_upgrade: Parallelize retrieving relation information.

2024-09-17 Thread Alexander Korotkov
On Tue, Sep 17, 2024 at 12:11 AM Nathan Bossart wrote: > pg_upgrade: Parallelize retrieving relation information. > > This commit makes use of the new task framework in pg_upgrade to > parallelize retrieving relation and logical slot information. This > step will now process multiple databases co

Re: pgsql: Introduce framework for parallelizing various pg_upgrade tasks.

2024-09-17 Thread Alexander Korotkov
Hi! On Tue, Sep 17, 2024 at 12:11 AM Nathan Bossart wrote: > Introduce framework for parallelizing various pg_upgrade tasks. > > A number of pg_upgrade steps require connecting to every database > in the cluster and running the same query in each one. When there > are many databases, these steps

pgsql: Repair pg_upgrade for identity sequences with non-default persis

2024-09-17 Thread Tom Lane
Repair pg_upgrade for identity sequences with non-default persistence. Since we introduced unlogged sequences in v15, identity sequences have defaulted to having the same persistence as their owning table. However, it is possible to change that with ALTER SEQUENCE, and pg_dump tries to preserve th

pgsql: Repair pg_upgrade for identity sequences with non-default persis

2024-09-17 Thread Tom Lane
Repair pg_upgrade for identity sequences with non-default persistence. Since we introduced unlogged sequences in v15, identity sequences have defaulted to having the same persistence as their owning table. However, it is possible to change that with ALTER SEQUENCE, and pg_dump tries to preserve th

pgsql: Repair pg_upgrade for identity sequences with non-default persis

2024-09-17 Thread Tom Lane
Repair pg_upgrade for identity sequences with non-default persistence. Since we introduced unlogged sequences in v15, identity sequences have defaulted to having the same persistence as their owning table. However, it is possible to change that with ALTER SEQUENCE, and pg_dump tries to preserve th

pgsql: Repair pg_upgrade for identity sequences with non-default persis

2024-09-17 Thread Tom Lane
Repair pg_upgrade for identity sequences with non-default persistence. Since we introduced unlogged sequences in v15, identity sequences have defaulted to having the same persistence as their owning table. However, it is possible to change that with ALTER SEQUENCE, and pg_dump tries to preserve th

pgsql: Ensure standby promotion point in 043_wal_replay_wait.pl

2024-09-17 Thread Alexander Korotkov
Ensure standby promotion point in 043_wal_replay_wait.pl This commit ensures standby will be promoted at least at the primary insert LSN we have just observed. We use pg_switch_wal() to force the insert LSN to be written then wait for standby to catchup. Reported-by: Alexander Lakhin Discussion:

pgsql: Minor cleanup related to pg_wal_replay_wait() procedure

2024-09-17 Thread Alexander Korotkov
Minor cleanup related to pg_wal_replay_wait() procedure * Rename $node_standby1 to $node_standby in 043_wal_replay_wait.pl as there is only one standby. * Remove useless debug printing in 043_wal_replay_wait.pl. * Fix typo in one check description in 043_wal_replay_wait.pl. * Fix some wordi

pgsql: Avoid parallel nbtree index scan hangs with SAOPs.

2024-09-17 Thread Peter Geoghegan
Avoid parallel nbtree index scan hangs with SAOPs. Commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution, made parallel index scans work with the new design for arrays via explicit scheduling of primitive index scans. A backend that successfully scheduled the scan's next primitive index

pgsql: Avoid parallel nbtree index scan hangs with SAOPs.

2024-09-17 Thread Peter Geoghegan
Avoid parallel nbtree index scan hangs with SAOPs. Commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution, made parallel index scans work with the new design for arrays via explicit scheduling of primitive index scans. A backend that successfully scheduled the scan's next primitive index

Re: pgsql: scripts: add Perl script to add links to release notes

2024-09-17 Thread Andrew Dunstan
On 2024-09-16 Mo 1:27 PM, Bruce Momjian wrote: scripts: add Perl script to add links to release notes Reported-by: jian he Discussion:https://postgr.es/m/zuyss5xda7hvc...@momjian.us I realize I'm late to the party on this, but here's a review patch for this script. It's mostly stylistic c

pgsql: Add temporal PRIMARY KEY and UNIQUE constraints

2024-09-17 Thread Peter Eisentraut
Add temporal PRIMARY KEY and UNIQUE constraints Add WITHOUT OVERLAPS clause to PRIMARY KEY and UNIQUE constraints. These are backed by GiST indexes instead of B-tree indexes, since they are essentially exclusion constraints with = for the scalar parts of the key and && for the temporal part. (pre

pgsql: Add stratnum GiST support function

2024-09-17 Thread Peter Eisentraut
Add stratnum GiST support function This is support function 12 for the GiST AM and translates "well-known" RT*StrategyNumber values into whatever strategy number is used by the opclass (since no particular numbers are actually required). We will use this to support temporal PRIMARY KEY/UNIQUE/FOR

pgsql: Add temporal FOREIGN KEY contraints

2024-09-17 Thread Peter Eisentraut
Add temporal FOREIGN KEY contraints Add PERIOD clause to foreign key constraint definitions. This is supported for range and multirange types. Temporal foreign keys check for range containment instead of equality. This feature matches the behavior of the SQL standard temporal foreign keys, but