Re: ecxt_scantuple has wrong TupleDesc - Mailing list pgsql-hackers

From peter.trautmeier@gmx.de
Subject Re: ecxt_scantuple has wrong TupleDesc
Date
Msg-id 20071218134823.167160@gmx.net
Whole thread Raw
In response to Re: ecxt_scantuple has wrong TupleDesc  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ecxt_scantuple has wrong TupleDesc  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Thanks Tom, 

that made it clear I made a mistake.

> That's the way it's supposed to be --- the scantuple slot is for
> scanning your subplan's output.

Browsing through the code I get the impression, that

- ecxt_scantuple is only used by Scan nodes (i.e. SeqScan, IndexScan, SubqueryScan and FunctionScan)

- ecxt_innertuple and ecxt_outertuple are used by Join nodes (but they don't use the ecxt_scantuple at all).

Is it right that the ecxt_scantuple is only used by leafnodes (Scans) and never by Joins?

> > I have written a new executor node Foo, with corresponding ExecFoo and
> make_foo functions. I have also written a new Expr type called Bar, along
> with a ExecEvalBar. 
> 
> > In make_foo I append some Bar columns. When I try to evaluate the Bar
> columns in ExecFoo via ExecProject, I need the Bar columns to access each
> other. 
> 
> That makes no sense at all.  ExecProject can't be expected to access
> output columns of the current node --- they haven't been computed yet.

Conceptionally my only way is then to crack the dependency between the Bar columns by splitting the computation in
differentnodes - and then put these nodes atop of each other.
 

But then, I still don't get the relationship between
INNER, OUTER varnos on the one side and ecxt_scantuple, ecxt_outertuple and ecxt_innertuple on the other side.

May a non-leaf node refer to a Var with a 'normal' scan varno or only to INNER and OUTER varnos?

How is my Foo node supposed to access the suplan's (whatever that might me, a Scan or a Join) columns? Should Foo'-
tlisthave Vars with OUTER varnos and the right varattos?
 

I cannot find an example of a node that (1) does projection and (2) is not a Scan (i.e a leaf node) and (3) uses
ecxt_scantupleto pipe information to an upper node.
 

I'd be happy if you clarified my misconceptions, I greatly appreciate your help.

Regards
Peter


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Improve wording.
Next
From: Sebastien FLAESCH
Date:
Subject: V8.3.0: PQprepare()/PQexecPrepared() and DECLARE CURSOR