Re: How to use row values as function parameters
От | Andrus |
---|---|
Тема | Re: How to use row values as function parameters |
Дата | |
Msg-id | 7263ADA7656144AE911BF5EB386A35FD@dell2 обсуждение исходный текст |
Ответ на | Re: How to use row values as function parameters ("David G. Johnston" <david.g.johnston@gmail.com>) |
Ответы |
Re: How to use row values as function parameters
|
Список | pgsql-general |
Hi!
Thank you.
>
Use a CTE and move the function call to the select list - then explode the result in the main query.
>Basically:
>WITH func_cte AS (
>SELECT func_call(tbl)
FROM tbl
)
>SELECT (func_call).*
>FROM func_cte;
>The parens are required to make the parser see func_call as a column name instead of a table name.
I tried in 9.5
CREATE or replace FUNCTION crtKAIVE(
_doktyybid text default 'GVY'
)
RETURNS TABLE (
id integer
)
AS $f_crkaive$
select 1
$f_crkaive$ LANGUAGE sql STABLE;
create temp table ko ( doktyyp text ) on commit drop;
insert into ko values ('G');
WITH func_cte AS (
SELECT crtKAIVE(ko.doktyyp)
FROM ko
)
SELECT (crtKAIVE).*
FROM func_cte;
but got strange error
ERROR: syntax error at or near ""
LINE 18: )
How to fix ?
Andrus.
В списке pgsql-general по дате отправления: