From dd7e54a17ffed5767cd9af175024c60df2b1951c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 22 Jan 2009 17:27:55 +0000 Subject: Automatic view update rules Bernd Helmle --- doc/src/sgml/catalogs.sgml | 9 +++- doc/src/sgml/intro.sgml | 4 +- doc/src/sgml/ref/create_view.sgml | 100 +++++++++++++++++++++++++++++++++++--- 3 files changed, 104 insertions(+), 9 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index b590d0f4f79..bd267dcb758 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1,4 +1,4 @@ - + @@ -4144,6 +4144,13 @@ True if the rule is an INSTEAD rule + + is_auto + bool + + True if the rule was automatically generated + + ev_qual text diff --git a/doc/src/sgml/intro.sgml b/doc/src/sgml/intro.sgml index 78e8013d662..298ba910a95 100644 --- a/doc/src/sgml/intro.sgml +++ b/doc/src/sgml/intro.sgml @@ -1,4 +1,4 @@ - + Preface @@ -110,7 +110,7 @@ triggers - views + updatable views transactional integrity diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index e0347a1919d..daea5a97cb0 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -1,5 +1,5 @@ @@ -115,11 +115,99 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW n Notes - Currently, views are read only: the system will not allow an insert, - update, or delete on a view. You can get the effect of an updatable - view by creating rules that rewrite inserts, etc. on the view into - appropriate actions on other tables. For more information see - . + Some views are updatable, which means that the + commands INSERT, UPDATE, + and DELETE can be used on the view as if it + were a regular table. A view is updatable if it + does not contain: + + + + + more than one underlying table (joins) or no underlying table at all + + + + + + underlying tables/views that are themselves not updatable, + including table value constructors and table functions + + + + + + subqueries in the FROM list + + + + + + items in the select list that are not direct references to a + column of the underlying table, such as literals or any + nontrivial value expression + + + + + + references to system columns in the select list + + + + + + more than one reference to the same column in the select list + + + + + aggregate function calls + + + + window function calls + + + + + WITH or WITH RECURSIVE clauses + + + + + + DISTINCT, GROUP BY, or + HAVING clauses + + + + + + UNION, INTERSECT, or + EXCEPT clauses + + + + + + LIMIT or OFFSET clauses + (or other equivalent spellings thereof) + + + + + + + The updatable views implementation is based on the rule system. + Because of this, you can also make more complex views updatable or + insertable by creating your own rules that rewrite + the INSERT, + UPDATE, and DELETE actions + on the view into appropriate actions on other tables. You can + also replace the automatically generated rules by your own rules. + For more information on the rule system, refer + to . -- cgit v1.2.3