Re: More partition pruning bugs with multi-column RANGE partitions

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: More partition pruning bugs with multi-column RANGE partitions
Date: 2026-08-26 11:09:32
Message-ID: CAApHDvr5VqTY4o4UrGDnjCr5=rMxvh1es_sQp5KAUU25B1q_eA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 26 Aug 2026 at 02:24, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
> Using the same partition layout, I also tried:
>
> EXPLAIN (COSTS OFF) SELECT * FROM mc2ap WHERE a < 1;
>
> Master scans only mc2ap_def, while v1 scans both mc2ap1 and
> mc2ap_def. The result is unchanged, but it seems that the new check
> rejects nextoff == 0 even though that is a valid index into
> boundinfo->datums.

I can't recreate this. Are you sure you tested with partition pruning enabled?

> Should the check use the actual array bounds instead?
>
> if (nextoff < 0 || nextoff >= boundinfo->ndatums)

I modified the fuzzer tool to record the plans of each query tested,
and it seems that not visiting the end elements could result in
partitions *not* being pruned that could be pruned, so making that the
condition seems correct.

> Would the same apply to the similar loop in the
> BTGreaterStrategyNumber case?

The fuzzer highlighted that that's the case with this one too. More
partitions could be pruned that are not pruned today.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-08-26 12:00:20 Re: scary patch contest
Previous Message Jelte Fennema-Nio 2026-08-26 10:55:57 Re: PSA: Planning to grease protocol connections during 19beta