Re: Make EXPLAIN generate a generic plan for a parameterized query
Michel Pelletier <pelletier.michel@gmail.com>
From: Michel Pelletier <pelletier.michel@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Julien Rouhaud <rjuju123@gmail.com>, pgsql-hackers@postgresql.org
Date: 2022-12-27T22:37:11Z
Lists: pgsql-hackers
On Wed, Dec 7, 2022 at 3:23 AM Laurenz Albe <laurenz.albe@cybertec.at>
wrote:
> On Tue, 2022-12-06 at 10:17 -0800, Andres Freund wrote:
> > On 2022-10-29 10:35:26 +0200, Laurenz Albe wrote:
> > > > > Here is a patch that
> > > > > implements it with an EXPLAIN option named GENERIC_PLAN.
> >
> > This fails to build the docs:
> >
> > https://cirrus-ci.com/task/5609301511766016
> >
> > [17:47:01.064] ref/explain.sgml:179: parser error : Opening and ending
> tag mismatch: likeral line 179 and literal
> > [17:47:01.064] <likeral>ANALYZE</literal>, since a statement with
> unknown parameters
> > [17:47:01.064] ^
>
> *blush* Here is a fixed version.
>
I built and tested this patch for review and it works well, although I got
the following warning when building:
analyze.c: In function 'transformStmt':
analyze.c:2919:35: warning: 'generic_plan' may be used uninitialized in
this function [-Wmaybe-uninitialized]
2919 | pstate->p_generic_explain = generic_plan;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
analyze.c:2909:25: note: 'generic_plan' was declared here
2909 | bool generic_plan;
| ^~~~~~~~~~~~
Commits
-
Invent GENERIC_PLAN option for EXPLAIN.
- 3c05284d83b2 16.0 landed