Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id BBE07177DF3 for ; Fri, 30 Dec 2011 00:44:15 -0400 (AST) Received: from nm23-vm0.bullet.mail.sp2.yahoo.com ([98.139.91.224]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1RgUKC-0002j5-QO for pgsql-sql@postgresql.org; Fri, 30 Dec 2011 04:44:15 +0000 Received: from [98.139.91.70] by nm23.bullet.mail.sp2.yahoo.com with NNFMP; 30 Dec 2011 04:43:59 -0000 Received: from [72.30.22.36] by tm10.bullet.mail.sp2.yahoo.com with NNFMP; 30 Dec 2011 04:43:59 -0000 Received: from [127.0.0.1] by omp1066.mail.sp2.yahoo.com with NNFMP; 30 Dec 2011 04:43:59 -0000 X-Yahoo-Newman-Id: 142366.694.bm@omp1066.mail.sp2.yahoo.com Received: (qmail 16032 invoked from network); 30 Dec 2011 04:43:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:Mime-Version:In-Reply-To:X-Apple-Yahoo-Original-Message-Folder:Content-Type:Content-Transfer-Encoding:Message-Id:Cc:X-Mailer:From:X-Apple-Yahoo-Replied-Msgid:Subject:Date:To; b=lUbc0TpePQ0IvtIkSB2Avi5b1nYcvF8f9AKyZ0ygVj5a0jvyzAHMz6Vaphsbs+1oFzl5no9LHq5Oob3mLCo/pw3hrsMSvBJrnColzycWc71SdNLNwGuvT1N6rIztDeDLIMyIMZZwfxSTu7ryLk1LTPDSfIq0PJcIs3UwYd/JZos= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1325220238; bh=++gpeMxI4g7c0Y0c/rQraEnEeC54/7rFDMbSqrV54uE=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:Mime-Version:In-Reply-To:X-Apple-Yahoo-Original-Message-Folder:Content-Type:Content-Transfer-Encoding:Message-Id:Cc:X-Mailer:From:X-Apple-Yahoo-Replied-Msgid:Subject:Date:To; b=GdCYM92Ey//4XWrzIpz0f2BLgh+i07nSPYbFt/QyRFJxWTkrM2tnT9MbAVLXJUZ3/1x6wKjlVj0WJpkZeDB+kwcqm/JEU+sTCeQAOvPWRaBl805qy/mbYCx2ELRz41+2HQ/GBU6kK4jmoHibxdEUhr3VTAed+/nlxT98ayk9PhU= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 8cStEooVM1kMWHIzIADq3.LiZN5gIX3NbTSSH0gGyZeH33y A98ow.GBOHkuUjT_WGd6xW7uEUi12zc_Bv.7oClou3zULmCcENDs3YR6pQDA sRk22YjLLBj.fWBuxY2Gmt07bcZ0CS69N0PCWcyoxys3f_zxE_qZtdF8T80Q KDyseSE7qjxyR_QmKdbsNlom4cwGb606zLo3MamBUP35K23isfktDqPP2dx_ lf0iAC0U3ekV4nporM.aT4QtzSZGMZ0EM7Cri9HtEwgnoimI_J1HU.k0pUTY O8IszMolt253mosouY7lqAkomA0zxC.WN6Iu_Ta8Q_6adxHoB8ueB9poE2e. LLMBJAVq_pO47sZYPfIGHrlmqSi7Vd.RLj79M7QSMr8n9szSG5Z9hEnjCwIB u3nQU2G.jsHtO X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from [192.12.17.102] (polobo@24.93.23.188 with xymcookie) by smtp116-mob.biz.mail.gq1.yahoo.com with SMTP; 29 Dec 2011 20:43:58 -0800 PST References: <4EFD3D32.9060902@greenpeace.org> Mime-Version: 1.0 (iPad Mail 8J2) In-Reply-To: <4EFD3D32.9060902@greenpeace.org> X-Apple-Yahoo-Original-Message-Folder: Inbox Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <13131805-BCBB-42DF-953B-27EE36AAF213@yahoo.com> Cc: "pgsql-sql@postgresql.org" X-Mailer: iPad Mail (8J2) From: David Johnston X-Apple-Yahoo-Replied-Msgid: 1_359471_AOOkiGIAAUDPTv09YAn8HUK5IpE Subject: Re: Current transaction is aborted, commands ignored until end of transaction block Date: Thu, 29 Dec 2011 23:44:00 -0500 To: Jan Bakuwel X-Pg-Spam-Score: -3.3 (---) X-Archive-Number: 201112/90 X-Sequence-Number: 36151 On Dec 29, 2011, at 23:25, Jan Bakuwel wrote: > Hi, >=20 > Maybe there is a simple solution for PostgreSQL behaviour that is > annoying me... >=20 > I've got users making updates to a master table and a number of detail > tables. All changes to the master record and related detail records are > encapsulated in a transaction so everything can be rolled back if > necessary and also to lock those master and related records for the user > making the changes. >=20 > When they do something that violates a constraint (for example adding a > duplicate detail record where that is not allowed), PostgreSQL aborts > the transaction. What I would much rather have is that PostgreSQL > returns an error but does not cancel the transaction as it's perfectly > OK (from a user's point of view) to try to do something that violates a > constraint. >=20 > What annoys me is that I don't think that a constraint violation made by > a user should result in an aborted transaction. There is probably a very > good reason to do that however the logic escapes me... >=20 > Of course I can start testing existing values in the database before > accepting them in the user interface but that's putting the horse behind > the cart. I much rather use the constraints at the database level to > tell me a particular update can't be done and do that without loosing > everything else I happened to have done in that transaction until that > point. >=20 > Any suggestions? >=20 > Jan >=20 >=20 Start a "savepoint" before each sub-update and rollback to the savepoint if t= he update fails, and then try again with different data. If it succeeds you= then release the savepoint anad move on. David J.=