Assertion constraint replacement?

From: "Tille, Andreas" <TilleA(at)rki(dot)de>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Assertion constraint replacement?
Date: 2002-05-16 15:02:33
Message-ID: Pine.LNX.4.44.0205161400330.8932-100000@wr-linux02.rki.ivbb.bund.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

sql-createtable.html says about CONSTRAINTS:

CHECK (expression)

CHECK clauses specify integrity constraints or tests which new or
updated rows must satisfy for an insert or update operation to
succeed. Each constraint must be an expression producing a Boolean
result. A condition appearing within a column definition should
reference that column's value only, while a condition appearing as
a table constraint may reference multiple columns.

Currently, CHECK expressions cannot contain subselects nor refer
to variables other than columns of the current row.

But I want to add a constraint which has to check the value to insert
into a certain table column which has to be obtained from another
table under certain WHERE conditions (not just an index).

Going on reading sql-createtable.html:

Assertions

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 ;

Kind regards

Andreas.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug Fields 2002-05-16 16:19:21 Re: Is there eny e-mail server that uses postgreSQL
Previous Message Jeff Eckermann 2002-05-16 14:26:06 Re: Lexicographic index ?