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

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Andreas Joseph Krogh <andreak(at)officenet(dot)no>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: bug or feature, || -operator and NULLs
Date: 2006-10-18 18:43:32
Message-ID: 20061018184331.GH11184@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-10-18 18:43:47 Re: [HACKERS] Bug?
Previous Message Jim C. Nasby 2006-10-18 18:38:23 Re: bug or feature, || -operator and NULLs