Re: count(*) of zero rows returns 1 - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: count(*) of zero rows returns 1
Date
Msg-id 20130115191638.GB27934@momjian.us
Whole thread Raw
In response to Re: count(*) of zero rows returns 1  (Gurjeet Singh <singh.gurjeet@gmail.com>)
List 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@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pkg-config files for libpq and ecpg
Next
From: Bruce Momjian
Date:
Subject: Re: count(*) of zero rows returns 1