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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: targetlist functions part 1 (was [HACKERS] targetlist
Дата
Msg-id 11576.1043185027@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: targetlist functions part 1 (was [HACKERS] targetlist  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
Peter Eisentraut <peter_e@gmx.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

В списке pgsql-patches по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: targetlist functions part 1 (was [HACKERS] targetlist
Следующее
От: Rod Taylor
Дата:
Сообщение: SEQUENCEs and NO MAXVALUE NO MINVALUE