Re: bug or feature, || -operator and NULLs - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: bug or feature, || -operator and NULLs
Date
Msg-id 4536287A.8010503@dunslane.net
Whole thread Raw
In response to bug or feature, || -operator and NULLs  (Andreas Joseph Krogh <andreak@officenet.no>)
Responses Re: bug or feature, || -operator and NULLs
List 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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: bug or feature, || -operator and NULLs
Next
From: Csaba Nagy
Date:
Subject: Re: bug or feature, || -operator and NULLs