Hello,

as per documentation
<https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-COALESCE-NVL-IFNULL>
>  The COALESCE function returns the first of its arguments that is not
null. Null is returned only if all arguments are null.

This is not exactly true. In fact:
The COALESCE function returns the first of its arguments that *is
distinct* *from
*null. Null is returned only if all arguments *are not distinct from* null.

See my stack overflow question here
<https://stackoverflow.com/questions/78691097/postgres-null-on-composite-types>
.

Long story short

select coalesce((null, null), (10, 20)) as magic;

returns

 magic -------
 (,)
(1 row)

However, this is true:

select (null, null) is null;


-- 

*Ing. Ondřej Navrátil, Ph.D.*
IT Analytik
M +420 728 625 950
E onavratil@monetplus <onavra...@monetplus.cz>.cz <onavra...@monetplus.cz>

MONET+,a.s., Za Dvorem 505, 763 14  Zlín-Štípa
monetplus.com <https://www.monetplus.cz/> | linkedin
<https://www.linkedin.com/company/monetplus/> | facebo
<https://www.facebook.com/monetplus/>ok
<https://www.facebook.com/monetplus/>

Reply via email to