From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | James Coleman <jtc331(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's |
Date: | 2019-01-16 01:14:03 |
Message-ID: | CAKJS1f_xJfjER8nSLLCw+OFYeRFp9DhYMD2_YoTVZ=ztp8W-FA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 16 Jan 2019 at 14:05, James Coleman <jtc331(at)gmail(dot)com> wrote:
> At the risk of missing something obvious, I'm not sure I see a case
> where "x is not null" does not imply "(x + x) is not null", at least
> for integers. Since an integer + an integer results in an integer,
> then it must imply the addition of itself is not null also?
A strict function guarantees it will return NULL on any NULL input.
This does not mean it can't return NULL on a non-NULL input.
While int4pl might do what you want, some other strict function might
not. A simple example would be a strict function that decided to
return NULL when the two ints combined overflowed int.
The docs [1] define STRICT as:
"RETURNS NULL ON NULL INPUT or STRICT indicates that the function
always returns null whenever any of its arguments are null. If this
parameter is specified, the function is not executed when there are
null arguments; instead a null result is assumed automatically."
[1] https://www.postgresql.org/docs/devel/sql-createfunction.html
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | James Coleman | 2019-01-16 01:29:33 | Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's |
Previous Message | James Coleman | 2019-01-16 01:05:00 | Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's |