Re: Is this a feature ?

Поиск
Список
Период
Сортировка
От Nick Fankhauser
Тема Re: Is this a feature ?
Дата
Msg-id NEBBLAAHGLEEPCGOBHDGIEBLFBAA.nickf@ontko.com
обсуждение исходный текст
Ответ на Is this a feature ?  (David BOURIAUD <david.bouriaud@ac-rouen.fr>)
Ответы Re: Is this a feature ?  (David BOURIAUD <david.bouriaud@ac-rouen.fr>)
Список pgsql-sql
> 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 !!!!

The crux of the matter is that zero and null aren't the same thing. Null
means in essence "We don't know", so this equation is better writtin as:

1+2+"don't know" = "don't know"

> is there a
> way to work
> this around ?

It *is* often true that when concatenating strings, we want to tell SQL "if
this value is null, treat it like an empty string". This is how you would do
it:

coalesce( civ,'')||coalesce(name,'')||coalesce(forname,'')

Regards,

-Nick








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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Is this a feature ?
Следующее
От: David BOURIAUD
Дата:
Сообщение: Re: Is this a feature ?