pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Clarify documentation for the initcap function

2025-07-29 Thread Alexander Korotkov
Clarify documentation for the initcap function This commit documents differences in the definition of word separators for the initcap function between libc and ICU locale providers. Backpatch to all supported branches. Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespr

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Limit checkpointer requests queue size

2025-07-27 Thread Alexander Korotkov
Limit checkpointer requests queue size If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb t

pgsql: Process sync requests incrementally in AbsorbSyncRequests

2025-07-27 Thread Alexander Korotkov
: https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ru Author: Maxim Orlov Co-authored-by: Xuneng Zhou Reviewed-by: Andres Freund Reviewed-by: Heikki Linnakangas Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Update comment for ReplicationSlot.last_saved_restart_lsn

2025-07-21 Thread Alexander Korotkov
%40mail.gmail.com Author: Hayato Kuroda Co-authored-by: Amit Kapila Reviewed-by: Vignesh C Reviewed-by: Amit Kapila Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0810fbb02dbe70b8a7a7bcc51580827b8bbddbdc Modified Files

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_17_STABLE Details --- https

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_14_STABLE Details --- https

pgsql: Improve the stability of the recovery test 047_checkpoint_physic

2025-07-19 Thread Alexander Korotkov
%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com Discussion: https://postgr.es/m/aHXLep3OaX_vRTNQ%40paquier.xyz Author: Alexander Korotkov Reviewed-by: Michael Paquier Backpatch-through: 17 Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_15_STABLE Details --- https

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_16_STABLE Details --- https

pgsql: Improve the stability of the recovery test 047_checkpoint_physic

2025-07-19 Thread Alexander Korotkov
%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com Discussion: https://postgr.es/m/aHXLep3OaX_vRTNQ%40paquier.xyz Author: Alexander Korotkov Reviewed-by: Michael Paquier Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Improve recovery test 046_checkpoint_logical_slot

2025-07-19 Thread Alexander Korotkov
://postgr.es/m/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Alexander Korotkov Co-authored-by: Hayato Kuroda Reviewed-by: Michael Paquier Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- REL_18_STABLE Details --- https

pgsql: Reintroduce test 046_checkpoint_logical_slot

2025-07-19 Thread Alexander Korotkov
creation of a record that spawns across two pages. - Make the logic wait for the checkpoint completion. Author: Alexander Korotkov Co-authored-by: Hayato Kuroda Reviewed-by: Michael Paquier Backpatch-through: 18 Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg

pgsql: Fix infinite wait when reading a partially written WAL record

2025-07-19 Thread Alexander Korotkov
/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Dilip Kumar Reviewed-by: Michael Paquier Reviewed-by: Alexander Korotkov Backpatch-through: 13 Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Reintroduce test 046_checkpoint_logical_slot

2025-07-19 Thread Alexander Korotkov
creation of a record that spawns across two pages. - Make the logic wait for the checkpoint completion. Author: Alexander Korotkov Co-authored-by: Hayato Kuroda Reviewed-by: Michael Paquier Backpatch-through: 18 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Improve the stability of the recovery test 047_checkpoint_physic

2025-07-19 Thread Alexander Korotkov
%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com Discussion: https://postgr.es/m/aHXLep3OaX_vRTNQ%40paquier.xyz Author: Alexander Korotkov Reviewed-by: Michael Paquier Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Fix a typo in the deparseArrayCoerceExpr() header comment

2025-07-18 Thread Alexander Korotkov
Fix a typo in the deparseArrayCoerceExpr() header comment Discussion: https://postgr.es/m/CAHewXNn%3D_ykCtcTw5SCfZ-eVr4m%2BCuc804rGeMsKuj%3DD4xpL4w%40mail.gmail.com Author: Tender Wang Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4c5159a2d8c01e6f08ce20a51bb2dca

pgsql: Support for deparsing of ArrayCoerceExpr node in contrib/postgre

2025-07-18 Thread Alexander Korotkov
.ru Author: Alexander Pyhalov Reviewed-by: Maxim Orlov Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/62c3b4cd9ddc6d3066e3f6e43b68fd00c620d9ad Modified Files -- contrib/postgres_fdw/deparse.c

