Update Triggers accessing new values and intercepting. - Mailing list pgsql-novice

From Larry Silvermintz
Subject Update Triggers accessing new values and intercepting.
Date
Msg-id CFA9C190AAC642CDBDD8D732F88BB63F@LARRY
Whole thread Raw
List 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@ucla.edu

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: postgres C function returning SETOF record gives RECORD TYPE NOT REGISTERED
Next
From: Brent Austin
Date:
Subject: self-contained db for osx app