Re: [PATCHES] SRF patch (was Re: troubleshooting pointers)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] SRF patch (was Re: troubleshooting pointers)
Date: 2002-05-19 21:22:34
Message-ID: 11170.1021843354@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> writes:
> Any ideas on getting (node->scan.plan.chgParam != NULL) to be true?

You need something that passes a parameter into the scan node.
I think the only thing that would do it is a subquery that references
an outer-level variable, for example

select * from foo where fooid in
(select barid from bar(foo.fieldx));

Here, each time we rescan the subselect result for a new foo row, we
need to update the foo.fieldx Param to the new value for the new row.
That's what the chgParam mechanism is for: to notify you that a Param
changed since your last scan. (Without that, you could and probably
should just rewind and regurgitate your prior output.)

Note that

select * from foo, bar(5000) where fooid = barid

does not involve any parameters: the WHERE condition will be executed
by the join node, and the FunctionScan node will have no contact at all
with data coming from the other table.

Now that I think about it, it's possible that ExecFunctionReScan is
correct now, at least given the simplistic always-materialize policy
that we've implemented so far. But it hasn't gotten much testing.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Buttafuoco 2002-05-19 21:24:35 bt_fixroot: not valid old root page
Previous Message Joel Burton 2002-05-19 21:00:54 Exposed function to find table in schema search list?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-05-19 21:27:17 Re: SRF patch (was Re: [HACKERS] troubleshooting pointers)
Previous Message Joe Conway 2002-05-19 20:55:42 Re: SRF patch (was Re: [HACKERS] troubleshooting pointers)