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

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "PGSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: A view needs at least one column whereas a table doesn't...
Date: 2007-02-13 15:59:26
Message-ID: 65937bea0702130759g750436bbhb244bc9fd5ec343f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The first SQL command throws an error whereas the second one runs fine:

edb=# create schema s1 authorization u1
edb-# create table t1() create view v1 as select * from t1;
ERROR: view must have at least one column
edb=#
edb=# create schema s1 authorization u1
edb-# create table t1( c1 int ) create view v1 as select * from t1;
CREATE SCHEMA
edb=#

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? (is
inheritance the only reason?)

Can someone provide some explanation for this behaviour?

Best regards,

--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | yahoo }.com
17°29'34.37"N 78°30'59.76"E

Responses

Browse pgsql-general by date

  From Date Subject
Next Message loulou2u 2007-02-13 16:08:49 Help, Can't figure out what is wrong with my stored procedure
Previous Message Tom Lane 2007-02-13 15:25:04 Re: Possible outer join bug with coalesce in 8.2