Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC8xR-0006jO-Ne for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 19:55:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gC8xQ-0003jv-3F for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 19:55:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC8xP-0003jn-RI for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 19:55:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC8xN-0002ba-SJ for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 19:55:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9FJtB27017169; Mon, 15 Oct 2018 15:55:11 -0400 From: Tom Lane To: Ben Uphoff cc: "pgsql-general@lists.postgresql.org" Subject: Re: Saving view turns SELECT * into field list In-reply-to: <4748E0E4-9D2A-4D44-B20F-6749E8C989D7@villagemd.com> References: <4748E0E4-9D2A-4D44-B20F-6749E8C989D7@villagemd.com> Comments: In-reply-to Ben Uphoff message dated "Mon, 15 Oct 2018 19:50:05 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <17167.1539633311.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 15 Oct 2018 15:55:11 -0400 Message-ID: <17168.1539633311@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ben Uphoff 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