]> granicus.if.org Git - postgresql/commit
Support triggers on views.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Oct 2010 17:43:33 +0000 (13:43 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Oct 2010 17:45:07 +0000 (13:45 -0400)
commit2ec993a7cbdd8e251817ac6bbc9a704ce8346f73
tree1568fb4b00b6fa7997755113a3d0bbfead45c1fb
parentf7b15b5098ee89a2628129fbbef9901bded9d27b
Support triggers on views.

This patch adds the SQL-standard concept of an INSTEAD OF trigger, which
is fired instead of performing a physical insert/update/delete.  The
trigger function is passed the entire old and/or new rows of the view,
and must figure out what to do to the underlying tables to implement
the update.  So this feature can be used to implement updatable views
using trigger programming style rather than rule hacking.

In passing, this patch corrects the names of some columns in the
information_schema.triggers view.  It seems the SQL committee renamed
them somewhere between SQL:99 and SQL:2003.

Dean Rasheed, reviewed by Bernd Helmle; some additional hacking by me.
47 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/information_schema.sgml
doc/src/sgml/plperl.sgml
doc/src/sgml/plpgsql.sgml
doc/src/sgml/plpython.sgml
doc/src/sgml/pltcl.sgml
doc/src/sgml/ref/create_rule.sgml
doc/src/sgml/ref/create_trigger.sgml
doc/src/sgml/rules.sgml
doc/src/sgml/trigger.sgml
src/backend/catalog/index.c
src/backend/catalog/information_schema.sql
src/backend/catalog/sql_features.txt
src/backend/commands/copy.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/executor/execMain.c
src/backend/executor/nodeModifyTable.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/optimizer/prep/preptlist.c
src/backend/parser/gram.y
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/backend/utils/adt/ruleutils.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/include/catalog/catversion.h
src/include/catalog/pg_trigger.h
src/include/commands/trigger.h
src/include/nodes/parsenodes.h
src/include/utils/rel.h
src/pl/plperl/expected/plperl_trigger.out
src/pl/plperl/plperl.c
src/pl/plperl/sql/plperl_trigger.sql
src/pl/plpgsql/src/pl_exec.c
src/pl/plpython/expected/plpython_trigger.out
src/pl/plpython/plpython.c
src/pl/plpython/sql/plpython_trigger.sql
src/pl/tcl/expected/pltcl_queries.out
src/pl/tcl/expected/pltcl_queries_1.out
src/pl/tcl/expected/pltcl_setup.out
src/pl/tcl/pltcl.c
src/pl/tcl/sql/pltcl_queries.sql
src/pl/tcl/sql/pltcl_setup.sql
src/test/regress/expected/triggers.out
src/test/regress/sql/triggers.sql