EXPLAIN ... FOR PORTION OF should not evaluate bounds

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: EXPLAIN ... FOR PORTION OF should not evaluate bounds
Date: 2026-09-04 04:43:39
Message-ID: CA+renyXci9khYXJ8uSwzF30DVw+zc4QwGb1RdsuOu_YtrFuy1g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Here is a fix for findings D3 & D4 & D10 from [0].

The issue is that we evaluate FOR PORTION OF bounds even under
EXPLAIN. This causes various problems, like failing on `EXPLAIN
(GENERIC PLAN)`, failing on `FOR PORTION OF (null)`, and calling
functions for the bounds (beyond selectivity estimation). To fix it,
we add a guard for EXEC_FLAG_EXPLAIN_ONLY.

[0] https://www.postgresql.org/message-id/CA%2BrenyV6QLOJYmLo3gbsg1Y%2BCrho8NqME1jJXgPbO_NgxfBaKQ%40mail.gmail.com

Yours,

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

Attachment Content-Type Size
v1-0001-Don-t-evaluate-the-FOR-PORTION-OF-target-under-EX.patch text/x-patch 8.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-09-04 04:53:08 FOR PORTION OF elog on non-polymorphic opcintype
Previous Message Henson Choi 2026-09-04 04:42:15 Re: Row pattern recognition