Re: select null + 0 question

Поиск
Список
Период
Сортировка
От
Тема Re: select null + 0 question
Дата
Msg-id 64897.216.238.112.88.1058185494.squirrel@$HOSTNAME
обсуждение исходный текст
Ответ на Re: select null + 0 question  (Mike Mascari <mascarm@mascari.com>)
Список pgsql-general
> Jean-Christian Imbeault wrote:
>
>> Why is it that "select null + 1" gives null but "select sum(a) from
>> table" where there are null entries returns an integer?
>>
>> Shouldn't the sum() and "+" operators behave the same?
> SQL92 (6.5 <set function specification>):
> 1) Case:
>  a) If COUNT(*) is specified, then the result is the cardinality of T.
>  b) Otherwise, ...
> So  ...
> CREATE TABLE foo (value integer);
> INSERT INTO foo VALUES (NULL);
> INSERT INTO foo VALUES (3);
> Compare:
> SELECT COUNT(*) FROM foo;
> vs.
> SELECT COUNT(value) FROM foo;

Interesting. Thanks for pointing that out. I hadn't thought about the
fact that, e.g.,

SELECT count(*), count(last_name), count(middle_name) FROM person

would produce

430, 430, 186

~Berend Tober




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

Предыдущее
От: Jason Tishler
Дата:
Сообщение: Re: [CYGWIN] pg_restore very slow
Следующее
От: nolan@celery.tssi.com
Дата:
Сообщение: Re: Auto Starting Postgresql Under Mandrake 9.1 ??