Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-08-24 Thread shveta malik
On Sat, Aug 23, 2025 at 3:51 AM Masahiko Sawada wrote: > > > I found that we don't need to expose LogicalDecodingCtlData in > logicalctl.h header file. I've updated some cosmetic changes including > that point. > > I think the patch is getting pretty good shape Yes, I agree. > and am aiming at >

Re: Conflict detection for update_deleted in logical replication

2025-08-24 Thread shveta malik
On Mon, Aug 25, 2025 at 10:06 AM Zhijie Hou (Fujitsu) wrote: > > Attach the V65 patch set which addressed above and > Shveta's comments[1]. > Thank You for the patches, please find a few comments on v64 itself (I think valid on v65 as well): 1) in resume_conflict_info_retention(), shall we rewri

Re: [BUG?] check_exclusion_or_unique_constraint false negative

2025-08-24 Thread Amit Kapila
On Fri, Aug 22, 2025 at 9:12 PM Mihail Nikalayeu wrote: > > Amit, a few more explanations related to your message. > > > IIUC, the problem you are worried about can happen with DELETE+INSERT > > in the same transaction on the subscriber, right? > > Technically, yes - this can occur during a single

Re: [BUG?] check_exclusion_or_unique_constraint false negative

2025-08-24 Thread Amit Kapila
On Fri, Aug 22, 2025 at 9:12 PM Mihail Nikalayeu wrote: > > > BTW, as the update (or DELETE+INSERT) happens at a later time than the > > publisher's update/delete, so once we have the last_write_win > > resolution strategy implemented, it is the subscriber operation that > > will win. So, the curr

Re: disallow alter individual column if partition key contains wholerow reference

2025-08-24 Thread jian he
On Mon, Aug 25, 2025 at 11:58 AM Chao Li wrote: > > I tested this patch with “partition by range”, it works for me. > > Just have a few small comments: > > + if (bms_is_member(0 - > FirstLowInvalidHeapAttributeNumber, expr_attrs)) > > Can we simply check “if (Var *)expr->var

Re: Fixes a trivial bug in dumped parse/query/plan trees

2025-08-24 Thread Chao Li
Hi Stepan, Thanks for your testing. > On Aug 25, 2025, at 11:20, Stepan Neretin wrote: > > > Regarding testing: for this case, a Perl test might actually be more suitable > than SQL tests, because OIDs can change between runs and Perl tests allow for > better control and normalization of suc

Re: disallow alter individual column if partition key contains wholerow reference

