Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 558F52E0161 for ; Tue, 26 Feb 2008 13:10:57 -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 75808-01-10 for ; Tue, 26 Feb 2008 13:10:50 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.245]) by postgresql.org (Postfix) with ESMTP id 678C72E0120 for ; Tue, 26 Feb 2008 13:09:29 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c36so473005ana.33 for ; Tue, 26 Feb 2008 09:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=MdJqaPH3PRGJnnHM5d8W2SuT5Tt1bQlldBIGFbaWjE8=; b=DMiKfQKCjbWUpOjmt63iPv59//qFpSKJfAd4kCNQLz2DvifpFKFSKbBpOuDpxa79mjF+/MmgRZuTH78dp0MF95Jh9cUEgXDQFh8aHCtQvgEXIvUyapCol5Saa6mZQnckEFVZ8XMEq/hRPm56rktZzis85DBO8VF8xE6KEV3fWuU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VRdLdNCIdz4eKNqARv7PoxiAE7XIcVvcxL1gcr1+TWD3kl8rCH8OMbjTMXpp30Eh9HuxQYWefQHGkiyldmNMzrCtgQzE/4h9T/rmdiT/iPndwLwXa6JNXOrVhzVMUDBXiRlCQ4yzCIWUAUd9Cxo3KkD5ECJ8Nph8RpmZdru6S6o= Received: by 10.100.109.13 with SMTP id h13mr10100659anc.39.1204045768795; Tue, 26 Feb 2008 09:09:28 -0800 (PST) Received: by 10.100.122.9 with HTTP; Tue, 26 Feb 2008 09:09:28 -0800 (PST) Message-ID: Date: Tue, 26 Feb 2008 12:09:28 -0500 From: "=?UTF-8?Q?Rodrigo_E._De_Le=C3=B3n_Plicet?=" To: "Shavonne Marietta Wijesinghe" Subject: Re: duplicate key violates unique constraint Cc: "Teemu Torma" , pgsql-sql@postgresql.org In-Reply-To: <017901c87895$b1782380$3102a8c0@dream> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <014401c87887$a8fed450$3102a8c0@dream> <016401c87891$58237950$3102a8c0@dream> <20080226162246.GA9865@crankycanuck.ca> <200802261728.36773.teemu@torma.org> <017901c87895$b1782380$3102a8c0@dream> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/212 X-Sequence-Number: 30303 On Tue, Feb 26, 2008 at 11:36 AM, Shavonne Marietta Wijesinghe wrote: > BEGIN > SAVEPOINT s1; > ... code here ... > EXCEPTION > WHEN ... THEN > ROLLBACK TO s1; > ... code here ... > WHEN ... THEN > ROLLBACK TO s1; > ... code here ... > END; PostgreSQL doesn't have anonymous blocks. You need to write a function.