| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Guofenglinux <guofenglinux(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
| Subject: | Assertion failure in get_matching_part_pairs() with pruned partitions |
| Date: | 2026-11-11 02:06:04 |
| Message-ID: | CAGRkXqQN7PLQDAthJ2A+LhhGTbKXcxwPWyd+JV480wOtO5LeHw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
The following query fails an assertion in get_matching_part_pairs():
create table pl (a int, b int) partition by list (a);
create table pl_1 partition of pl for values in (1, 2, 3);
create table pl_2 partition of pl for values in (4, 5, 6);
create table pl_d partition of pl default;
create table pl2 (a int, b int) partition by list (a);
create table pl2_1 partition of pl2 for values in (1, 2, 3);
create table pl2_2 partition of pl2 for values in (4, 5, 6);
set enable_partitionwise_join = on;
explain (costs off)
select 1 from pl r1 full join pl2 r2 on r1.a = r2.a
where r2.a in (select a from pl s where s.a between 1 and 3)
and r1.a > 0;
With merged bounds, the partitions of the join rel come from the first
pair of inputs. Bound merging ignores pruned partitions, so another join
order can pair the partitions differently. Its child rels then don't
match the existing child joins. Release builds are fine, the results
match those with partitionwise join off.
The attached patch skips the partitionwise join for such a pair of
inputs. It applies to 17 and up.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-assertion-failure-with-partitionwise-join-and.patch | text/x-patch | 10.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-11-11 02:07:58 | Re: Print latency percentiles in pgbench |
| Previous Message | Chao Li | 2026-11-11 01:55:52 | pg_basebackup: check timeline history file write failures in ReceiveXlogStream() |