Re: A view needs at least one column whereas a table doesn't...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
Cc: "PGSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: A view needs at least one column whereas a table doesn't...
Date: 2007-02-13 16:12:09
Message-ID: 652.1171383129@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> writes:
> I know the ERROR seems obvious, but then if we allow zero-column tables,
> then why not zero-column views?
> Or should the question be, why do we allow zero-column tables?

Neither one is legal per the SQL spec. We allow zero-column tables
because otherwise there are unpleasant corner cases for ALTER TABLE DROP
COLUMN, ie, you couldn't drop the last remaining column before adding
another. But since we don't have ALTER VIEW DROP COLUMN, there's no
comparable argument for violating the spec for views.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message RPK 2007-02-13 16:14:42 PGSQL 8.2.3 Installation problem
Previous Message loulou2u 2007-02-13 16:08:49 Help, Can't figure out what is wrong with my stored procedure