Re: assertions and constraint triggers - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: assertions and constraint triggers
Date
Msg-id 1281513737.2142.1477.camel@ebony
Whole thread Raw
In response to assertions and constraint triggers  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On Wed, 2010-08-11 at 08:31 +0300, Peter Eisentraut wrote:

> Thinking about SQL assertions (check constraints that are independent of
> one particular table), do you think it would be reasonable to implement
> those on top of constraint triggers?  On creation you'd hook up a
> trigger to each of the affected tables.  And the trigger function runs
> the respective check expression.  Conceptually, this doesn't seem to be
> very far away from foreign key constraints after all.

I would be interested in virtual assertions, i.e. allowing the user to
say it is true without it being enforced.

The cost of executing enforced assertions is likely to be prohibitive.

Most common use case if you do have them is the equivalent of
minoccurs/maxoccurs constraints in an XML Schema definition (XSD).

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Vik Reykja
Date:
Subject: Re: Regression tests versus the buildfarm environment
Next
From: Nicolas Barbier
Date:
Subject: Re: assertions and constraint triggers