Re: bug or feature, || -operator and NULLs

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: bug or feature, || -operator and NULLs
Дата
Msg-id 20061018184331.GH11184@svana.org
обсуждение исходный текст
Ответ на Re: bug or feature, || -operator and NULLs  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: bug or feature, || -operator and NULLs
Список pgsql-hackers
On Wed, Oct 18, 2006 at 11:36:44AM -0700, Jeff Davis wrote:
> > What's being suggested simply violates common sense. Basically:
> >
> > if (a = b) then (a||c = b||c)
> >
>
> If a is 'x' and b is 'x' and c is NULL, the above statement doesn't hold
> in PostgreSQL.

Heh, well, c is supposed to be not NULL. Missed that. I was using the
equals to include (NULL = NULL) but in SQL it's not like that.

> I'm not disagreeing with your overall point, I'm just missing what you
> meant by the above statement. What are a, b, and c supposed to be?

I was trying to point out that what was being proposed was:

NULL || 'bar'    => 'bar'
'' || 'bar'      => 'bar'

But NULL is not an empty string. Oracle chooses to make NULL and the
empty string the same, we don't. So logically we shouldn't treat them
the same for text concatination either.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Bug?
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: bug or feature, || -operator and NULLs