diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-10-10 13:43:33 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-10-10 13:45:07 -0400 |
commit | 2ec993a7cbdd8e251817ac6bbc9a704ce8346f73 (patch) | |
tree | 1568fb4b00b6fa7997755113a3d0bbfead45c1fb /doc/src/sgml/plpython.sgml | |
parent | f7b15b5098ee89a2628129fbbef9901bded9d27b (diff) |
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.
Diffstat (limited to 'doc/src/sgml/plpython.sgml')
-rw-r--r-- | doc/src/sgml/plpython.sgml | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index c5445637f16..6eb884e0dc5 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -609,7 +609,7 @@ CREATE TYPE greeting AS ( who text ); </programlisting> - + A set result can be returned from a: <variablelist> @@ -751,8 +751,7 @@ $$ LANGUAGE plpythonu; <para> contains the event as a string: <literal>INSERT</>, <literal>UPDATE</>, - <literal>DELETE</>, <literal>TRUNCATE</>, - or <literal>UNKNOWN</>. + <literal>DELETE</>, or <literal>TRUNCATE</>. </para> </listitem> </varlistentry> @@ -761,8 +760,8 @@ $$ LANGUAGE plpythonu; <term><literal>TD["when"]</></term> <listitem> <para> - contains one of <literal>BEFORE</>, <literal>AFTER</>, - or <literal>UNKNOWN</>. + contains one of <literal>BEFORE</>, <literal>AFTER</>, or + <literal>INSTEAD OF</>. </para> </listitem> </varlistentry> @@ -771,8 +770,7 @@ $$ LANGUAGE plpythonu; <term><literal>TD["level"]</></term> <listitem> <para> - contains one of <literal>ROW</>, - <literal>STATEMENT</>, or <literal>UNKNOWN</>. + contains <literal>ROW</> or <literal>STATEMENT</>. </para> </listitem> </varlistentry> @@ -838,12 +836,14 @@ $$ LANGUAGE plpythonu; </para> <para> - If <literal>TD["when"]</literal> is <literal>BEFORE</> and + If <literal>TD["when"]</literal> is <literal>BEFORE</> or + <literal>INSTEAD OF</> and <literal>TD["level"]</literal> is <literal>ROW</>, you can return <literal>None</literal> or <literal>"OK"</literal> from the Python function to indicate the row is unmodified, - <literal>"SKIP"</> to abort the event, or <literal>"MODIFY"</> to - indicate you've modified the row. + <literal>"SKIP"</> to abort the event, or if <literal>TD["event"]</> + is <command>INSERT</> or <command>UPDATE</> you can return + <literal>"MODIFY"</> to indicate you've modified the new row. Otherwise the return value is ignored. </para> </sect1> |