Re: [SQL] Verificate values in other table? - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] Verificate values in other table?
Date
Msg-id 15068.942643093@sss.pgh.pa.us
Whole thread Raw
In response to Verificate values in other table?  ("juman" <juman@spray.se>)
List pgsql-sql
"juman" <juman@spray.se> writes:
> What I want to do is that if someone adds or updates a row in in table2 I
> want to verify that the <id> given exists in table1.

You can do this with a trigger --- I'd suggest writing it in plpgsql.
No canned example at hand, sorry, but there are examples of triggers
applying error checks in the plpgsql section of the manual.
        regards, tom lane


pgsql-sql by date:

Previous
From: Mark Stosberg
Date:
Subject: how can tell if a column is a primary key?
Next
From: "Gary MacMinn"
Date:
Subject: Re: [SQL] how can tell if a column is a primary key?