Re: [SQL] Verificate values in other table?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "juman" <juman(at)spray(dot)se>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Verificate values in other table?
Date: 1999-11-15 05:18:13
Message-ID: 15068.942643093@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"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

Browse pgsql-sql by date

  From Date Subject
Next Message Gary MacMinn 1999-11-15 05:28:19 Re: [SQL] how can tell if a column is a primary key?
Previous Message Mark Stosberg 1999-11-15 04:57:15 how can tell if a column is a primary key?