Re: sql function with empty row

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Philipp Kraus <philipp(dot)kraus(at)tu-clausthal(dot)de>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: sql function with empty row
Date: 2018-05-16 20:35:43
Message-ID: CAKFQuwbJN0N-AnGQfyTzLaAjbE5+-euMehtPH92rnt-eKmNqeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 16, 2018 at 11:49 AM, Philipp Kraus <
philipp(dot)kraus(at)tu-clausthal(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hmidi slim 2018-05-16 22:19:53 When use triggers?
Previous Message Nikolay Samokhvalov 2018-05-16 20:31:34 Re: Rapid disk usage spikes when updating large tables with GIN indexes