pgsql: Fix CheckPointReplicationSlots() with max_replication_slots == 0

2025-06-27 Thread Alexander Korotkov
Fix CheckPointReplicationSlots() with max_replication_slots == 0 ca307d5cec90 made CheckPointReplicationSlots() unconditionally call ReplicationSlotsComputeRequiredLSN(). It causes an assertion trap when max_replication_slots equals 0. This commit makes CheckPointReplicationSlots() call Replicat

pgsql: Temporarily remove 046_checkpoint_logical_slot.pl

2025-06-23 Thread Alexander Korotkov
Temporarily remove 046_checkpoint_logical_slot.pl This new test was intended to check the handling of the replication slot's restart lsn fixed in ca307d5cec90. However, it also reveals another issue related to logical decoding. This commit temporarily removes this test to keep the buildfarm and

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-23 Thread Alexander Korotkov
On Mon, Jun 23, 2025 at 4:33 PM Amit Kapila wrote: > On Mon, Jun 23, 2025 at 6:01 PM Alexander Korotkov > wrote: > > > > On Mon, Jun 23, 2025 at 3:00 PM Jelte Fennema-Nio > > wrote: > > > On Mon, 23 Jun 2025 at 12:24, Alexander Korotkov > > > wrot

pgsql: Remove excess assert from InvalidatePossiblyObsoleteSlot()

2025-06-23 Thread Alexander Korotkov
Remove excess assert from InvalidatePossiblyObsoleteSlot() ca307d5cec90 introduced keeping WAL segments by slot's last saved restart LSN. It also added an assertion that the slot's restart LSN never goes backward. However, situations when the restart LSN goes backward have been spotted by buildfar

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-23 Thread Alexander Korotkov
On Mon, Jun 23, 2025 at 3:00 PM Jelte Fennema-Nio wrote: > On Mon, 23 Jun 2025 at 12:24, Alexander Korotkov wrote: > > On Mon, Jun 23, 2025 at 3:29 AM Michael Paquier wrote: > > > > Yeah, that's what I think too. The unintentional omission of a > > > >

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-23 Thread Alexander Korotkov
> the test is unstable as written. Exactly. I've proposed the fix with wait_for_log() in [1]. Nevertheless, both cases (immediate stop before checkpoint completion, and immediate stop after checkpoint completion) must work without hang. Links. 1. https://www.postgresql.org/message-id/CAPpHfdurV-j_e0pb%3DUFENAy3tyzxfF%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com -- Regards, Alexander Korotkov Supabase

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-21 Thread Alexander Korotkov
On Sat, Jun 21, 2025 at 2:42 AM Tom Lane wrote: > > Alexander Korotkov writes: > > And I see the following variable values. > > > (lldb) p/x targetPagePtr > > (XLogRecPtr) 0x29004000 > > (lldb) p/x RecPtr > > (XLogRecPtr) 0x29002138 > &g

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-20 Thread Alexander Korotkov
On Sat, Jun 21, 2025 at 1:40 AM Alexander Korotkov wrote: > On Sat, Jun 21, 2025 at 1:25 AM Tom Lane wrote: > > I wrote: > > > But in the buildfarm failures I don't see any 'checkpoint complete' > > > before the shutdown. > > > > Ooops, I lie

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-20 Thread Alexander Korotkov
hatever is going on here > is a bit subtle and platform-dependent. I think this indicates unfinished intention to wait for checkpoint completion. But I think both cases (checkpoint finished and unfinished) should work correctly. So, I believe there is a backend problem. I'm trying to reproduce this locally. Sorry for the confusion. -- Regards, Alexander Korotkov Supabase

Re: pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-20 Thread Alexander Korotkov
On Fri, Jun 20, 2025, 19:10 Melanie Plageman wrote: > > On Thu, Jun 19, 2025 at 7:31 PM Alexander Korotkov < > akorot...@postgresql.org> wrote: > >> Improve runtime and output of tests for replication slots checkpointing. >> >> The TAP tests that verify l

pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-19 Thread Alexander Korotkov
ld-farm logs and looked odd. Also, remove excessive 'shared_preload_libraries' GUC from the config and add a check for 'injection_points' extension availability. Reported-by: Alexander Lakhin Reported-by: Tom Lane Author: Alexander Korotkov Author: Vitaly Davydov Re

pgsql: Improve runtime and output of tests for replication slots checkp

2025-06-19 Thread Alexander Korotkov
ld-farm logs and looked odd. Also, remove excessive 'shared_preload_libraries' GUC from the config and add a check for 'injection_points' extension availability. Reported-by: Alexander Lakhin Reported-by: Tom Lane Author: Alexander Korotkov Author: Vitaly Davydov Re

pgsql: Keep WAL segments by the flushed value of the slot's restart LSN

2025-06-13 Thread Alexander Korotkov
ra in the discussion. Unlike 291221c46575, this fix doesn't affect ABI and is intended for back branches. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila

pgsql: Keep WAL segments by the flushed value of the slot's restart LSN

2025-06-13 Thread Alexander Korotkov
ra in the discussion. Unlike 291221c46575, this fix doesn't affect ABI and is intended for back branches. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila

pgsql: Keep WAL segments by the flushed value of the slot's restart LSN

2025-06-13 Thread Alexander Korotkov
ra in the discussion. Unlike 291221c46575, this fix doesn't affect ABI and is intended for back branches. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila

pgsql: Keep WAL segments by the flushed value of the slot's restart LSN

2025-06-13 Thread Alexander Korotkov
ra in the discussion. Unlike 291221c46575, this fix doesn't affect ABI and is intended for back branches. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila

pgsql: Keep WAL segments by the flushed value of the slot's restart LSN

2025-06-13 Thread Alexander Korotkov
ra in the discussion. Unlike 291221c46575, this fix doesn't affect ABI and is intended for back branches. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila

pgsql: Add TAP tests to check replication slot advance during the check

2025-06-13 Thread Alexander Korotkov
next WAL segment. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Author: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg

pgsql: Keep WAL segments by slot's last saved restart LSN

2025-06-13 Thread Alexander Korotkov
thor: Vitaly Davydov Author: Alexander Korotkov Reviewed-by: Amit Kapila Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ca307d5cec90a4fde62a50fafc8ab607ff1d8664 Modified Files -- src/backend/replication/slot.c | 57 ++

pgsql: Add TAP tests to check replication slot advance during the check

2025-06-13 Thread Alexander Korotkov
next WAL segment. Discussion: https://postgr.es/m/flat/1d12d2-67235980-35-19a406a0%4063439497 Author: Vitaly Davydov Author: Tomas Vondra Reviewed-by: Alexander Korotkov Reviewed-by: Amit Kapila Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Fix tuple_fraction calculation in generate_orderedappend_paths()

2025-05-18 Thread Alexander Korotkov
Fix tuple_fraction calculation in generate_orderedappend_paths() 6b94e7a6da adjusted generate_orderedappend_paths() to consider fractional paths. However, it didn't manage to interpret the tuple_fraction value correctly. According to the header comment of grouping_planner(), the tuple_fraction >

Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-07 Thread Alexander Korotkov
note that it is not the only PG18 Open Item left after beta1, and fixing Open Items usually requires changes besides docs and whitespaces. This commit changes ABI, but this should be OK. We do preserve ABI only for stable releases. -- Regards, Alexander Korotkov Supabase

Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-07 Thread Alexander Korotkov
is commit is not the only one on master branch after tag REL_18_BETA1. -- Regards, Alexander Korotkov Supabase

Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-07 Thread Alexander Korotkov
de handling to be kept within the analyzejoins.c. > > I believe this was pushed by mistake. Why it should be mistake this time? At least, this time I managed to wait till the end of release freeze. -- Regards, Alexander Korotkov Supabase

pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-07 Thread Alexander Korotkov
%3DHqgZZmX0tdNbzVNJxqc8yg-8kDQQ%40mail.gmail.com Author: Andrei Lepikhov Author: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ab42d643c14509cf1345588f55d798284b11a91e Modified Files -- src/backend/optimizer/plan/analyzejoins.c | 160

Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-03 Thread Alexander Korotkov
On Sat, May 3, 2025 at 11:06 PM Tom Lane wrote: > > Alexander Korotkov writes: > > On Sat, May 3, 2025 at 10:34 PM Tom Lane wrote: > >> You are aware that we are in release freeze, no? > > > I missed that. Should I revert this commit now? > > Yes, I think s

