From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ben Uphoff <buphoff@villagemd.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Saving view turns SELECT * into field list
Date: Mon, 15 Oct 2018 15:55:11 -0400
Message-ID: <17168.1539633311@sss.pgh.pa.us> (raw)
In-Reply-To: <4748E0E4-9D2A-4D44-B20F-6749E8C989D7@villagemd.com>
References: <4748E0E4-9D2A-4D44-B20F-6749E8C989D7@villagemd.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, buphoff@villagemd.com
Subject: Re: Saving view turns SELECT * into field list
In-Reply-To: <17168.1539633311@sss.pgh.pa.us>
References: <4748E0E4-9D2A-4D44-B20F-6749E8C989D7@villagemd.com> <17168.1539633311@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox