Skip site navigation (1) Skip section navigation (2)

finding if a foreign key is in use

From: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: finding if a foreign key is in use
Date: 2004-06-29 00:48:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
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 
kg - hotel bookings reservations in over 4600 
hotels in India


pgsql-sql by date

Next:From: Phil EndecottDate: 2004-06-29 13:49:31
Subject: Re: finding if a foreign key is in use
Previous:From: Stephan SzaboDate: 2004-06-28 23:24:24
Subject: Re: FW: "=" operator vs. "IS"

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group