pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #8127: After failed insert a select to figure out what failed is rejected
2+ messages / 2 participants
[nested] [flat]
* BUG #8127: After failed insert a select to figure out what failed is rejected
@ 2013-04-29 11:23 matti.aarnio@methics.fi
0 siblings, 1 reply; 2+ messages in thread
From: matti.aarnio@methics.fi @ 2013-04-29 11:23 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 8127
Logged by: Matti Aarnio
Email address: matti.aarnio@methics.fi
PostgreSQL version: 9.2.4
Operating system: Fedora 18
Description:
With table:
CREATE TABLE demo (
pkey INTEGER PRIMARY KEY,
key2 VARCHAR UNIQUE,
key3 VARCHAR UNIQUE
);
An insert that fails secondary constraint key does return SQL State 23505,
and maybe an explanation message telling that "Key (key3)=".. " is
duplicate."
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.
With PostgreSQL we get following error on those error analysis SELECTs:
ERROR: current transaction is aborted,
commands ignored until end of transaction block
Could PostgreSQL be similarly permissive (with respect of Oracle) allowing
SELECTs within same transaction context that was already rejected?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #8127: After failed insert a select to figure out what failed is rejected
@ 2013-05-07 12:36 Amit Kapila <amit.kapila@huawei.com>
parent: matti.aarnio@methics.fi
0 siblings, 0 replies; 2+ messages in thread
From: Amit Kapila @ 2013-05-07 12:36 UTC (permalink / raw)
To: matti.aarnio@methics.fi; pgsql-bugs
On Monday, April 29, 2013 4:54 PM matti aarnio wrote:
> The following bug has been logged on the website:
>
> Bug reference: 8127
> Logged by: Matti Aarnio
> Email address: matti.aarnio@methics.fi
> PostgreSQL version: 9.2.4
> Operating system: Fedora 18
> Description:
>
> With table:
>
> CREATE TABLE demo (
> pkey INTEGER PRIMARY KEY,
> key2 VARCHAR UNIQUE,
> key3 VARCHAR UNIQUE
> );
>
> An insert that fails secondary constraint key does return SQL State
> 23505,
> and maybe an explanation message telling that "Key (key3)=".. " is
> duplicate."
>
> 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.
>
> With PostgreSQL we get following error on those error analysis SELECTs:
> ERROR: current transaction is aborted,
> commands ignored until end of transaction block
>
> 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.
However you can try by using Savepoint before failing statement and then after failure do Rollback To Savepoint_name and then call your select statement.
This will make you select statement run in top transaction context.
With Regards,
Amit Kapila.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-05-07 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29 11:23 BUG #8127: After failed insert a select to figure out what failed is rejected matti.aarnio@methics.fi
2013-05-07 12:36 ` Re: BUG #8127: After failed insert a select to figure out what failed is rejected Amit Kapila <amit.kapila@huawei.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox