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

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: bug or feature, || -operator and NULLs
Дата
Msg-id 1161177415.32342.41.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на Re: bug or feature, || -operator and NULLs  (Andreas Joseph Krogh <andreak@officenet.no>)
Список pgsql-hackers
> Why do these discussions always end in academic arguments over whats more 
> logical then not? 

Because you asked the (rhetorical from your POV) question 'isn't this
more logical ?'

> From a *user's* point of view I really would like it to 
> treat the NULL operand of || as '', and obviously many other (at least 
> Oracle) users tend to agree with me on that.

They have to, otherwise they can't meaningfully concatenate an empty
string to anything in Oracle, because there's no such thing in Oracle...
empty string = NULL in Oracle, which is the real cause of the problem.
We've been bitten by this on Oracle before.

> If aggregates ignore NULL one could argue that so shuld the ||-operator?

OK, this is more complicated I guess, check out the rules related to
'strict' state transition functions in:

http://www.postgresql.org/docs/8.1/static/sql-createaggregate.html

Basically, if you like, you could define a 'my_sum' aggregate which does
not ignore nulls. Or you can define an operator which treats NULLs as
empty string if you like...

Cheers,
Csaba.





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: bug or feature, || -operator and NULLs
Следующее
От: "Indira Muthuswamy"
Дата:
Сообщение: Bug?