pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jodi Kanter <jkanter@virginia.edu>
To: Postgres Admin List <pgsql-admin@postgresql.org>
Subject: check constraints
Date: Wed, 04 Aug 2004 10:50:02 -0400
Message-ID: <4110F79A.2030002@virginia.edu> (raw)

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@virginia.edu <mailto:jkanter@virginia.edu100>

 

view thread (2+ messages)  latest in thread

Message-ID: <4110F79A.2030002@virginia.edu>
Permalink:  ../4110F79A.2030002@virginia.edu/
Also on:    postgresql.org/message-id/4110F79A.2030002@virginia.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jkanter@virginia.edu
  Subject: Re: check constraints
  In-Reply-To: <4110F79A.2030002@virginia.edu>
  References: <4110F79A.2030002@virginia.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox