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

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: bug or feature, || -operator and NULLs
Дата
Msg-id 200610181428.50964.andreak@officenet.no
обсуждение исходный текст
Ответ на Re: bug or feature, || -operator and NULLs  (Csaba Nagy <nagy@ecircle-ag.com>)
Ответы Re: bug or feature, || -operator and NULLs  (Martijn van Oosterhout <kleptog@svana.org>)
Re: bug or feature, || -operator and NULLs  (Csaba Nagy <nagy@ecircle-ag.com>)
Re: bug or feature, || -operator and NULLs  (Jeff Davis <pgsql@j-davis.com>)
Список 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 по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Asynchronous I/O Support
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: bug or feature, || -operator and NULLs