pgsql: Remove an obsolete comment in gistinsert()

2024-11-06 Thread Michael Paquier
Remove an obsolete comment in gistinsert() This is inconsistent since 1f7ef548ec2e where the definition of gistFormTuple() has changed. Author: Tender Wang Reviewed-by: Aleksander Alekseev Discussion: https://postgr.es/m/CAHewXNkjU95_HdioDVU=5yBq_Xt=GfBv=od-0oktia006pw...@mail.gmail.com Branch

pgsql: Improve handling of empty query results in BackgroundPsql::query

2024-11-06 Thread Michael Paquier
when using BackgroundPsql. Author: Jacob Champion Reviewed-by: Andrew Dunstan, Michael Paquier Discussion: https://postgr.es/m/CAOYmi+=60deN20WDyCoHCiecgivJxr=98s7s7-c8skxwrcf...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: Extend Cluster.pm's background_psql() to be able to start asynch

2024-11-05 Thread Michael Paquier
Extend Cluster.pm's background_psql() to be able to start asynchronously This commit extends the constructor routine of BackgroundPsql.pm with a new "wait" parameter. If set to 0, the routine returns without waiting for psql to start, ready to consume input. background_psql() in Cluster.pm gains

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
scope of a bug fix, so backpatch down to 15 where this has been introduced. Author: Bertrand Drouvot Reviewed-by: Jelte Fennema-Nio, Michael Paquier Discussion: https://postgr.es/m/zyb7rw1y9dvfo...@ip-10-97-1-34.eu-west-3.compute.internal Backpatch-through: 15 Branch -- REL_16_STABLE Details

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
scope of a bug fix, so backpatch down to 15 where this has been introduced. Author: Bertrand Drouvot Reviewed-by: Jelte Fennema-Nio, Michael Paquier Discussion: https://postgr.es/m/zyb7rw1y9dvfo...@ip-10-97-1-34.eu-west-3.compute.internal Backpatch-through: 15 Branch -- REL_15_STABLE Details

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
scope of a bug fix, so backpatch down to 15 where this has been introduced. Author: Bertrand Drouvot Reviewed-by: Jelte Fennema-Nio, Michael Paquier Discussion: https://postgr.es/m/zyb7rw1y9dvfo...@ip-10-97-1-34.eu-west-3.compute.internal Backpatch-through: 15 Branch -- master Details

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
scope of a bug fix, so backpatch down to 15 where this has been introduced. Author: Bertrand Drouvot Reviewed-by: Jelte Fennema-Nio, Michael Paquier Discussion: https://postgr.es/m/zyb7rw1y9dvfo...@ip-10-97-1-34.eu-west-3.compute.internal Backpatch-through: 15 Branch -- REL_17_STABLE Details

pgsql: Add missing newlines at the end of two SQL files

2024-11-03 Thread Michael Paquier
Add missing newlines at the end of two SQL files arrays.sql was already missing it before 49d6c7d8daba, and I have just noticed it thanks to this commit. The second one in test_slru has been introduced by 768a9fd5535f. Branch -- master Details --- https://git.postgresql.org/pg/commitdif

pgsql: Remove use of pg_memory_is_all_zeros() in bufpage.c

2024-11-01 Thread Michael Paquier
Remove use of pg_memory_is_all_zeros() in bufpage.c After a closer lookup, this makes the all-zero check of the page more expensive, so let's remove the new function call in bufpage.c. The maths of the check were also incorrect, checking that the page was full of zeros only for the first 1kB. Th

pgsql: Add pg_memory_is_all_zeros() in memutils.h

2024-10-31 Thread Michael Paquier
Add pg_memory_is_all_zeros() in memutils.h This new function tests if a memory region starting at a given location for a defined length is made only of zeroes. This unifies in a single path the all-zero checks that were happening in a couple of places of the backend code: - For pgstats entries of

Re: pgsql: Make all ereport() calls within gram.y provide error locations.

2024-10-31 Thread Michael Paquier
Hi Tom, On Thu, Oct 31, 2024 at 08:09:38PM +, Tom Lane wrote: > Make all ereport() calls within gram.y provide error locations. > > This patch responds to a comment that I (tgl) made in the > discussion leading up to 774171c4f, that really all errors > occurring during raw parsing should prov

pgsql: Add SQL function array_reverse()