pgsql: Revert "Refactor ChangeVarNodesExtended() using the custom callb

2025-05-03 Thread Alexander Korotkov
Revert "Refactor ChangeVarNodesExtended() using the custom callback" This reverts commit 250a718aadad68793e82103282247556a46a3cfc. It shouldn't be pushed during the release freeze. Reported-by: Tom Lane Discussion: https://postgr.es/m/E1uBIbY-000owH-0O%40gemulon.postgresql.org Branch -- mast

Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-03 Thread Alexander Korotkov
On Sat, May 3, 2025 at 10:34 PM Tom Lane wrote: > > Alexander Korotkov writes: > > Refactor ChangeVarNodesExtended() using the custom callback > > You are aware that we are in release freeze, no? I missed that. Should I revert this commit now? -- Regards, Alexander Korotkov Supabase

pgsql: Refactor ChangeVarNodesExtended() using the custom callback

2025-05-03 Thread Alexander Korotkov
%3DHqgZZmX0tdNbzVNJxqc8yg-8kDQQ%40mail.gmail.com Author: Andrei Lepikhov Author: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/250a718aadad68793e82103282247556a46a3cfc Modified Files -- src/backend/optimizer/plan/analyzejoins.c | 160

pgsql: Fixes for ChangeVarNodes_walker()

2025-04-29 Thread Alexander Korotkov
-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2260c7f6d90ecf76d3806d32890a0890688b41e8 Modified Files -- src/backend/rewrite/rewriteManip.c | 28 src/test/regress/expected/join.out | 16

pgsql: Restore comments in ChangeVarNodesExtended()

2025-04-28 Thread Alexander Korotkov
Restore comments in ChangeVarNodesExtended() This commit restores comments in ChangeVarNodesExtended(), which were accidentally removed by fc069a3a6319. Reported-by: Richard Guo Discussion: https://postgr.es/m/CAMbWs49PE3CvnV8vrQ0Dr%3DHqgZZmX0tdNbzVNJxqc8yg-8kDQQ%40mail.gmail.com Branch --

pgsql: Disallow removing placeholders during Self-Join Elimination.

2025-04-27 Thread Alexander Korotkov
happen that we skip the removal of some PHVs that could be removed. However, the overhead of extra PHVs is small compared to the complexity of analysis needed to remove them. Reported-by: Alexander Lakhin Author: Alena Rybakina Author: Andrei Lepikhov Reviewed-by: Alexander Korotkov Reviewed-by

pgsql: Maintain RelIdToTypeIdCacheHash in TypeCacheOpcCallback()

2025-04-23 Thread Alexander Korotkov
Maintain RelIdToTypeIdCacheHash in TypeCacheOpcCallback() b85a9d046efd introduced a new RelIdToTypeIdCacheHash, whose entries should exist for typecache entries with TCFLAGS_HAVE_PG_TYPE_DATA flag set or any of TCFLAGS_OPERATOR_FLAGS set or tupDesc set. However, TypeCacheOpcCallback(), which rese

pgsql: Properly prepare varinfos in estimate_multivariate_bucketsize()

2025-04-23 Thread Alexander Korotkov
operly. Reported-by: Robins Tharakan Discussion: https://postgr.es/m/18885-da51324078588253%40postgresql.org Author: Andrei Lepikhov Reviewed-by: David Rowley Reviewed-by: Tomas Vondra Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgres

Re: pgsql: Use extended stats for precise estimation of bucket size in hash

2025-04-10 Thread Alexander Korotkov
On Thu, Apr 10, 2025 at 3:37 AM Robins Tharakan wrote: > On Mon, 10 Mar 2025 at 22:18, Alexander Korotkov > wrote: > > > > Use extended stats for precise estimation of bucket size in hash join > > > After this commit, I see a recurrence of an error

Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate

