Re: full featured alter table?
Mattias Kregert <mattias@kregert.se>
From: "Mattias Kregert" <mattias@kregert.se>
To: <pgsql-general@postgresql.org>
Date: 2003-06-17T10:04:16Z
Lists: pgsql-general
> > Presentation order should be done at the application level. I agree. Use a VIEW for the presentation! If you use a VIEW for the presentation, then the presentation code can use SELECT * from that view. The code will never have to be changed. The VIEW is the presentation - Change the VIEW, and the presentation is changed. If you use SELECT * from a table, then you might have to change the code later if you later decide you want to join in other tables. With a VIEW this is not a problem. If you want the columns from table "customers" in one order for one report and another order for another report, then a SELECT * from table will never work. ALTER TABLE ...POSITION.. won't help either. With a VIEW this is not a problem. If you want the rows from table "customers" ordered by customer_name for one report and by sales_limit for another report, then a SELECT * from table will never work because you don't know (on the application level) what columns there will be in the table and what they mean. With a VIEW this is not a problem. If you want the column "very_sensitive_personal_opinions_about_this_customer" not to show up in every report, then a SELECT * from table will never work. With a VIEW this is not a problem. ... and so on... Sure, you (may) have to update the view when you add or drop a column. However, that is *easy* to do, and you get all of the above mentioned positive effects. Conclusion: Use SELECT * FROM <view> The network is the computer. The view is the presentation. /Mattias Tip 4711: The VIEW is the presentation