Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 005802E009D for ; Tue, 26 Feb 2008 11:26:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 01680-03 for ; Tue, 26 Feb 2008 11:26:42 -0400 (AST) X-Greylist: delayed 00:09:04.325892 by SQLgrey-1.7.5 Received: from lou-bada.torma.org (lou-bada.torma.org [213.41.244.89]) by postgresql.org (Postfix) with ESMTP id 372932E009A for ; Tue, 26 Feb 2008 11:26:51 -0400 (AST) Received: from lara.torma.org (helmut.lou-bada.torma.org [IPv6:2001:7a8:b459:2:218:deff:fec1:e754]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lou-bada.torma.org (Postfix) with ESMTP id 12871986E7 for ; Tue, 26 Feb 2008 16:17:41 +0100 (CET) From: Teemu Torma To: pgsql-sql@postgresql.org Subject: Re: duplicate key violates unique constraint Date: Tue, 26 Feb 2008 16:17:39 +0100 User-Agent: KMail/1.9.9 References: <014401c87887$a8fed450$3102a8c0@dream> In-Reply-To: <014401c87887$a8fed450$3102a8c0@dream> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200802261617.39936.teemu@torma.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200802/201 X-Sequence-Number: 30292 On Tuesday 26 February 2008, Shavonne Marietta Wijesinghe wrote: > During an "INSERT INTO" I get an "Error - duplicate key violates > unique constraint...." > > Is there any way, that i can test the error. Something like this?? > > IF error = "duplicate key violates unique constraint" then >     do something > else >     insert into > end if insert into ...; exception when unique_violation then do something; Teemu