pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kenneth Gonsalves <lawgon@thenilgiris.com>
To: pgsql-sql@postgresql.org
Subject: finding if a foreign key is in use
Date: Tue, 29 Jun 2004 06:18:41 +0530
Message-ID: <0406290618410W.02481@thenilgiris.com> (raw)

in my app i have a table where the id serves as a foreign key for one or more 
other tables. if i want to delete a row in the table, i currently search the 
other tables where this table is referenced to see if the row is in use - and 
then, if not in use, permit deletion. Now if i want the delete button in my 
app to be disabled whenever a row that is in use is selected, searching the 
database every time would dramatically slow down the app. is there some sql 
query that will immediatly give an answer as to whether the row is in use or 
not?
-- 
regards
kg

http://www.onlineindianhotels.net - hotel bookings reservations in over 4600 
hotels in India
http://www.ootygolfclub.org



view thread (6+ messages)  latest in thread

Message-ID: <0406290618410W.02481@thenilgiris.com>
Permalink:  ../0406290618410W.02481@thenilgiris.com/
Also on:    postgresql.org/message-id/0406290618410W.02481@thenilgiris.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lawgon@thenilgiris.com
  Subject: Re: finding if a foreign key is in use
  In-Reply-To: <0406290618410W.02481@thenilgiris.com>

* 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