Re: Assertion constraint replacement? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Assertion constraint replacement?
Date
Msg-id 20020516095157.K88788-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Assertion constraint replacement?  ("Tille, Andreas" <TilleA@rki.de>)
List pgsql-general
On Thu, 16 May 2002, Tille, Andreas wrote:
>   An assertion is a special type of integrity constraint and shares
>   the same namespace as other constraints. However, an assertion is
>   not necessarily dependent on one particular table as constraints
>   are, so SQL92 provides the CREATE ASSERTION statement as an
>   alternate method for defining a constraint:
>
>   CREATE ASSERTION name CHECK ( condition )
>
>   PostgreSQL does not implement assertions at present.
>
> So Assertions might be the thing I'm looking for.  How can I implement a
> kind of logic
>
>       Accept value for column if it is contained in
>
>          select SomeId from OtherTable where SomeOtherColumn = Value ;

Triggers are probably your best bet.  Note too that changes to othertable
may also make the assertion fail, so probably an insert/update trigger
on the main table and update/delete trigger on OtherTable.



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Is there eny e-mail server that uses postgreSQL
Next
From: Andrew Sullivan
Date:
Subject: Re: [HACKERS] Re : Solaris Performance - 64 bit puzzle