"juman" <juman(at)spray(dot)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