Re: Postgres 7.3.5 and count('x')

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Edwin S(dot) Ramirez" <ramirez(at)idconcepts(dot)org>, pgsql-hackers(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Postgres 7.3.5 and count('x')
Date: 2003-12-06 16:46:37
Message-ID: 200312061746.37190.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > What is COUNT('x') supposed to return? 1? Is that legal SQL?
>
> Why not?

Because there is nothing to count.

In general,

SELECT count(expr) FROM table1;

counts the number of rows in table1 where expr evaluates to not null.
If table1 is not specified, that rule no longer holds. At best you
could assume that table1 is empty and return 0. But a result of 1 I
cannot see justified.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-12-06 17:04:14 Re: 7.4.1 ... slight change of scheduale ...
Previous Message Bruce Momjian 2003-12-06 16:25:12 Re: pg_hba.conf change in 7.4