Re: [HACKERS] empty concatenate

sszabo@bigpanda.com

From: sszabo@bigpanda.com
To: Karel Zak - Zakkr <zakkr@zf.jcu.cz>
Cc: pgsql-hackers@postgresql.org
Date: 1999-12-23T16:58:13Z
Lists: pgsql-hackers
>
>Well, but why PgSQL ignore function result if any argument is NULL. IMHO is
>function's problem what return, and PgSQL must use this result. 
I believe this is a known issue that's being looked at right now.

However, in this case PostgreSQL seems to be correct. 
2) If <concatenation> is specified, then let S1 and S2 be the re-
 sult of the <character value expression> and <character factor>,
 respectively.
 Case:
 a) If either S1 or S2 is the null value, then the result of the
  <concatenation> is the null value.

>How can user write / use function which response on NULL (as IFNULL())?
Well, for now, you probably want to use coalesce around any input that
might be null.  I believe coalesce returns the first non-null parameter,
so coalesce(<column>, '') will return either the column's value (if not
NULL) or the empty string which can then be used for concatenation.

Stephan