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

From Andreas Joseph Krogh
Subject Re: bug or feature, || -operator and NULLs
Date
Msg-id 200610181428.50964.andreak@officenet.no
Whole thread Raw
In response to Re: bug or feature, || -operator and NULLs  (Csaba Nagy <nagy@ecircle-ag.com>)
Responses Re: bug or feature, || -operator and NULLs
Re: bug or feature, || -operator and NULLs
Re: bug or feature, || -operator and NULLs
List pgsql-hackers
On Wednesday 18 October 2006 14:15, Csaba Nagy wrote:
> > 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...
>
> Why would it be more logical ?

How many times do you *really* want to get the "not known" answer here instead
of 'fisk'? To put it another way: When will it be *wrong* to return 'fisk'?

> NULL means "value not known".

I know.

> Concatenate "value not known" with 'fisk' -> what's the logical answer?
>
> I would say the logical result is 'value not known'... if one of the
> components is not known, how can you know what is the result ?

That's like saying: SELECT sum(field) should return NULL(value not known) if
some of the tuples are NULL, which is definitly not what you want.

--
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / Manager
gpg public_key: http://dev.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Asynchronous I/O Support
Next
From: Martijn van Oosterhout
Date:
Subject: Re: bug or feature, || -operator and NULLs