Re: targetlist functions part 1 (was [HACKERS] targetlist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Joe Conway <mail(at)joeconway(dot)com>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: targetlist functions part 1 (was [HACKERS] targetlist
Date: 2003-01-21 21:37:07
Message-ID: 11576.1043185027@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> Do you see another way to pass non-constant arguments to the
>> table-generating function?

> SELECT * FROM table1 AS t1, table2 AS t2, func1(t1.col, t2.col) ... ?

> That's a syntax that would make sense to me.

That syntax makes no sense whatsoever to me. You are imputing a
causal connection between FROM elements that are at the same level,
which is just totally contrary to any sane understanding of SQL
semantics. Exactly which t1.col value(s) do you see the above syntax
as passing to the func()? Your answer had better not mention the
WHERE clause, because the input tables have to be determined before
WHERE has anything to operate on.

> With sufficiently blurred vision one might even find SQL99's clause
> <collection derived table> ::=
> UNNEST <left paren> <collection value expression> <right paren>
> applicable. Or maybe not.

Hm. I'm not sure what UNNEST does, but now that you bring SQL99 into
the picture, what about WITH? That might solve the problem, because
(I think) WITH tables are logically determined before the main SELECT
begins to execute.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug McNaught 2003-01-21 21:56:55 Yaarrgh! CVS remote buffer overflow
Previous Message Peter Eisentraut 2003-01-21 21:32:07 Re: targetlist functions part 1 (was [HACKERS] targetlist

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2003-01-22 20:42:54 Re: [PATCHES] targetlist functions part 1 (was targetlist
Previous Message Peter Eisentraut 2003-01-21 21:32:07 Re: targetlist functions part 1 (was [HACKERS] targetlist