COALESCE documentation - Mailing list pgsql-docs

From Navrátil, Ondřej
Subject COALESCE documentation
Date
Msg-id CAEELDaqnn5GayihUUhnKLR1_fegb-_b2i+4_dP4U192uK7j9vw@mail.gmail.com
Whole thread Raw
Responses Re: COALESCE documentation
Re: COALESCE documentation
List pgsql-docs
Hello,

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.

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
.cz

MONET+,a.s., Za Dvorem 505, 763 14  Zlín-Štípa
monetplus.com | linkedin | facebo
ok

pgsql-docs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Missing information on '-X' in section 26.3.6.1.
Next
From: PG Doc comments form
Date:
Subject: tutorial not accurate