From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Philipp Kraus <philipp(dot)kraus(at)tu-clausthal(dot)de> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: sql function with empty row |
Date: | 2018-05-16 19:59:11 |
Message-ID: | 6dc24153-7c52-4bcd-1b2b-5ff31a1f3fec@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/16/2018 11:49 AM, Philipp Kraus wrote:
>
>> Am 16.05.2018 um 20:40 schrieb Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:
>>
>
> I have tested it on my data and it works also, but that is a little bit confusing, because imho setof is >= 0 rows and
> without setof it is [0,1]. On this I know there exist only one or no record, so I choose the solution without setof
I gotta believe the difference is:
RETURNS substance
https://www.postgresql.org/docs/10/static/xfunc-sql.html#XFUNC-SQL-TABLE-FUNCTIONS
"
If the function is defined to return a composite type, the table
function produces a column for each attribute of the composite type."
RETURNS SETOF substance
https://www.postgresql.org/docs/10/static/xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-SET
"When an SQL function is declared as returning SETOF sometype, the
function's final query is executed to completion, and each row it
outputs is returned as an element of the result set."
>
> Thanks for help
>
> Phil
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan Marks | 2018-05-16 20:10:26 | Re: Rapid disk usage spikes when updating large tables with GIN indexes |
Previous Message | Philipp Kraus | 2018-05-16 18:49:55 | Re: sql function with empty row |