Re: How to use row values as function parameters

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: How to use row values as function parameters
Дата
Msg-id 1b763502-f913-d56e-bc37-24e9b64d25b3@aklaver.com
обсуждение исходный текст
Ответ на How to use row values as function parameters  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
On 05/14/2016 01:47 PM, Andrus wrote:
> Table ko should used to pass parameters to crtKAIVE() function.
> ko has always single row.
>
> I tried
>
> CREATE or replace FUNCTION public.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');
> select * from ko, crtkaive(ko.doktyyp)

test=# select *, crtkaive(ko.doktyyp) from ko;


  doktyyp | crtkaive


---------+----------


  G       |        1

>
> but got error
>
>    ERROR:  function expression in FROM cannot refer to other relations
> of same query level
>
> How to fix this so that ko can used to pass parameters to crtkaive ?
>
> Posted also in
>
> http://stackoverflow.com/questions/37231624/how-to-use-table-row-values-as-function-parameters
>
>
> Andrus.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: How to use row values as function parameters
Следующее
От: "Andrus"
Дата:
Сообщение: Re: How to use row values as function parameters