Skip site navigation (1) Skip section navigation (2)

Re: EXPLAIN, utility statement parameters, and recent plpgsql changes

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: EXPLAIN, utility statement parameters, and recent plpgsql changes
Date: 2010-01-14 20:17:57
Message-ID: m2tyuoxwy2.fsf@hi-media.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Dimitri Fontaine <dfontaine(at)hi-media(dot)com> writes:
>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>> This works well enough for regular DML statements, but it falls down for
>>> EXPLAIN which is a utility statement, because *parse analysis of utility
>>> statements doesn't do anything*.  EXPLAIN actually does the parse
>>> analysis of its contained statement at the beginning of execution.
>>> And that is too late, in the scenario Pavel exhibited.  Why is it too
>>> late?  Because SPI_cursor_open_internal() intentionally "freezes" the
>>> ParamListInfo struct after doing initial parsing: what it copies into
>>> the cursor portal is just a static list of data values without the
>>> parser hooks (see copyParamList).
>
>> Would it make any sense for this function to get to call the hook in the
>> case a utility statement is being processed?
>
> Well, the point of the hook is to change the results of parse
> transformation, so just calling it doesn't do much --- you have to apply
> the whole parse analysis process, *and keep the resulting tree*.

Could that be done in the function, in the phase you call "doing initial
parsing"?
-- 
dim

In response to

Responses

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2010-01-14 20:23:01
Subject: Re: Testing with concurrent sessions
Previous:From: Robert HaasDate: 2010-01-14 20:13:46
Subject: Re: Streaming replication, retrying from archive

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group