X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 12FB111F7990 for ; Wed, 19 Apr 2006 10:34:14 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 required=5 tests=[none] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id ttR2SohcWb7o for ; Wed, 19 Apr 2006 10:34:02 -0300 (ADT) X-Greylist: delayed 01:28:46.527561 by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 3332C11F665D for ; Wed, 19 Apr 2006 10:34:05 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FWCoX-00019V-EU for pgsql-sql@postgresql.org; Wed, 19 Apr 2006 15:33:49 +0200 Received: from cc503261-a.eelde1.dr.home.nl ([212.204.130.36]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Apr 2006 15:33:49 +0200 Received: from halfgaar by cc503261-a.eelde1.dr.home.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Apr 2006 15:33:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Wiebe Cazemier Subject: Re: Primary key reference count Date: Wed, 19 Apr 2006 15:33:18 +0200 Lines: 14 Message-ID: References: <20060419130932.GG3828@webserv.wug-glas.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cc503261-a.eelde1.dr.home.nl User-Agent: KNode/0.9.1 X-Archive-Number: 200604/126 X-Sequence-Number: 24935 On Wednesday 19 April 2006 15:09, A. Kretschmer wrote: > Yes, > http://www.postgresql.org/docs/8.1/interactive/catalog-pg-constraint.html Either I'm blind, or this is not what I'm looking for. I need to know the amount of references _to_ a primary key. If you have a customer with two orders and one invoice, the reference count for the primary key of the custormer would be 3. I need to know if I can delete rows which are not referenced anywhere, without catching the relational constraint exception. The reason I can't catch the exception, is that I want the exception to arrive at my application and/or tests.