Re: Is this a feature ?

Поиск
Список
Период
Сортировка
От Joel Burton
Тема Re: Is this a feature ?
Дата
Msg-id Pine.LNX.4.30.0206041325130.22841-100000@temp.joelburton.com
обсуждение исходный текст
Ответ на Is this a feature ?  (David BOURIAUD <david.bouriaud@ac-rouen.fr>)
Список 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@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant



В списке pgsql-sql по дате отправления:

Предыдущее
От: David BOURIAUD
Дата:
Сообщение: Re: Is this a feature ?
Следующее
От: Matthew Price
Дата:
Сообщение: Updating a table from another table