2024-10-31 Thread Michael Paquier
Add SQL function array_reverse() This function takes in input an array, and reverses the position of all its elements. This operation only affects the first dimension of the array, like array_shuffle(). The implementation structure is inspired by array_shuffle(), with a subroutine called array_r

pgsql: injection_points: Improve comment about disabled isolation permu

2024-10-30 Thread Michael Paquier
injection_points: Improve comment about disabled isolation permutation 9f00edc22888 has disabled a permutation due to failures in the CI for FreeBSD environments, but this is a matter of timing. Let's document properly why this type of permutation is a bad idea if relying on a wait done in a SQL

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-29 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-28 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-28 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-28 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-28 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: doc: Add better description for rewrite functions in event trigg

2024-10-28 Thread Michael Paquier
doc: Add better description for rewrite functions in event triggers There are two functions that can be used in event triggers to get more details about a rewrite happening on a relation. Both had a limited documentation: - pg_event_trigger_table_rewrite_reason() and pg_event_trigger_table_rewrit

pgsql: Fix dependency of partitioned table and table AM with CREATE TAB

2024-10-28 Thread Michael Paquier
Fix dependency of partitioned table and table AM with CREATE TABLE .. USING A pg_depend entry between a partitioned table and its table access method was missing when using CREATE TABLE .. USING with an unpinned access method. DROP ACCESS METHOD could be used, while it should be blocked if CASCAD

pgsql: Fix dependency of partitioned table and table AM with CREATE TAB

2024-10-28 Thread Michael Paquier
Fix dependency of partitioned table and table AM with CREATE TABLE .. USING A pg_depend entry between a partitioned table and its table access method was missing when using CREATE TABLE .. USING with an unpinned access method. DROP ACCESS METHOD could be used, while it should be blocked if CASCAD

pgsql: Set query ID for inner queries of CREATE TABLE AS and DECLARE

2024-10-27 Thread Michael Paquier
pg_stat_statements, this commit leads to additions under !toplevel when pg_stat_statements.track is set to "all", as shown in its regression tests. The output of EXPLAIN for these two utilities gains a "Query Identifier" if compute_query_id is enabled. Author: Anthonin Bonnefoy

pgsql: Refactor code converting a publication name List to a StringInfo

2024-10-24 Thread Michael Paquier
. fetch_remote_table_info() was doing two List->StringInfo conversions when dealing with a server of version 15 or newer. The conversion happens only once now. This refactoring leads to less code overall. Author: Peter Smith Reviewed-by: Michael Paquier, Masahiko Sawada Discussion: https://postgr.es/m/CA

pgsql: Add install rules for Kerberos.pm and AdjustUpgrade.pm

2024-10-24 Thread Michael Paquier
Add install rules for Kerberos.pm and AdjustUpgrade.pm For the same reasons as c3a0818460a8, these can be useful for out-of-core extension testing. Kerberos.pm has been moved to its current path recently in 9f899562d420, and AdjustUpgrade.pm has been introduced in 52585f8f072a, still both lacked

pgsql: injection_points: Disable one permutation in isolation test "bas

2024-10-24 Thread Michael Paquier
injection_points: Disable one permutation in isolation test "basic" The first permutation done in the test does a wait, a wakeup then a detach. It is proving to be unstable in the CI for FreeBSD (Windows and Linux are stable). The failure shows that the wait is so slow to finish after being woke

pgsql: Track more precisely query locations for nested statements

2024-10-23 Thread Michael Paquier
produce differences reflecting the new logic. Author: Anthonin Bonnefoy Reviewed-by: Michael Paquier, Jian He Discussion: https://postgr.es/m/CAO6_XqqM6S9bQ2qd=75w+ykatwoazxsnhv5sjw06fjgathb...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: pg_stat_statements: Add tests for nested queries with level trac

2024-10-21 Thread Michael Paquier
part is right) and a second one for the inner query in the EXPLAIN (this part is not right). A couple of patches are under discussion to improve the situation, and all the tests added here will prove useful to evaluate the changes discussed. Author: Anthonin Bonnefoy Reviewed-by: Michael Paquier

pgsql: injection_points: Add basic isolation test

2024-10-20 Thread Michael Paquier
injection_points: Add basic isolation test This test can act as a template when implementing an isolation test with injection points, and tracks in a much simpler way some of the behaviors implied in the existing isolation test "inplace" that has been added in c35f419d6efb. Particularly, a detach

