Re: Make EXPLAIN generate a generic plan for a parameterized query

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Make EXPLAIN generate a generic plan for a parameterized query
Date: 2023-02-03 16:14:29
Message-ID: c9a84fdb3be2d0d9f838d35dfb40eea33b63b5c4.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2023-02-03 at 09:44 -0500, Tom Lane wrote:
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> > I played around with it, and I ran into a problem with partitions that
> > are foreign tables:
> > ...
> >   EXPLAIN (GENERIC_PLAN) SELECT * FROM looppart WHERE key = $1;
> >   ERROR:  no value found for parameter 1
>
> Hmm, offhand I'd say that something is doing something it has no
> business doing when EXEC_FLAG_EXPLAIN_ONLY is set (that is, premature
> evaluation of an expression).  I wonder whether this failure is
> reachable without this patch.

Thanks for the pointer. Perhaps something like the attached?
The changes in "CreatePartitionPruneState" make my test case work,
but they cause a difference in the regression tests, which would be
intended if we have no partition pruning with plain EXPLAIN.

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Add-EXPLAIN-option-GENERIC_PLAN.v6.patch text/x-patch 8.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-02-03 16:44:46 Re: run pgindent on a regular basis / scripted manner
Previous Message Pavel Stehule 2023-02-03 14:56:06 proposal: psql: show current user in prompt