Re: Combine function returning NULL unhandled? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Combine function returning NULL unhandled?
Date
Msg-id CA+TgmoanqfkVaAO5kjQKyvcfUpCkF35P9=9rFjXjfTq-rzCc0Q@mail.gmail.com
Whole thread Raw
In response to Combine function returning NULL unhandled?  (Andres Freund <andres@anarazel.de>)
Responses Re: Combine function returning NULL unhandled?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Mon, Nov 20, 2017 at 10:36 PM, Andres Freund <andres@anarazel.de> wrote:
> The plain transition case contains:
>                 if (pergroupstate->transValueIsNull)
>                 {
>                         /*
>                          * Don't call a strict function with NULL inputs.  Note it is
>                          * possible to get here despite the above tests, if the transfn is
>                          * strict *and* returned a NULL on a prior cycle. If that happens
>                          * we will propagate the NULL all the way to the end.
>                          */
>                         return;
>                 }
>
> how come similar logic is not present for combine functions? I don't see
> any checks preventing a combinefunc from returning NULL, nor do I see
> https://www.postgresql.org/docs/devel/static/sql-createaggregate.html
> spell out a requirement that that not be the case.

I don't know of a reason why that logic shouldn't be present for the
combine-function case as well.  It seems like it should be pretty
straightforward to write a test that hits that case and watch it blow
up ... assuming it does, then I guess we should back-patch the
addition of that logic.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] Custom compression methods
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] CLUSTER command progress monitor