Re: Multi-table CHECK constraint - Mailing list pgsql-general

From Jason Long
Subject Re: Multi-table CHECK constraint
Date
Msg-id 49405D87.2080104@supernovasoftware.com
Whole thread Raw
In response to Re: Multi-table CHECK constraint  ("Richard Broersma" <richard.broersma@gmail.com>)
List pgsql-general
Richard Broersma wrote:
On Wed, Dec 10, 2008 at 3:58 PM, Jason Long
<mailing.list@supernovasoftware.com> wrote:
 
I need to add some complex constraints at the DB.
These will involve several tables.
What is the best approach for this?   
Well ANSI-SQL provides the CREATE ASSERTION for this purpose.
However, PostgreSQL doesn't support this feature.  It can be mimiced
by using the PostgreSQL CONSTRAINT TRIGGER extenstion.  IIRC, it works
very much like an ordinary trigger except that you must raise an error
when an DML attempt possibly violates your condition.
 
Can someone point me to an example of doing something like this?   
http://www.postgresql.org/docs/8.3/interactive/sql-createconstraint.html
http://www.postgresql.org/docs/8.3/interactive/triggers.html

I hope this helps.

 
Thanks.  I will look into this and see how it goes.

Any other advice would be greatly appreciated.

pgsql-general by date:

Previous
From: "Richard Broersma"
Date:
Subject: Re: Multi-table CHECK constraint
Next
From: David Fetter
Date:
Subject: Re: Multi-table CHECK constraint