Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group