On 24/12/2009 5:04 AM, Rosser Schwarz wrote:
On Wed, Dec 23, 2009 at 1:44 AM, Craig Ringer
<cr...@postnewspapers.com.au>  wrote:

SELECT COALESCE( t_number::text, t:string::text, t_date::text, t_boolean::text) 
AS value;

Your invocation of COALESCE is incorrect -- it is n-ary, but it
returns its first non-NULL argument.

Yes. That was the point.

I think we're assuming the OP wants different things. You're assuming they're trying to concatenate all fields, where more than one field in a given record may be non-null. I'm assuming that all but one field in each record will be null, and they want to show the "value" of the record - in other words, they're using the record as a sort of union type. It looks like that from the example they gave.

--
Craig Ringer

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to