Re: sql function with empty row

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: sql function with empty row
Дата
Msg-id 6dc24153-7c52-4bcd-1b2b-5ff31a1f3fec@aklaver.com
обсуждение исходный текст
Ответ на Re: sql function with empty row  (Philipp Kraus <philipp.kraus@tu-clausthal.de>)
Список pgsql-general
On 05/16/2018 11:49 AM, Philipp Kraus wrote:
> 
>> Am 16.05.2018 um 20:40 schrieb Adrian Klaver <adrian.klaver@aklaver.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.klaver@aklaver.com


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

Предыдущее
От: Philipp Kraus
Дата:
Сообщение: Re: sql function with empty row
Следующее
От: Jonathan Marks
Дата:
Сообщение: Re: Rapid disk usage spikes when updating large tables with GINindexes