From: | Joel Burton <joel(at)joelburton(dot)com> |
---|---|
To: | David BOURIAUD <david(dot)bouriaud(at)ac-rouen(dot)fr> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Is this a feature ? |
Date: | 2002-06-04 17:26:32 |
Message-ID: | Pine.LNX.4.30.0206041325130.22841-100000@temp.joelburton.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 4 Jun 2002, David BOURIAUD wrote:
> Hi the list !
> I've read the docs, and found that you could concatenate two or more strings
> in one select statement like this :
> select
> civ || name || forname as identity
> from
> person;
>
> This just works fine and returns rows with only one column named identity.
> So far, if one of the fields (civ, name or forname) is null, identity is
> null... That doesn't seems right, since it means that 1+2+0 = 0 !!!!
> Has anybody else seen the same strange behaviour ? And is there a way to work
> this around ?
Yes, it's a feature, and yes, it's the standard.
No, it's not like 1+2+0=0. It's like 1+2+UNKNOWN=UNKNOWN, which is exactly
correct. NULL is __not__ the same thing as 0 or empty string; it
represents an unknown value.
Use the COALESCE function to turn a NULL value into something else.
- J.
--
Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew Price | 2002-06-04 20:37:30 | Updating a table from another table |
Previous Message | James Orr | 2002-06-04 15:14:36 | Re: Is this a feature ? |