Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread David G. Johnston
On Sat, May 14, 2016 at 5:34 PM, Adrian Klaver wrote: > On 05/14/2016 02:13 PM, Andrus wrote: > >> 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

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Adrian Klaver
On 05/14/2016 02:13 PM, Andrus wrote: 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

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Andrus
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

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Adrian Klaver
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

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread David G. Johnston
On Sat, May 14, 2016 at 4: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

[GENERAL] How to use row values as function parameters

2016-05-14 Thread Andrus
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