Re: Saving view turns SELECT * into field list - Mailing list pgsql-general

From Tom Lane
Subject Re: Saving view turns SELECT * into field list
Date
Msg-id 17168.1539633311@sss.pgh.pa.us
Whole thread Raw
In response to Saving view turns SELECT * into field list  (Ben Uphoff <buphoff@villagemd.com>)
List pgsql-general
Ben Uphoff <buphoff@villagemd.com> writes:
> Why, when I save a simple view like:
> SELECT * FROM a_table
> …does PostgreSQL turn the * into a field list like:
> SELECT field1, field2, field3, field4 FROM a_table
> ?

Because the SQL standard says we should.  There's explicit text in there
to the effect that adding columns to the underlying table does not add
columns to the view.  Which, I'm sure, is exactly what you wished would
happen ... but they say not to.

            regards, tom lane


pgsql-general by date:

Previous
From: Ben Uphoff
Date:
Subject: Saving view turns SELECT * into field list
Next
From: "David G. Johnston"
Date:
Subject: Re: Saving view turns SELECT * into field list