pgsql: Fix grammar of a comment in bufmgr.c

2024-10-20 Thread Michael Paquier
Fix grammar of a comment in bufmgr.c Author: Junwang Zhao Discussion: https://postgr.es/m/caeg8a3l5yjxxcjx0lhkwhddgsngpfgeqh7sqtxrpnp+dwfm...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/57a36e890d3d60e6408bf6805e91c82f7b370873 Modified Files ---

pgsql: Fix description of PostgreSQL::Test::Cluster::wait_for_event()

2024-10-17 Thread Michael Paquier
Fix description of PostgreSQL::Test::Cluster::wait_for_event() The arguments of the function were listed in an incorrect order in the description of the routine. This information can be seen with perldoc. Issue spotted while working on this area of the code. Backpatch-through: 17 Branch --

pgsql: Fix description of PostgreSQL::Test::Cluster::wait_for_event()

2024-10-17 Thread Michael Paquier
Fix description of PostgreSQL::Test::Cluster::wait_for_event() The arguments of the function were listed in an incorrect order in the description of the routine. This information can be seen with perldoc. Issue spotted while working on this area of the code. Backpatch-through: 17 Branch --

pgsql: Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-col

2024-10-16 Thread Michael Paquier
Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-column cases This commit adds missing checks for COPY FORCE_NOT_NULL and FORCE_NULL when applied to all columns via "*". These options now correctly require CSV mode and are disallowed in COPY TO, making their behavior consistent with F

pgsql: Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-col

2024-10-16 Thread Michael Paquier
Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-column cases This commit adds missing checks for COPY FORCE_NOT_NULL and FORCE_NULL when applied to all columns via "*". These options now correctly require CSV mode and are disallowed in COPY TO, making their behavior consistent with F

pgsql: Rewrite some regression queries for option checks with COPY

2024-10-16 Thread Michael Paquier
Rewrite some regression queries for option checks with COPY Some queries in copy2 are there to check various option combinations, and used "stdin" or "stdout" incompatible with the COPY TO or FROM clauses combined with them, which was confusing. This commit rewrites these queries to use a compati

pgsql: Rewrite some regression queries for option checks with COPY

2024-10-16 Thread Michael Paquier
Rewrite some regression queries for option checks with COPY Some queries in copy2 are there to check various option combinations, and used "stdin" or "stdout" incompatible with the COPY TO or FROM clauses combined with them, which was confusing. This commit rewrites these queries to use a compati

pgsql: Rewrite some regression queries for option checks with COPY

2024-10-16 Thread Michael Paquier
Rewrite some regression queries for option checks with COPY Some queries in copy2 are there to check various option combinations, and used "stdin" or "stdout" incompatible with the COPY TO or FROM clauses combined with them, which was confusing. This commit rewrites these queries to use a compati

pgsql: psql: Fix \watch when using interval values less than 1ms

2024-10-13 Thread Michael Paquier
ort an interval value of 0. Reported-by: Heikki Linnakangas Author: Andrey M. Borodin, Michael Paquier Discussion: https://postgr.es/m/88445e0e-3156-4b9d-afae-9a1a7b163...@iki.fi Backpatch-through: 16 Branch -- REL_17_STABLE Details --- https://git.postgresql.or

pgsql: psql: Fix \watch when using interval values less than 1ms

2024-10-13 Thread Michael Paquier
ort an interval value of 0. Reported-by: Heikki Linnakangas Author: Andrey M. Borodin, Michael Paquier Discussion: https://postgr.es/m/88445e0e-3156-4b9d-afae-9a1a7b163...@iki.fi Backpatch-through: 16 Branch -- REL_16_STABLE Details --- https://git.postgresql.or

pgsql: psql: Fix \watch when using interval values less than 1ms

2024-10-13 Thread Michael Paquier
ort an interval value of 0. Reported-by: Heikki Linnakangas Author: Andrey M. Borodin, Michael Paquier Discussion: https://postgr.es/m/88445e0e-3156-4b9d-afae-9a1a7b163...@iki.fi Backpatch-through: 16 Branch -- master Details --- https://git.postgresql.or

pgsql: Use MAX_PARALLEL_WORKER_LIMIT for max_parallel_maintenance_worke

