X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2D9C1D1B367 for ; Sun, 16 May 2004 08:56:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79531-07 for ; Sun, 16 May 2004 08:56:12 -0300 (ADT) Received: from wise.tau.ac.il (wise1.tau.ac.il [132.66.142.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2A45DD1B354 for ; Sun, 16 May 2004 08:56:11 -0300 (ADT) Received: from bellatrix.tau.ac.il (bellatrix.tau.ac.il [132.66.135.50]) by wise.tau.ac.il (Postfix) with ESMTP id 4D54A3003; Sun, 16 May 2004 14:56:11 +0300 (IDT) Content-Type: text/plain; charset="iso-8859-8-i" From: Elinor Medezinski Subject: Error code handling in perl Date: Sun, 16 May 2004 14:56:10 +0300 User-Agent: KMail/1.4.1 To: pgsql-interfaces@postgresql.org Cc: elinor@wise.tau.ac.il MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200405161456.10022.elinor@bellatrix.tau.ac.il> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/22 X-Sequence-Number: 4914 Hi all, I am populating a table in postgres, writing the script in perl (using DBI)= ,=20 and I am trying to do some error handling. For example - this should retur= n=20 an error due to unique violation: >$sth=3D$conn->prepare("INSERT INTO tablename (names) values ($name)") or d= ie=20 "error1 is: ".$sth->err; >$sth->execute() or do{ > print "state is: ".$sth->state."\n"; > print "err is: ".$sth->err."\n"; >}; I always get the same SQLSTATE and ERROR, no matter what the error is: >state is: S1000 >err is: 7 although in the documentation it says that the error code is "23505" (unique violation). Is there no way to identify the error by code from postgres via perl? Thanks, Elinor -------------------------------------------------------