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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bug or feature, || -operator and NULLs
Date: 2006-10-18 13:13:30
Message-ID: 4536287A.8010503@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas Joseph Krogh wrote:
> This has been been discussed before, but Oracle behaves differently, and IMHO
> in a more correct way.
>
> The following query returns NULL in PG:
> SELECT NULL || 'fisk';
>
> But in Oracle, it returns 'fisk':
> SELECT NULL || 'fisk' FROM DUAL;
>
> The latter seems more logical...
>
>

When in doubt, consult the standard ... Oracle's treatment of NULL is
known to violate the standard, IIRC. Your measure of correctness seems
to be "appears to me more logical", but ours is "complies with the
standard".

In any case, why should null have a string value of '' any more than it
should have a value of 'blurfl'?

Your analogy elsewhere with aggregate functions like sum() is not
relevant, as these are documented to ignore null values.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mario Weilguni 2006-10-18 13:15:01 Re: bug or feature, || -operator and NULLs
Previous Message Lukas Kahwe Smith 2006-10-18 13:11:47 Re: bug or feature, || -operator and NULLs