mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Support automatically-updatable views.
This patch makes "simple" views automatically updatable, without the need to create either INSTEAD OF triggers or INSTEAD rules. "Simple" views are those classified as updatable according to SQL-92 rules. The rewriter transforms INSERT/UPDATE/DELETE commands on such views directly into an equivalent command on the underlying table, which will generally have noticeably better performance than is possible with either triggers or user-written rules. A view that has INSTEAD OF triggers or INSTEAD rules continues to operate the same as before. For the moment, security_barrier views are not considered simple. Also, we do not support WITH CHECK OPTION. These features may be added in future. Dean Rasheed, reviewed by Amit Kapila
This commit is contained in:
@@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201211281
|
||||
#define CATALOG_VERSION_NO 201212081
|
||||
|
||||
#endif
|
||||
|
@@ -1976,6 +1976,11 @@ DESCR("type of the argument");
|
||||
DATA(insert OID = 3162 ( pg_collation_for PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 25 "2276" _null_ _null_ _null_ _null_ pg_collation_for _null_ _null_ _null_ ));
|
||||
DESCR("collation of the argument; implementation of the COLLATION FOR expression");
|
||||
|
||||
DATA(insert OID = 3842 ( pg_view_is_insertable PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_view_is_insertable _null_ _null_ _null_ ));
|
||||
DESCR("is a view insertable-into");
|
||||
DATA(insert OID = 3843 ( pg_view_is_updatable PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_view_is_updatable _null_ _null_ _null_ ));
|
||||
DESCR("is a view updatable");
|
||||
|
||||
/* Deferrable unique constraint trigger */
|
||||
DATA(insert OID = 1250 ( unique_key_recheck PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ unique_key_recheck _null_ _null_ _null_ ));
|
||||
DESCR("deferred UNIQUE constraint check");
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
extern List *QueryRewrite(Query *parsetree);
|
||||
extern void AcquireRewriteLocks(Query *parsetree, bool forUpdatePushedDown);
|
||||
|
||||
extern Node *build_column_default(Relation rel, int attrno);
|
||||
extern bool relation_is_updatable(Oid reloid, int req_events);
|
||||
|
||||
#endif /* REWRITEHANDLER_H */
|
||||
|
@@ -482,6 +482,8 @@ extern Datum pg_sleep(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_get_keywords(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_typeof(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_collation_for(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_view_is_insertable(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_view_is_updatable(PG_FUNCTION_ARGS);
|
||||
|
||||
/* oid.c */
|
||||
extern Datum oidin(PG_FUNCTION_ARGS);
|
||||
|
Reference in New Issue
Block a user