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.