Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E34E02E003E for ; Tue, 26 Feb 2008 12:44:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 64445-06 for ; Tue, 26 Feb 2008 12:43:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtpout24.attiva.biz (smtpout24.attiva.biz [85.37.16.25]) by postgresql.org (Postfix) with ESMTP id BDF9D2E0047 for ; Tue, 26 Feb 2008 12:43:45 -0400 (AST) Received: from FBCMFE02B06.fbc.local ([192.168.30.94]) by smtpout24.attiva.biz with Microsoft SMTPSVC(6.0.3790.1830); Tue, 26 Feb 2008 17:43:44 +0100 Received: from dream ([88.34.161.130]) by FBCMFE02B06.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 26 Feb 2008 17:35:14 +0100 Message-ID: <017901c87895$b1782380$3102a8c0@dream> Reply-To: "Shavonne Marietta Wijesinghe" From: "Shavonne Marietta Wijesinghe" To: "Teemu Torma" , References: <014401c87887$a8fed450$3102a8c0@dream> <016401c87891$58237950$3102a8c0@dream> <20080226162246.GA9865@crankycanuck.ca> <200802261728.36773.teemu@torma.org> Subject: Re: duplicate key violates unique constraint Date: Tue, 26 Feb 2008 17:36:09 +0100 Organization: Studio FORM MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-OriginalArrivalTime: 26 Feb 2008 16:35:14.0579 (UTC) FILETIME=[90426630:01C87895] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/208 X-Sequence-Number: 30299 I wrote the query in the SQL windows provided by the pgadmin. According to the examples in "Chapter 35. PL/pgSQL - SQL Procedural Language" i don't see what i did different. BEGIN SAVEPOINT s1; ... code here ... EXCEPTION WHEN ... THEN ROLLBACK TO s1; ... code here ... WHEN ... THEN ROLLBACK TO s1; ... code here ... END; Maybe missing tabs before the statement?? Shavonne ----- Original Message ----- From: "Teemu Torma" To: Sent: Tuesday, February 26, 2008 5:28 PM Subject: Re: [SQL] duplicate key violates unique constraint > On Tuesday 26 February 2008, Andrew Sullivan wrote: >> Well, except that there's no "EXCEPTION" statement in SQL? Â I think >> your correspondent was intending for this to be programmatic. > > I was thinking pl/pgsql. > > Teemu > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend