Re: ablilty to test record for foreign key before deleting the record? - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: ablilty to test record for foreign key before deleting the record?
Date
Msg-id 20051115200401.GO44860@pervasive.com
Whole thread Raw
In response to ablilty to test record for foreign key before deleting the record?  (Nathan Clark <nathanc@abcsinc.com>)
List pgsql-general
On Tue, Nov 15, 2005 at 10:52:30AM -0600, Nathan Clark wrote:
> Is there a way to check to see if a record has a foreign key, before I
> try to delete a record ?
> To check first to see if this record is tied to a foreign key before I
> try to change it, thus avoiding
> a foreign key error.

Well, you could always try selecting on the child table...

What are you actually trying to do? If you just want to avoid exposing
the error you're probably better off just trapping for it in plpgsql.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: clustering by partial indexes
Next
From: Kris Jurka
Date:
Subject: Re: PREPARE TRANSACTION and webapps