Re: A view needs at least one column whereas a table doesn't... - Mailing list pgsql-general

From Tom Lane
Subject Re: A view needs at least one column whereas a table doesn't...
Date
Msg-id 652.1171383129@sss.pgh.pa.us
Whole thread Raw
In response to A view needs at least one column whereas a table doesn't...  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
List pgsql-general
"Gurjeet Singh" <singh.gurjeet@gmail.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

pgsql-general by date:

Previous
From: "Gurjeet Singh"
Date:
Subject: A view needs at least one column whereas a table doesn't...
Next
From: RPK
Date:
Subject: PGSQL 8.2.3 Installation problem