Re: ecxt_scantuple has wrong TupleDesc

From: peter(dot)trautmeier(at)gmx(dot)de
To: pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ecxt_scantuple has wrong TupleDesc
Date: 2007-12-18 13:48:23
Message-ID: 20071218134823.167160@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 different nodes - 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'- tlist have 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_scantuple to pipe information to an upper node.

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

Regards
Peter

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sebastien FLAESCH 2007-12-18 14:35:44 V8.3.0: PQprepare()/PQexecPrepared() and DECLARE CURSOR
Previous Message Alvaro Herrera 2007-12-18 12:32:51 Re: pgsql: Improve wording.