Re: Postgres 7.3.5 and count('x')

From: "Edwin S(dot) Ramirez" <ramirez(at)idconcepts(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 17:25:41
Message-ID: 3FD21115.8020703@idconcepts.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I tried :
select count('x') from patients;

And I get the same error.

select count('x'); should return the same as select count(*); which
returns 1.

Previous Postgres versions returned 1.

-ESR-

Peter Eisentraut wrote:

>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

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-12-06 17:38:44 Re: [HACKERS] bytea, index and like operator again and detailed report
Previous Message Bruce Momjian 2003-12-06 17:19:18 tablespaces?