2025-04-07 Thread Alexander Korotkov
{1,2}'::oid[])) > > + -> Sort > > + Sort Key: a.oid > > + -> Seq Scan on pg_am a > > +(7 rows) > > Are these failures from patches applied to master prior to 3ba2cdaa? Yes, these failures appears before 3ba2cdaa. Tom committed 3ba2cdaa to fix the problem before I get into it [1]. Links. 1. https://www.postgresql.org/message-id/srnuqlttuimzmvoulhsrbgvj4vnul6b65osswvua7sfkqsvmuy%40yg7apybpxp34 -- Regards, Alexander Korotkov Supabase

pgsql: Remove GUC_NOT_IN_SAMPLE from enable_self_join_elimination

2025-04-07 Thread Alexander Korotkov
Remove GUC_NOT_IN_SAMPLE from enable_self_join_elimination fc069a3a6319 implements Self-Join Elimination (SJE) and provides a new GUC variable: enable_self_join_elimination. This new GUC variable was marked as GUC_NOT_IN_SAMPLE. However, enable_self_join_elimination is documented and is not diff

Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate

2025-04-07 Thread Alexander Korotkov
On Fri, Apr 4, 2025 at 6:47 PM Melanie Plageman wrote: > > On Fri, Apr 4, 2025 at 9:17 AM Alexander Korotkov > wrote: > > > > Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate > > > > This commit implements the automatic convers

Re: pgsql: Put enable_self_join_elimination into postgresql.conf.sample

