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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Michel Pelletier <pelletier.michel@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-02-03T14:44:43Z
Lists: pgsql-hackers
Laurenz Albe <laurenz.albe@cybertec.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.

			regards, tom lane



Commits

  1. Invent GENERIC_PLAN option for EXPLAIN.