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

Re: count(*) of zero rows returns 1

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Johnston <polobo(at)yahoo(dot)com>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: count(*) of zero rows returns 1
Date: 2013-01-15 19:16:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, Jan 14, 2013 at 10:47:58PM -0500, Gurjeet Singh wrote:
> Interesting to note that SELECT * FROM table_with_zero_cols does not complain
> of anything.
> postgres=# select * from test1;
> --
> (0 rows)
> This I believe result of the fact that we allow user to drop all columns of a
> table.
> On a side note, Postgres allows me to do this (which I don't think is a bug or
> useless): I inserted some rows into a table, and then dropped the columns. The
> resulting table has no columns, but live rows.
> postgres=# select * from test_0_col_table ;
> --
> (200000 rows)

I found this funny.

  Bruce Momjian  <bruce(at)momjian(dot)us>

  + It's impossible for everything to be true. +

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2013-01-15 19:18:40
Subject: Re: count(*) of zero rows returns 1
Previous:From: Peter EisentrautDate: 2013-01-15 19:16:01
Subject: pkg-config files for libpq and ecpg

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