Re: Sub-query as function argument
От
Tom Lane
Тема
Re: Sub-query as function argument
Дата
Msg-id
29178.1135091259@sss.pgh.pa.us
Ответ на
Sub-query as function argument (Michael Burke)
Список
Дерево обсуждения
Sub-query as function argument Michael Burke <michael@engtech.ca>
Re: Sub-query as function argument Tom Lane <tgl@sss.pgh.pa.us>
Re: Sub-query as function argument Jaime Casanova <systemguards@gmail.com>
Re: Sub-query as function argument Michael Burke <michael@engtech.ca>
Michael Burke writes:
> Is it possible to execute a SELECT query as an argument to a function?
> SELECT my_func('Sample', NULL, SELECT MIN(year) FROM audio);
You need parentheses around the sub-SELECT.
SELECT my_func('Sample', NULL, (SELECT MIN(year) FROM audio));
This is generally true everywhere in expressions, not just in
function arguments. Without the parens, it's often ambiguous
what's subselect and what's outer query.
regards, tom lane
В списке pgsql-sql по дате отправления