Re: BUG #18830: ExecInitMerge Segfault on MERGE
Tender Wang <tndrwang@gmail.com>
From: Tender Wang <tndrwang@gmail.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, pgsql-bugs@lists.postgresql.org, tharakan@gmail.com
Date: 2025-03-04T10:27:57Z
Lists: pgsql-bugs
Amit Langote <amitlangote09@gmail.com> 于2025年3月4日周二 18:10写道: > > > Hmm, interesting. Can you share the full test case? > > What's the behavior on v17 and older? Just want to be sure if we're > looking at another bug in the code committed in v18. > > I do test on 17.1, the results are consistent. See below: psql (17.1) Type "help" for help. postgres=# create table part_abc (a int, b text, c bool) partition by list (a); create table part_abc_1 (b text, a int, c bool); create table part_abc_2 (a int, c bool, b text); alter table part_abc attach partition part_abc_1 for values in (1); alter table part_abc attach partition part_abc_2 for values in (2); insert into part_abc values (1, 'b', true); insert into part_abc values (2, 'c', true); create view part_abc_view as select * from part_abc where b <> 'a' with check option; create function stable_one() returns int as $$ begin return 1; end; $$ language plpgsql stable; merge into part_abc_view pt using (select stable_one() + 2 as pid) as q join part_abc_1 pt1 on (true) on pt.a = stable_one() +2 when not matched then insert values(1, 'd', false); CREATE TABLE CREATE TABLE CREATE TABLE ALTER TABLE ALTER TABLE INSERT 0 1 INSERT 0 1 CREATE VIEW CREATE FUNCTION MERGE 1 postgres=# show enable_partition_pruning ; enable_partition_pruning -------------------------- on (1 row) postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "ecs-user". test=# set enable_partition_pruning = off; SET test=# show enable_partition_pruning ; enable_partition_pruning -------------------------- off (1 row) test=# create table part_abc (a int, b text, c bool) partition by list (a); create table part_abc_1 (b text, a int, c bool); create table part_abc_2 (a int, c bool, b text); alter table part_abc attach partition part_abc_1 for values in (1); alter table part_abc attach partition part_abc_2 for values in (2); insert into part_abc values (1, 'b', true); insert into part_abc values (2, 'c', true); create view part_abc_view as select * from part_abc where b <> 'a' with check option; create function stable_one() returns int as $$ begin return 1; end; $$ language plpgsql stable; merge into part_abc_view pt using (select stable_one() + 2 as pid) as q join part_abc_1 pt1 on (true) on pt.a = stable_one() +2 when not matched then insert values(1, 'd', false); CREATE TABLE CREATE TABLE CREATE TABLE ALTER TABLE ALTER TABLE INSERT 0 1 INSERT 0 1 CREATE VIEW CREATE FUNCTION MERGE 1 -- Thanks, Tender Wang
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Ensure first ModifyTable rel initialized if all are pruned
- 28317de723b6 18.0 landed
-
Don't lock partitions pruned by initial pruning
- 525392d5727f 18.0 cited
-
Fix an oversight in cbc127917 to handle MERGE correctly
- 75dfde13639a 18.0 cited
-
Remove some unnecessary fields from Plan trees.
- 52ed730d511b 12.0 cited