2025-04-06 Thread Alexander Korotkov
On Sun, Apr 6, 2025 at 2:10 PM Daniel Gustafsson wrote: > > > On 6 Apr 2025, at 12:27, Alexander Korotkov > > wrote: > > > > Put enable_self_join_elimination into postgresql.conf.sample > > > > fc069a3a6319 implements Self-Join Elimination (S

pgsql: Revert "Put enable_self_join_elimination into postgresql.conf.sa

2025-04-06 Thread Alexander Korotkov
Revert "Put enable_self_join_elimination into postgresql.conf.sample" This reverts commit c2d329260cd8. Reported-by: Daniel Gustafsson Discussion: https://postgr.es/m/D292EB44-806E-439A-82A4-491A1BA59E7A%40yesql.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3

pgsql: Put enable_self_join_elimination into postgresql.conf.sample

2025-04-06 Thread Alexander Korotkov
Put enable_self_join_elimination into postgresql.conf.sample fc069a3a6319 implements Self-Join Elimination (SJE) and provides a new GUC variable: enable_self_join_elimination. This commit adds enable_self_join_elimination to the postgresql.conf.sample, as it was forgotten in the original commit.

pgsql: postgres_fdw: Remove redundant check in semijoin_target_ok()

2025-04-05 Thread Alexander Korotkov
postgres_fdw: Remove redundant check in semijoin_target_ok() If a var belongs to the innerrel of the joinrel, it's not possible that it belongs to the outerrel. This commit removes the redundant check from the if-clause but keeps it as an assertion. Discussion: https://postgr.es/m/flat/CAHewXN=

pgsql: Get rid of WALBufMappingLock

2025-04-05 Thread Alexander Korotkov
ura Sokolov Co-authored-by: Alexander Korotkov Reviewed-by: Pavel Borisov Reviewed-by: Tomas Vondra Tested-by: Michael Paquier Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bc22dc0e0ddc2dcb6043a732415019cc6b6bf683 Modified Files -- src/backend/access

pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate

2025-04-04 Thread Alexander Korotkov
Rybakina Author: Andrei Lepikhov Reviewed-by: Ivan Kush Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c0962a113d1f2f94cb7222a7ca025a67e9ce3860 Modified Files -- src/backend/optimizer/plan/subselect.c| 80 ++

pgsql: Extract make_SAOP_expr() function from match_orclause_to_indexco

2025-04-04 Thread Alexander Korotkov
ena Rybakina Author: Andrei Lepikhov Reviewed-by: Ivan Kush Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d48d2e2dc8be50d3ca13305b5699384329b15433 Modified Files -- src/backend/optimizer/path/indxpath.c | 62 +--

pgsql: Make group_similar_or_args() reorder clause list as little as po

2025-03-28 Thread Alexander Korotkov
Make group_similar_or_args() reorder clause list as little as possible Currently, group_similar_or_args() permutes original positions of clauses independently on whether it manages to find any groups of similar clauses. While we are not providing any strict warranties on saving the original order

pgsql: postgres_fdw: Remove redundant check in semijoin_target_ok()

2025-03-25 Thread Alexander Korotkov
postgres_fdw: Remove redundant check in semijoin_target_ok() If a var belongs to the innerrel of the joinrel, it's not possible that it belongs to the outerrel. This commit removes the redundant check from the if-clause but keeps it as an assertion. Discussion: https://postgr.es/m/flat/CAHewXN=

pgsql: postgres_fdw: Avoid pulling up restrict infos from subqueries

2025-03-24 Thread Alexander Korotkov
ssion: https://postgr.es/m/CAEP4nAzryLd3gwcUpFBAG9MWyDfMRX8ZjuyY2XXjyC_C6k%2B_Zw%40mail.gmail.com Author: Alexander Pyhalov Reviewed-by: Alexander Korotkov Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/729fe699e61231a01d834078c0566830638

pgsql: postgres_fdw: Avoid pulling up restrict infos from subqueries

2025-03-24 Thread Alexander Korotkov
ssion: https://postgr.es/m/CAEP4nAzryLd3gwcUpFBAG9MWyDfMRX8ZjuyY2XXjyC_C6k%2B_Zw%40mail.gmail.com Author: Alexander Pyhalov Reviewed-by: Alexander Korotkov Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/023fb512755ffb64949eb6de8464c259ca7

pgsql: reindexdb: Fix the index-level REINDEX with multiple jobs

2025-03-16 Thread Alexander Korotkov
reindexdb: Fix the index-level REINDEX with multiple jobs 47f99a407d introduced a parallel index-level REINDEX. The code was written assuming that running run_reindex_command() with 'async == true' can schedule a number of queries for a connection. That's not true, and the second query sent usin

pgsql: reindexdb: Fix the index-level REINDEX with multiple jobs

2025-03-16 Thread Alexander Korotkov
reindexdb: Fix the index-level REINDEX with multiple jobs 47f99a407d introduced a parallel index-level REINDEX. The code was written assuming that running run_reindex_command() with 'async == true' can schedule a number of queries for a connection. That's not true, and the second query sent usin

pgsql: Use extended stats for precise estimation of bucket size in hash

2025-03-10 Thread Alexander Korotkov
27;s logic. Clauses that are not estimated are returned to the caller for further estimation. Discussion: https://postgr.es/m/52257607-57f6-850d-399a-ec33a654457b%40postgrespro.ru Author: Andrei Lepikhov Reviewed-by: Andy Fan Reviewed-by: Tomas Vondra Reviewed-by: Alena Rybakina Reviewed-by:

pgsql: Teach Append to consider tuple_fraction when accumulating subpat

2025-03-10 Thread Alexander Korotkov
e query. Discussion: https://www.postgresql.org/message-id/flat/CAN-LCVPxnWB39CUBTgOQ9O7Dd8DrA_tpT1EY3LNVnUuvAX1NjA%40mail.gmail.com Author: Nikita Malakhov Author: Andrei Lepikhov Reviewed-by: Andy Fan Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgres

pgsql: Get rid of ojrelid local variable in remove_rel_from_query()

2025-02-27 Thread Alexander Korotkov
Get rid of ojrelid local variable in remove_rel_from_query() As spotted by Coverity, the calculation of ojrelid mixes signed and unsigned types causes possible overflow and undefined behavior. Instead of trying to fix the expression, this commit eliminates the relied local variable. The explicit

pgsql: Improve statistics estimation for single-column GROUP BY in sub-

2025-02-19 Thread Alexander Korotkov
the upper query block. Author: Andrei Lepikhov Reviewed-by: Heikki Linnakangas Reviewed-by: Alexander Korotkov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e983ee9380fcac746f9b6b7c360d255d9fcd0907 Modified Files -- src/backend/utils/adt/selfuncs.c

pgsql: Implement Self-Join Elimination

2025-02-17 Thread Alexander Korotkov
changed due to self-join removal logic. Discussion: https://postgr.es/m/flat/64486b0b-0404-e39e-322d-0801154901f3%40postgrespro.ru Author: Andrey Lepikhov Author: Alexander Kuzmenkov Co-authored-by: Alexander Korotkov Co-authored-by: Alena Rybakina Reviewed-by: Tom Lane Reviewed-by: Robert

pgsql: Revert: Get rid of WALBufMappingLock

2025-02-17 Thread Alexander Korotkov
Revert: Get rid of WALBufMappingLock This commit reverts 6a2275b895. Buildfarm failure on batta spots some concurrency issue, which requires further investigation. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3fb58625d18fd226cb929c9700d0db72ac92c075 Modified Fi

pgsql: Get rid of WALBufMappingLock

2025-02-16 Thread Alexander Korotkov
ura Sokolov Co-authored-by: Alexander Korotkov Reviewed-by: Pavel Borisov Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6a2275b8953a4462d44daf001bdd60b3d48f0946 Modified Files -- src/backend/access/transam/xlog.c | 176 +

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: pg_controldata: Fix possible errors on corrupted pg_control

2025-02-04 Thread Alexander Korotkov
pg_controldata: Fix possible errors on corrupted pg_control Protect against malformed timestamps. Also protect against negative WalSegSz as it triggers division by zero: ((0x1UL) / (WalSegSz)) can turn into zero in XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,

pgsql: Revise the header comment for match_clause_to_indexcol()

2025-02-04 Thread Alexander Korotkov
Revise the header comment for match_clause_to_indexcol() Since d4378c0005e6, match_clause_to_indexcol() doesn't always return NULL for an OR clause. This commit reflects that in the function header comment. Reported-by: Pavel Borisov Branch -- master Details --- https://git.postgresql

pgsql: Allow usage of match_orclause_to_indexcol() for joins

2025-02-04 Thread Alexander Korotkov
Allow usage of match_orclause_to_indexcol() for joins This commit allows transformation of OR-clauses into SAOP's for index scans within nested loop joins. That required the following changes. 1. Make match_orclause_to_indexcol() and group_similar_or_args() understand const-ness in the same

pgsql: Skip not SOAP-supported indexes while transforming an OR clause

2024-11-28 Thread Alexander Korotkov
The first check fixes the actual bug, while the second just saves some cycles. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/8174de69-9e1a-0827-0e81-ef97f56a5939%40gmail.com Author: Alena Rybakina Reviewed-by: Ranier Vilela, Alexander Korotkov, Andrei Lepikhov Branch -- maste

pgsql: Remove the wrong assertion from match_orclause_to_indexcol()

2024-11-24 Thread Alexander Korotkov
Remove the wrong assertion from match_orclause_to_indexcol() Obviously, the constant could be zero. Also, add the relevant check to regression tests. Reported-by: Richard Guo Discussion: https://postgr.es/m/CAMbWs4-siKJdtWhcbqk4Y-xG12do2Ckm1qw672GNsSnDqL9FQg%40mail.gmail.com Branch -- mast

pgsql: Transform OR-clauses to SAOP's during index matching

2024-11-23 Thread Alexander Korotkov
ral understanding of constants, as it is in other cases. Discussion: https://postgr.es/m/567ED6CA.2040504%40sigaev.ru Author: Alena Rybakina, Andrey Lepikhov, Alexander Korotkov Reviewed-by: Peter Geoghegan, Ranier Vilela, Alexander Korotkov, Robert Haas Reviewed-by: Jian He, Tom Lane, Nikolay

pgsql: Teach bitmap path generation about transforming OR-clauses to SA

2024-11-23 Thread Alexander Korotkov
ation will takes advantage of OR-clauses to SAOP's transformation. The old way of handling them is also considered. So, there shouldn't be planning regression. Discussion: https://postgr.es/m/CAPpHfdu5iQOjF93vGbjidsQkhHvY2NSm29duENYH_cbhC6x%2BMg%40mail.gmail.com Author: Alexander K

  1   2   3   4   5   6   7   8   9   >