check constraints

From: Jodi Kanter <jkanter(at)virginia(dot)edu>
To: Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: check constraints
Date: 2004-08-04 14:50:02
Message-ID: 4110F79A.2030002@virginia.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have little experience with postgres' check constraint features and
was hoping to get some guidance. We have a table which houses links to
various user files. The PK of this table is fi_pk. There are several
tables in which a foreign key (fi_fk) to this field exist. We are
implementing a feature which will allow users to remove old files from
their repositories. It would be nice to have a check that goes out to
all tables that have this fi_fk field and checks to see if the fi_pk for
their particular record exists and would then not allow the deletion if
a link occurs somewhere.
I realize that I can do this with specific SQL in the code but was
wondering if it's possible to implement a sort of general database wide
check of this nature. That way if future tables are added with this FK
field then the code would not have to be altered.
Thanks.
Jodi Kanter
--

_______________________________
Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter(at)virginia(dot)edu <mailto:jkanter(at)virginia(dot)edu100>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Oliver Elphick 2004-08-04 15:37:20 Re: check constraints
Previous Message Gregory S. Williamson 2004-08-04 08:43:47 Re: Application crash - pls help !!!