Search Postgresql Archives

Re: ablilty to test record for foreign key before deleting the record?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux