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

From Ben Madin
Subject Re: Saving view turns SELECT * into field list
Date
Msg-id CA+weYr3-Ru8tn+wdXjv=VNHuY0sGi_5FDVJR-z_qEYrFLcsAbg@mail.gmail.com
Whole thread Raw
In response to Saving view turns SELECT * into field list  (Ben Uphoff <buphoff@villagemd.com>)
List pgsql-general
Actually, it's super useful, because if someone adds a salaries column to your staff table, it doesn't automatically appear on the front page of your corporate website... :) 

Made up example, but if you presume that data security is an important part of data management, it is a livesaver.

To get around it all you have to do is script a drop and replace action.

A last word - if you have nested views, remember that they are essentially just query aliases that return an unindexed result set... 

cheers

Ben



On 16 October 2018 at 03:50, Ben Uphoff <buphoff@villagemd.com> wrote:

Hey team – I’m sure this has come up, but my search engine skills couldn’t find an explanation:

 

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

 

?

 

This is super-frustrating, as it means I’ll have to manually change an aggregating “parent” view’s select lists every time I change the “child” views.

 

Thanks for any info. -Ben

******************* PLEASE NOTE ******************* This E-Mail/telefax message and any documents accompanying this transmission may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you.



--

Ausvet Logo

Dr Ben Madin
 
BVMS MVPHMgmt PhD MANZCVS GAICD
Managing Director
Skype: benmadin
Address: 
5 Shuffrey Street
Fremantle, WA 6160
Australia

pgsql-general by date:

Previous
From: "Phil Endecott"
Date:
Subject: Re: Filtering before join with date_trunc()
Next
From: Ben Madin
Date:
Subject: Re: Problem creating a database