2025-08-24 Thread Chao Li
Hi Jian, > On Aug 25, 2025, at 10:22, jian he wrote: > > > hi. > minor comments changes, > also add it on commitfest (https://commitfest.postgresql.org/patch/5988) > I tested this patch with “partition by range”, it works for me. Just have a few small comments: + if (b

Re: Fixes a trivial bug in dumped parse/query/plan trees

2025-08-24 Thread Stepan Neretin
On Mon, Aug 25, 2025 at 7:55 AM Chao Li wrote: > Hi Hackers, > > This patch fixes a trivial bug where an extra whitespace was added > when dumping an array, for example: > > ``` > :sort.numCols 2 > :sort.sortColIdx ( 1 4) > :sort.sortOperators ( 97 1754) > :sort.collations ( 0 0) > :sor

Re: bug: virtual generated column can be partition key

2025-08-24 Thread jian he
On Tue, May 6, 2025 at 6:49 PM Yura Sokolov wrote: > > 06.05.2025 13:31, jian he пишет: > > On Tue, May 6, 2025 at 5:57 PM Yura Sokolov > > wrote: > >> > >> 21.04.2025 05:30, jian he пишет: > >>> hi. > >>> While trying to make the virtual generated column be part of the > >>> partition key, > >

Re: Memory leak of SMgrRelation object on standby

2025-08-24 Thread 邱宇航
> 2025年8月21日 23:07,Jingtang Zhang 写道: > > Also, in this situation, should startup process be treated as a background > worker similar to bgwriter/checkpointer and call smgrdestroyall in some > period? Agree with that. Maybe we can call smgrdestroyall in startup process when replaying CHECKPOINT

Re: Identifying function-lookup failures due to argument name mismatches

2025-08-24 Thread Chao Li
> On Aug 25, 2025, at 02:47, Tom Lane wrote: > > Here is a v4 with some additional bike-shedding on the error texts. > In particular, I decided that it was worth expending an additional > flag bit so that we could reliably distinguish "There is no function > of that name" from "A function of t

Re: Non-reproducible AIO failure

2025-08-24 Thread Thomas Munro
On Mon, Aug 25, 2025 at 2:41 PM Thomas Munro wrote: > On Mon, Aug 25, 2025 at 1:52 PM Thomas Munro wrote: > > > struct { PgAioHandleState v:8; } state; > > > > This preserves type safety and compiles to strb two properties we > > want, but it seems to waste space (look at the offsets for

Re: Non-reproducible AIO failure

2025-08-24 Thread Thomas Munro
On Mon, Aug 25, 2025 at 1:52 PM Thomas Munro wrote: > > struct { PgAioHandleState v:8; } state; > > This preserves type safety and compiles to strb two properties we > want, but it seems to waste space (look at the offsets for the > stores): > > a.out[0x105f8] <+140>: ldrx8, [sp, #

Re: disallow alter individual column if partition key contains wholerow reference

2025-08-24 Thread jian he
On Tue, Apr 22, 2025 at 7:39 PM jian he wrote: > > demo: > drop table if exists t4; > CREATE TABLE t4(f1 int, f2 bigint) PARTITION BY list ((t4)); > create table t4_1 partition of t4 for values in ((1,2)); > alter table t4 alter column f2 set data type text using f2; > > insert into t4 select 1, '

Re: Non-reproducible AIO failure

2025-08-24 Thread Thomas Munro
On Mon, Aug 25, 2025 at 11:42 AM Nico Williams wrote: > I think the issue is that if the compiler decides to coalesce what we > think of as distinct (but neighboring) bitfields, then when you update > one of the bitfields you could be updating the other with stale data > from an earlier read where

Re: vacuumdb --missing-stats-only and permission issue

2025-08-24 Thread Yugo Nagata
On Sat, 23 Aug 2025 09:36:07 -0500 Nathan Bossart wrote: > On Sat, Aug 23, 2025 at 05:32:30AM -0400, Corey Huinker wrote: > > On Fri, Aug 22, 2025 at 11:20 PM Fujii Masao wrote: > >> On Sat, Aug 23, 2025 at 12:00 PM Nathan Bossart > >> wrote: > >>> Hm. Maybe we should just document that the o

Re: minor refactor on src/test/modules/test_ddl_deparse/sql/alter_table.sql

2025-08-24 Thread Chao Li
> On Aug 25, 2025, at 08:00, jian he wrote: > > hi. > > in src/test/modules/test_ddl_deparse/sql/alter_table.sql: > > > The test initially focuses on the "parent" table, then switches to the "part" > table, and goes back to the "parent" table. > This seems weird? so I slightly adjusted

Fixes a trivial bug in dumped parse/query/plan trees

2025-08-24 Thread Chao Li
Hi Hackers,This patch fixes a trivial bug where an extra whitespace was addedwhen dumping an array, for example:```  :sort.numCols 2  :sort.sortColIdx ( 1 4)  :sort.sortOperators ( 97 1754)  :sort.collations ( 0 0)  :sort.nullsFirst ( false false)```The unnecessary whitespace is now removed.Regard

Re: Add OID descriptions to dumped parse/query/plan trees

2025-08-24 Thread Chao Li
> On Aug 22, 2025, at 22:10, Tom Lane wrote: > > Chao Li writes: >> When reading dumped parse/query/plan trees, sometime we want to know >> what exact type/operator/function an OID stands for. I just added a new >> feature that will add some OID descriptions to the dump trees, like: > > The

Re: Add support for specifying tables in pg_createsubscriber.

2025-08-24 Thread Peter Smith
IIUC, the only purpose of the proposed '--table' spec is to allow some users the ability to tweak the default "CREATE PUBLICATION p FOR ALL TABLES;" that the 'pg_createsubscriber' tool would otherwise construct. But --table is introducing problems too: e.g. - tricky option ordering rules (e.g. mos

minor refactor on src/test/modules/test_ddl_deparse/sql/alter_table.sql

2025-08-24 Thread jian he
hi. in src/test/modules/test_ddl_deparse/sql/alter_table.sql: ALTER TABLE parent ADD CONSTRAINT a_pos CHECK (a > 0); CREATE TABLE part ( a int ) PARTITION BY RANGE (a); CREATE TABLE part1 PARTITION OF part FOR VALUES FROM (1) to (100); CREATE TABLE part2 (a int);

Re: Potential problem in commit f777d773878 and 4f7f7b03758

2025-08-24 Thread Srinath Reddy Sadipiralla
On Sun, Aug 24, 2025 at 5:58 PM Srinath Reddy Sadipiralla < srinath2...@gmail.com> wrote: > Hi, > Thanks Dilip and Matheus for working on this , i reviewed the latest patch > given my Matheus and it LGTM but i have doubt that in f777d773878 commit > the $libdir was moved out from expand_dynamic_li

Re: Non-reproducible AIO failure

2025-08-24 Thread Nico Williams
On Mon, Aug 25, 2025 at 10:43:21AM +1200, Thomas Munro wrote: > On Mon, Aug 25, 2025 at 6:11 AM Konstantin Knizhnik > wrote: > > In theory even replacing bitfield with in should not > > avoid race condition, because they are still shared the same cache line. > > I'm no expert in this stuff, but

Re: Inval reliability, especially for inplace updates

2025-08-24 Thread Noah Misch
On Thu, Jul 31, 2025 at 09:53:20AM -0700, Paul A Jungwirth wrote: > Ian Ilyasov and I reviewed this patch. We think it is ready to commit > to back branches. Thank you! > We assume you will also un-revert 8e7e672cda ("WAL-log inplace update > before revealing it to other sessions.")? We didn't lo

Re: Non-reproducible AIO failure

2025-08-24 Thread Thomas Munro
On Mon, Aug 25, 2025 at 6:11 AM Konstantin Knizhnik wrote: > In theory even replacing bitfield with in should not > avoid race condition, because they are still shared the same cache line. I'm no expert in this stuff, but that's not my understanding of how it works. Plain stores to normal memory

Re: No error checking when reading from file using zstd in pg_dump

2025-08-24 Thread Daniel Gustafsson
> On 24 Aug 2025, at 23:21, Tom Lane wrote: > > Daniel Gustafsson writes: >>> On 1 Jul 2025, at 17:42, Tom Lane wrote: >>> There are some minor typos in the proposed commit message, too. > >> It seems that my grasp of the english language went on holiday before I did. >> The attached v9 is hop

Re: No error checking when reading from file using zstd in pg_dump

2025-08-24 Thread Tom Lane
Daniel Gustafsson writes: >> On 1 Jul 2025, at 17:42, Tom Lane wrote: >> There are some minor typos in the proposed commit message, too. > It seems that my grasp of the english language went on holiday before I did. > The attached v9 is hopefully less terrible. This thread seems to have faded a

Re: Improve hash join's handling of tuples with null join keys

2025-08-24 Thread Tom Lane
Marc-Olaf Jaschke writes: > I can confirm that the patch fixes the issue (Bug #19030). The memory usage > remains within the expected range of work_mem. > This also applies to parallel hash joins. > The query also runs significantly faster. > I also tested cases with multiple left joins. > I have

Re: Improve hash join's handling of tuples with null join keys

2025-08-24 Thread Marc-Olaf Jaschke
Tom Lane wrote: > Bug #19030 [1] seems to be a fresh report of the problem this patch > aims to solve. > [1] > https://www.postgresql.org/message-id/flat/19030-944dd78d7ef94c0f%40postgresql.org > I can confirm that the patch fixes the issue (Bug #19030). The memory usage remains within the

Re: Identifying function-lookup failures due to argument name mismatches

2025-08-24 Thread Tom Lane
Here is a v4 with some additional bike-shedding on the error texts. In particular, I decided that it was worth expending an additional flag bit so that we could reliably distinguish "There is no function of that name" from "A function of that name exists, but it is not in the search_path". (Since

Re: Non-reproducible AIO failure

2025-08-24 Thread Konstantin Knizhnik
On 24/08/2025 3:38 PM, Thomas Munro wrote: That's also how open source clang 17 compiles it if you rip out the bitfield. I guess if you do that, you won't be able to reproduce this, Alexander? Something like: I think that we have made this experiment at the very beginning and as far as I re

Re: Inconsistent update in the MERGE command

2025-08-24 Thread Yugo Nagata
On Thu, 21 Aug 2025 16:30:09 +0300 Dmitry wrote: > Hi hackers, > > I noticed an inconsistent update when executing MERGE commands, which > looks more like a bug. > In my test example, the value of 'val' should increase in an ascending > monotonous sequence. > > Test system > === > - A

Re: Adding REPACK [concurrently]

2025-08-24 Thread Mihail Nikalayeu
Hello, Antonin! > When posting version 12 of the patch [1] I raised a concern that the the MVCC > safety is too expensive when it comes to logical decoding. Therefore, I > abandoned the concept for now, and v13 [2] uses plain heap_insert(). Once we > implement the MVCC safety, we simply rewrite th

Re: Non-text mode for pg_dumpall

2025-08-24 Thread Andrew Dunstan
On 2025-08-23 Sa 9:08 PM, Noah Misch wrote: On Wed, Jul 30, 2025 at 02:51:59PM -0400, Andrew Dunstan wrote: OK, now that's reverted we should discuss how to proceed. I had two thoughts - we could use invent a JSON format for the globals, or we could just use the existing archive format. I think

Re: Test instability when pg_dump orders by OID

2025-08-24 Thread Noah Misch
On Sun, Aug 24, 2025 at 11:50:01AM -0400, Tom Lane wrote: > Andres Freund writes: > > I wonder if it's worth adding support to CI to perform the cross-version > > upgrade test. It'd be pretty easy to install all pgdg apt postgres packages > > to > > the debian image, which then could be used as t

Re: Test instability when pg_dump orders by OID

2025-08-24 Thread Tom Lane
Andres Freund writes: > I wonder if it's worth adding support to CI to perform the cross-version > upgrade test. It'd be pretty easy to install all pgdg apt postgres packages to > the debian image, which then could be used as the source version... I feel that that's the wrong tradeoff. CI should

Re: Test instability when pg_dump orders by OID

2025-08-24 Thread Andres Freund
Hi, On 2025-08-23 07:45:05 -0700, Noah Misch wrote: > Crossing the boundary of the MAINTAIN privilege existing seems relevant. Will > fix. (My checklist did tell me to do a local run of TestUpgradeXversion. I > skipped it, betting this patch wouldn't break that test. I lost that bet.) I wonde

Re: Non-reproducible AIO failure

2025-08-24 Thread Thomas Munro
On Sun, Aug 24, 2025 at 5:32 AM Konstantin Knizhnik wrote: > On 20/08/2025 9:00 PM, Alexander Lakhin wrote: > > for i in {1..10}; do np=$((20 + $RANDOM % 10)); echo "iteration $i: > > $np"; time parallel -j40 --linebuffer --tag /tmp/repro-AIO-Assert.sh > > {} ::: `seq $np` || break; sleep $(($RAN

Re: Potential problem in commit f777d773878 and 4f7f7b03758

2025-08-24 Thread Srinath Reddy Sadipiralla
Hi, Thanks Dilip and Matheus for working on this , i reviewed the latest patch given my Matheus and it LGTM but i have doubt that in f777d773878 commit the $libdir was moved out from expand_dynamic_library_name into load_external_function because if someone specifies LOAD '$libdir/foo' explicitly t

Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-24 Thread jian he
hi. --this ALTER COLUMN DROP EXPRESSION work as expected DROP TABLE IF EXISTS parent cascade; CREATE TABLE parent (a int, d INT GENERATED ALWAYS AS (11) STORED); CREATE TABLE child () INHERITS (parent); ALTER TABLE parent ALTER COLUMN d DROP EXPRESSION; - the below (ALTER COLUMN DROP EXPRE