Re: coalesce for null AND empty strings - Mailing list pgsql-general

From Alban Hertroys
Subject Re: coalesce for null AND empty strings
Date
Msg-id 460CCD49.7070201@magproductions.nl
Whole thread Raw
In response to coalesce for null AND empty strings  (Ferdinand Gassauer <gassauer@kde.org>)
List pgsql-general
Ferdinand Gassauer wrote:
> Hi!
>
> it would be great to have a coalesce2 function which treats empty strings as
> null values.

I think

 COALESCE(NULLIF(value1, ''), value2)

does what you want. You could wrap that in a new function coalesce2 if
you like.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: coalesce for null AND empty strings
Next
From: Csaba Kalman
Date:
Subject: PANIC: unexpected hash relation size