Re: ecxt_scantuple has wrong TupleDesc

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: peter(dot)trautmeier(at)gmx(dot)de
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ecxt_scantuple has wrong TupleDesc
Date: 2007-12-18 15:38:47
Message-ID: 20071218153847.GE13268@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 18, 2007 at 02:48:23PM +0100, peter(dot)trautmeier(at)gmx(dot)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(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Chernow 2007-12-18 15:43:12 Re: binary array and record recv
Previous Message Andrew Chernow 2007-12-18 15:17:08 binary array and record recv