Skip site navigation (1) Skip section navigation (2)

Update Triggers accessing new values and intercepting.

From: "Larry Silvermintz" <larrys(at)ucla(dot)edu>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Update Triggers accessing new values and intercepting.
Date: 2009-06-05 02:32:30
Message-ID: CFA9C190AAC642CDBDD8D732F88BB63F@LARRY (view raw or flat)
Thread:
Lists: pgsql-novice
Please help explain how to use triggers with LANGUAGE SQL to enforce
assertions or complex schema-wide multiple-table constraints, firing "before
... on insert or update".

Perhaps this is also a topic for the Documentation forum, as it doesn't seem
to be present in the current docs.

Are there functionalities only available in functions written in LANGUAGE
SQL (my preference) or conversely, any which are unavailable when
implementing the handler function with SQL?

* How can the function access the values from the triggering insert/update
statement?  

* What does it mean to specify "RETURNS TRIGGER"?

* Specifically, Do I specify the return type (s) somehow?  

* How does one specify the values to be returned?

* HOw, based upon the outcome of the function, can the original statement's
values either be used to complete the insert/update, or else be discarded?

* Is there a way to generate an error message, like those reported when a
regular check constraint is violated?

** Where can I find examples of such constraint-enforcing triggers
implemented in Language SQL?

 

Most appreciatively, 

Larry Silvermintz

LarryS(at)ucla(dot)edu 

pgsql-novice by date

Next:From: Anirban PalDate: 2009-06-05 05:56:36
Subject: How to know the indexes on a Table
Previous:From: Tom LaneDate: 2009-06-04 23:12:39
Subject: Re: Re: postgres C function returning SETOF record gives RECORD TYPE NOT REGISTERED

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group