2024-10-12 Thread Michael Paquier
Use MAX_PARALLEL_WORKER_LIMIT for max_parallel_maintenance_workers max_parallel_maintenance_workers has been introduced in 9da0cc35284b, and used a hardcoded limit of 1024 rather than this variable. max_parallel_workers and max_parallel_workers_per_gather already used MAX_PARALLEL_WORKER_LIMIT (1

pgsql: Apply GUC name from central table in more places of guc.c

2024-10-09 Thread Michael Paquier
. Few GUCs mix character casing in core; one test is added for one of these code paths with "IntervalStyle". Author: Peter Smith, Michael Paquier Discussion: https://postgr.es/m/zwnh4vkc2nhjh...@paquier.xyz Branch -- master Details --- https://git.pos

pgsql: pg_stat_statements: Add columns to track parallel worker activit

2024-10-08 Thread Michael Paquier
pg_stat_statements: Add columns to track parallel worker activity The view pg_stat_statements gains two columns: - parallel_workers_to_launch, the number of parallel workers planned to be launched. - parallel_workers_launched, the number of parallel workers actually launched. The ratio of both co

pgsql: Introduce two fields in EState to track parallel worker activity

2024-10-08 Thread Michael Paquier
Introduce two fields in EState to track parallel worker activity These fields can be set by executor nodes to record how many parallel workers were planned to be launched and how many of them have been actually launched within the number initially planned. This data is able to give an approximati

pgsql: Improve style of two code paths

2024-10-07 Thread Michael Paquier
Improve style of two code paths In execGrouping.c, execTuplesMatchPrepare() was doing a memory allocation that was not necessary when the number of columns was 0. In foreign.c, pg_options_to_table() was assigning twice a variable to the same value. Author: Ranier Vilela Discussion: https://postg

pgsql: doc: Add minimal C and SQL example to add a custom table AM hand

2024-10-06 Thread Michael Paquier
doc: Add minimal C and SQL example to add a custom table AM handler The documentation was rather sparse on this matter and there is no extension in-core that shows how to do it. Adding a small example will hopefully help newcomers. An advantage of writing things this way is that the contents are

pgsql: Use camel case for "DateStyle" in some error messages

2024-10-06 Thread Michael Paquier
Use camel case for "DateStyle" in some error messages This GUC is written as camel-case in most of the documentation and the GUC table (but not postgresql.conf.sample), and two error messages hardcoded it with lower case characters. Let's use a style more consistent. Most of the noise comes from

pgsql: libpq: Discard leading and trailing spaces for parameters and va

2024-10-06 Thread Michael Paquier
libpq: Discard leading and trailing spaces for parameters and values in URIs Integer values applied a parsing rule through pqParseIntParam() that made URIs like this one working, even if these include spaces around values: "postgresql://localhost:5432/postgres?keepalives=1 &keepalives_idle=1 " Th

pgsql: Remove assertion checking query ID in execMain.c

2024-10-03 Thread Michael Paquier
Remove assertion checking query ID in execMain.c This assertion has been added by 24f520594809, but Alexander Lakhin has proved that the ExecutorRun() one can be broken by using a PL function that manipulates compute_query_id and track_activities, while the ones in ExecutorFinish() and ExecutorEnd

pgsql: Remove support for unlogged on partitioned tables

2024-10-02 Thread Michael Paquier
server versions. pgbench needs a tweak for --unlogged and --partitions=N to ignore the UNLOGGED option on the partitioned tables created, its partitions still being unlogged. Author: Michael Paquier Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/ziiygftbnkqcm...@paquier.xyz Branch

pgsql: doc: Clarify name of files generated by pg_waldump --save-fullpa

2024-10-01 Thread Michael Paquier
doc: Clarify name of files generated by pg_waldump --save-fullpage The fork name is always separated with the block number by an underscore in the names of the files generated, but the docs stuck them together without a separator, which was confusing. Author: Christoph Berg Discussion: https://po

pgsql: doc: Clarify name of files generated by pg_waldump --save-fullpa

2024-10-01 Thread Michael Paquier
doc: Clarify name of files generated by pg_waldump --save-fullpage The fork name is always separated with the block number by an underscore in the names of the files generated, but the docs stuck them together without a separator, which was confusing. Author: Christoph Berg Discussion: https://po

pgsql: doc: Clarify name of files generated by pg_waldump --save-fullpa

2024-10-01 Thread Michael Paquier
doc: Clarify name of files generated by pg_waldump --save-fullpage The fork name is always separated with the block number by an underscore in the names of the files generated, but the docs stuck them together without a separator, which was confusing. Author: Christoph Berg Discussion: https://po

Re: pgsql: Doc: replace unnecessary non-breaking space with ordinal space.

2024-10-01 Thread Michael Paquier
On Tue, Oct 01, 2024 at 04:32:23PM +0900, Tatsuo Ishii wrote: > Thank you for letting know me. I pushed it. But I noticed that now > the commit's author time and commit time are different after pushed > it. Should I revert ot and push it again? You have applied a cherry-pick, from what I can see

Re: pgsql: Doc: replace unnecessary non-breaking space with ordinal space.

2024-09-30 Thread Michael Paquier
Ishii-san, On Tue, Oct 01, 2024 at 03:00:15AM +, Tatsuo Ishii wrote: > Doc: replace unnecessary non-breaking space with ordinal space. > > There were unnecessary non-breaking spaces (nbsp, U+00A0, 0xc2a0 in > UTF-8) in the docs. This commit replaces them with ASCII spaces > (0x20). > > conf

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Fix race condition in COMMIT PREPARED causing orphaned 2PC files

2024-09-30 Thread Michael Paquier
Fix race condition in COMMIT PREPARED causing orphaned 2PC files COMMIT PREPARED removes on-disk 2PC files near its end, but the state checked if a file is on-disk or not gets read from shared memory while not holding the two-phase state lock. Because of that, there was a small window where a sec

pgsql: Expand assertion check for query ID reporting in executor

2024-09-30 Thread Michael Paquier
Expand assertion check for query ID reporting in executor As formulated, the assertion added in the executor by 24f520594809 to check that a query ID is set had two problems: - track_activities may be disabled while compute_query_id is enabled, causing the query ID to not be reported to pg_stat_ac

pgsql: Bump catalog version for change in VariableSetStmt

2024-09-29 Thread Michael Paquier
Bump catalog version for change in VariableSetStmt Oversight in dc68515968e8, as this breaks SQL functions with a SET command. Reported-by: Tom Lane Discussion: https://postgr.es/m/1364409.1727673...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4c7

Re: pgsql: Show values of SET statements as constants in pg_stat_statements

2024-09-29 Thread Michael Paquier
On Mon, Sep 30, 2024 at 01:16:47AM -0400, Tom Lane wrote: > Shouldn't this have included a catversion bump? The parsenodes.h > change would for example break new-style SQL functions that include > a SET command. Probably a narrow use-case, but still. Hmm, yeah. I was wondering if I needed a bum

pgsql: Show values of SET statements as constants in pg_stat_statements

2024-09-29 Thread Michael Paquier
of the existing SET patterns. The expected output of these tests shows the difference this commit creates. Normalization could be perhaps applied to more portions of the grammar but what is done here is conservative, and good enough as a starting point. Author: Greg Sabino Mullane, Michael

pgsql: Set query ID in parallel workers for vacuum, BRIN and btree

2024-09-29 Thread Michael Paquier
Set query ID in parallel workers for vacuum, BRIN and btree All these code paths use their own entry point when starting parallel workers, but failed to set a query ID, even if they set a text query. Hence, this data would be missed in pg_stat_activity for the worker processes. The main entry poi

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-09-26 Thread Michael Paquier
On Fri, Sep 27, 2024 at 01:35:23PM +0900, Michael Paquier wrote: > I would suggest to keep things simple and have one single function > rather than introduce two more pg_proc entries with slight differences > in their error reporting, making the original function return a text > abou

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-09-26 Thread Michael Paquier
On Fri, Sep 20, 2024 at 03:00:20PM +0300, Alexander Korotkov wrote: > Please, check the attached patchset for implementation of proposed approach. 0001 looks like it requires an indentation in its .h diffs. +typedef enum +{ + WaitLSNResultSuccess, /* Target LSN is reached */ + WaitLSN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix incorrect memory access in VACUUM FULL with invalid toast in

2024-09-26 Thread Michael Paquier
Fix incorrect memory access in VACUUM FULL with invalid toast indexes An invalid toast index is skipped in reindex_relation(). These would be remnants of a failed REINDEX CONCURRENTLY and they should never been rebuilt as there can only be one valid toast index at a time. REINDEX_REL_SUPPRESS_IN

pgsql: Fix catalog data of new LO privilege functions

2024-09-26 Thread Michael Paquier
Fix catalog data of new LO privilege functions This commit improves the catalog data in pg_proc for the three functions for has_largeobject_privilege(), introduced in 4eada203a5a8: - Fix their descriptions (typos and consistency). - Reallocate OIDs to be within the 8000- range as required by a

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-09-26 Thread Michael Paquier
On Thu, Sep 26, 2024 at 06:41:18PM +0300, Alexander Korotkov wrote: > On Thu, Sep 26, 2024 at 11:19 AM Michael Paquier wrote: >> Please use something in the 8000- range, as required by >> 98eab30b93d5. > > Fixed, sorry for messing this up. Thanks for taking car

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-09-26 Thread Michael Paquier
Hi Alexander, On Fri, Aug 02, 2024 at 06:22:21PM +, Alexander Korotkov wrote: > Implement pg_wal_replay_wait() stored procedure > > pg_wal_replay_wait() is to be used on standby and specifies waiting for > the specific WAL location to be replayed. This option is useful when > the user makes

pgsql: tests: Restrict pg_locks queries in advisory_locks.sql to curren

2024-09-25 Thread Michael Paquier
on the concurrent activity for older active branches. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20221003234111.4ob7yph6r4g4y...@awork3.anarazel.de Backpatch-through: 12 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: tests: Restrict pg_locks queries in advisory_locks.sql to curren

2024-09-25 Thread Michael Paquier
on the concurrent activity for older active branches. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20221003234111.4ob7yph6r4g4y...@awork3.anarazel.de Backpatch-through: 12 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: tests: Restrict pg_locks queries in advisory_locks.sql to curren

2024-09-25 Thread Michael Paquier
on the concurrent activity for older active branches. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20221003234111.4ob7yph6r4g4y...@awork3.anarazel.de Backpatch-through: 12 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: tests: Restrict pg_locks queries in advisory_locks.sql to curren

2024-09-25 Thread Michael Paquier
on the concurrent activity for older active branches. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20221003234111.4ob7yph6r4g4y...@awork3.anarazel.de Backpatch-through: 12 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/ef57a713580feb5f84f23882e6980cc31e7

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/1ea4d9c001e686133f6f7c553221abd1091

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/60c618216ddbfcd65fc6c8078c1dbb77564

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/85cb21df673f3a0545b21eadcced7cb038c

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1ab67c9dfaadda86059f405e5746efb6ddb9fe21

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/9db4598c9c984d41896d517ff53b7b0cfbb

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
thor: VaibhaveS, Michael Paquier Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAM_eQjwfAR=y3g1fgys1u9ftmc+fyjm9amnfy2qczbnddbn...@mail.gmail.com Backpatch-through: 12 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/74eaa0544abf84d82bceb80e6f66321ec4c

pgsql: pg_stat_statements: Expand tests for SET statements

2024-09-24 Thread Michael Paquier
patterns. Author: Greg Sabino Mullane, Michael Paquier Discussion: https://postgr.es/m/CAKAnmmJtJY2jzQN91=2qad2eajaa-per61eyo48-tyxeg-q...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ba90eac7a9953f6f6fa5e0a0cc7441d09778f8b9 Modified Files

Re: pgsql: Allow meson builds to run test_pg_dump test in installcheck mode

2024-09-24 Thread Michael Paquier
On Tue, Sep 24, 2024 at 09:42:59AM -0400, Peter Geoghegan wrote: > On Mon, Sep 23, 2024 at 11:40 PM Michael Paquier wrote: > > Allow meson builds to run test_pg_dump test in installcheck mode. > > This commit has Tom as the git author, and Michael as the git > committer. Wa

pgsql: Allow meson builds to run test_pg_dump test in installcheck mode

2024-09-23 Thread Michael Paquier
Allow meson builds to run test_pg_dump test in installcheck mode. This had been disabled because the test "doesn't delete its user". It doesn't seem like a great idea for the meson tests to act differently from the makefile tests, though, and the makefiles had no such exception (which is how come

pgsql: Drop global objects after completed test

2024-09-23 Thread Michael Paquier
Drop global objects after completed test Project policy is to not leave global objects behind after a regress test run. This was found as a result of the development of a patch to make pg_regress detect such leftovers automatically, which in the end was withdrawn due to issues with parallel runs.

  1   2   3   4   5   6   7   8   9   10   >