Re: sql function with empty row - Mailing list pgsql-general

From David G. Johnston
Subject Re: sql function with empty row
Date
Msg-id CAKFQuwbJN0N-AnGQfyTzLaAjbE5+-euMehtPH92rnt-eKmNqeA@mail.gmail.com
Whole thread Raw
In response to Re: sql function with empty row  (Philipp Kraus <philipp.kraus@tu-clausthal.de>)
List pgsql-general
On Wed, May 16, 2018 at 11:49 AM, Philipp Kraus <philipp.kraus@tu-clausthal.de> wrote:
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].

​Without setof it will always return exactly 1 row, never 0.  This is a feature as returning zero rows is problematic in many ways; a 0-row result in a select-list will cause that row to be removed from the result when is most cases people would rather be told whatever they were trying to compute for the row simply didn't compute - via a NULL.

David J.

pgsql-general by date:

Previous
From: Nikolay Samokhvalov
Date:
Subject: Re: Rapid disk usage spikes when updating large tables with GIN indexes
Next
From: hmidi slim
Date:
Subject: When use triggers?