count(*) of zero rows returns 1

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: count(*) of zero rows returns 1
Date: 2013-01-13 21:12:18
Message-ID: CABwTF4WOpQi53+rSoHOrP1j0LpbQ7vtyF2mvOP__cZwmas4Scw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Can somebody explain why a standalone count(*) returns 1?

postgres=# select count(*);
count
-------
1
(1 row)

I agree it's an odd thing for someone to query, but I feel it should return
0, and not 1.

--
Gurjeet Singh

http://gurjeet.singh.im/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-01-13 21:16:10 Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)
Previous Message Tom Lane 2013-01-13 21:09:29 Re: erroneous restore into pg_catalog schema