Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Tom Lane
Dimitri Fontaine writes: > Tom Lane writes: >> 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 th

Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Dimitri Fontaine
Tom Lane writes: > Dimitri Fontaine writes: >> Tom Lane 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 >>> ana

Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Tom Lane
I wrote: > 2. Redesign EXPLAIN so that it parses the contained query in the initial > parsing step; it wouldn't be a simple utility command anymore but a > hybrid much like DECLARE CURSOR. I think this would not be very messy. > The main objection to it is that it doesn't scale to solve the proble

Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Tom Lane
Dimitri Fontaine writes: > Tom Lane 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 sta

Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Dimitri Fontaine
Tom Lane 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 exec

Re: [HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Pavel Stehule
2010/1/14 Tom Lane : > Pavel pointed out here > http://archives.postgresql.org/pgsql-hackers/2010-01/msg01233.php > that it no longer works to reference plpgsql variables in EXPLAIN > statements in plpgsql.  I dug into this a bit, and the code is trying > to do it but it doesn't quite work. > > The

[HACKERS] EXPLAIN, utility statement parameters, and recent plpgsql changes

2010-01-14 Thread Tom Lane
Pavel pointed out here http://archives.postgresql.org/pgsql-hackers/2010-01/msg01233.php that it no longer works to reference plpgsql variables in EXPLAIN statements in plpgsql. I dug into this a bit, and the code is trying to do it but it doesn't quite work. The issue centers around the behavior