Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZh8s-0006LU-Jh for pgsql-bugs@arkaria.postgresql.org; Tue, 07 May 2013 12:37:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UZh8r-0004hZ-Fb for pgsql-bugs@arkaria.postgresql.org; Tue, 07 May 2013 12:37:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZh8q-0004hP-LV for pgsql-bugs@postgresql.org; Tue, 07 May 2013 12:37:12 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZh8h-0001qy-Nf for pgsql-bugs@postgresql.org; Tue, 07 May 2013 12:37:12 +0000 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BBT29828; Tue, 07 May 2013 20:36:54 +0800 (CST) Received: from SZXEML401-HUB.china.huawei.com (10.82.67.31) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Tue, 7 May 2013 20:36:51 +0800 Received: from blrprnc09ns (10.18.96.98) by szxeml401-hub.china.huawei.com (10.82.67.31) with Microsoft SMTP Server id 14.1.323.7; Tue, 7 May 2013 20:36:50 +0800 From: Amit Kapila To: , References: In-Reply-To: Subject: Re: BUG #8127: After failed insert a select to figure out what failed is rejected Date: Tue, 7 May 2013 18:06:48 +0530 Message-ID: <000a01ce4b1f$8b8b88d0$a2a29a70$@kapila@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac5E7zBjpLkFLfDbRtWsVJZw0bsPRgGL6EUQ Content-Language: en-us X-Originating-IP: [10.18.96.98] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Monday, April 29, 2013 4:54 PM matti aarnio wrote: > The following bug has been logged on the website: >=20 > Bug reference: 8127 > Logged by: Matti Aarnio > Email address: matti.aarnio@methics.fi > PostgreSQL version: 9.2.4 > Operating system: Fedora 18 > Description: >=20 > With table: >=20 > CREATE TABLE demo ( > pkey INTEGER PRIMARY KEY, > key2 VARCHAR UNIQUE, > key3 VARCHAR UNIQUE > ); >=20 > An insert that fails secondary constraint key does return SQL State > 23505, > and maybe an explanation message telling that "Key (key3)=3D".. " is > duplicate." >=20 > With Oracle we ask a SELECT after such an error on that table for all > possibly existing secondary keys values, and get them to report > detailed > conflict information. >=20 > With PostgreSQL we get following error on those error analysis SELECTs: > ERROR: current transaction is aborted, > commands ignored until end of transaction block >=20 > Could PostgreSQL be similarly permissive (with respect of Oracle) > allowing > SELECTs within same transaction context that was already rejected? As per current implementation PostgreSQL behavior is different from Oracle = in the scenario mentioned by you.=20 However you can try by using Savepoint before failing statement and then af= ter failure do Rollback To Savepoint_name and then call your select stateme= nt. This will make you select statement run in top transaction context. With Regards, Amit Kapila. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs