PostgreSQL 9 Administration Cookbook by Unknown

PostgreSQL 9 Administration Cookbook by Unknown

Author:Unknown
Language: eng
Format: epub, mobi
Publisher: Packt Publishing


Each row in our view corresponds to one row in a single-source table and each column is referred to directly without a function call. So we expect to be able to make inserts, updates, and deletes pass through our view into the base table.

The following examples are all views where inserts, updates, and deletes cannot easily be made to flow to the base table.

If we had views that look like the following:

CREATE VIEW cust_avg ASSELECT avg(age) FROM cust; CREATE VIEW cust_above_avg_age ASSELECT customerid ,substr(firstname, 1, 20) as fname ,substr(lastname, 1, 20) as lname ,age - (SELECT avg(age)::integer FROM cust) as years_above_avg FROM cust WHERE age > (SELECT avg(age) FROM cust); CREATE VIEW potential_spammers ASSELECT customerid FROM cust ORDER BY spam_score(firstname, lastname) DESCLIMIT 100;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.