Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 45AAA475E14 for ; Wed, 18 Dec 2002 05:04:45 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id A3D47475C9E for ; Wed, 18 Dec 2002 05:04:44 -0500 (EST) Received: from klaster.net (pt122.krakow.cvx.ppp.tpnet.pl [217.99.216.122]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id ECF222B2AE; Wed, 18 Dec 2002 10:48:21 +0100 (CET) Message-ID: <3E0048DA.3070408@klaster.net> Date: Wed, 18 Dec 2002 11:07:22 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Gabriel Cc: pgsql-sql@postgresql.org Subject: Re: handling error in a function References: <29166.1040154128@www58.gmx.net> In-Reply-To: <29166.1040154128@www58.gmx.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/218 X-Sequence-Number: 10806 Peter Gabriel wrote: > > When executing this and violating that constraint (i mustn't delete that > row), the function aborts with "unknown error" and i have no way to > return 0 or > something like that. > > I am programming with PHP and PEAR, each time, the result set is an object > of type error, the script jumps to an error page, to calm the angry > customers. I don't know, how PHP works with Postgresql, but in psql I get such error, when deleting wrong row: ERROR: referential integrity violation - key in table_master still referenced from table_detail Maybe it is possible some way to access this error inside PHP? Tomasz Myrta