Re: question about count(b) where b is a custom type

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: question about count(b) where b is a custom type
Дата
Msg-id 437B3ED2.3090004@wildenhain.de
обсуждение исходный текст
Ответ на Re: question about count(b) where b is a custom type  ("Pollard, Mike" <mpollard@cincom.com>)
Ответы Re: question about count(b) where b is a custom type  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Список pgsql-hackers
Pollard, Mike schrieb:
> If count(<col>) convert <col> to a string (an assumption that Martijn
> has cast into doubt, or perhaps shredded), then rather than convert all
> non-nulls that are not a string into a string, I was proposing
> converting the values into an int with the values 0 or 1 (0 means that
> row was null for that column, 1 means that row was not null;, since
> count(<col>) means count the non-null rows in <col>).

I'm not getting how you got this idea of count() doing any conversion?
It does not and there is nothing in the docs wich would lead to this.

> Anyway, to make a short story long.  The idea is rather than convert the
> column into a string, convert it into a value indicating whether the
> column was null or not null (which is all count cares about).  In any
> case, it's moot idea since it appears Postgres already does that.

No, count does not convert. It just counts all non null values.
If you want to count rows, just use count(*).


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

Предыдущее
От: Michael Alan Dorman
Дата:
Сообщение: Re: bind variables, soft vs hard parse
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: PG_DUMP and table locking in PG7.4