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

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: bug or feature, || -operator and NULLs
Дата
Msg-id 200610181544.05664.andreak@officenet.no
обсуждение исходный текст
Ответ на Re: bug or feature, || -operator and NULLs  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: bug or feature, || -operator and NULLs  (Andrew Dunstan <andrew@dunslane.net>)
Re: bug or feature, || -operator and NULLs  (Martijn van Oosterhout <kleptog@svana.org>)
Re: bug or feature, || -operator and NULLs  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
On Wednesday 18 October 2006 15:13, Andrew Dunstan wrote:
> 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".

I know PG violates the standard in other places and core's favourite argument
for doing so is "the standard is braindead here, so we do it our way".

> 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.

I'm not advocating that NULL should have a string-vaule of anything, just that
the ||-operator shuld treat NULL as "dont bother with it and proceed
concatenation".

--
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 по дате отправления:

Предыдущее
От: "Mario Weilguni"
Дата:
Сообщение: Re: bug or feature, || -operator and NULLs
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: bug or feature, || -operator and NULLs