On Tue, Dec 18, 2007 at 02:48:23PM +0100, peter.trautmeier@gmx.de wrote:
> 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?
They're just variables. When you call a subnode it returns a
tupletableslot. When you want to return a tuple to your parent, you
just return it.
> How is my Foo node supposed to access the suplan's (whatever that
> might me, a Scan or a Join) columns? Should Foo'- tlist have Vars
> with OUTER varnos and the right varattos?
You call your subplan: mysubplantuple = ExecProcNode(mysubplan). Vars
and VarNos are just if you want to use ExecProject (which is not
required).
> 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_scantuple to pipe
> information to an upper node.
You don't use ecxt_scantuple to pipe to your parent, you create a new
tuple based on the old ones, and simply "return" it. You don't have to
use the ecxt_* fields at all, for example, the ExecAppend node. It's
just convenient to reuse fields that are used for a common purpose.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy