From: Matti Aarnio <matti.aarnio@methics.fi>
To: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
Date: Mon, 11 Feb 2013 18:13:08 +0200
Message-ID: <51191894.4030703@methics.fi> (raw)
In-Reply-To: <51190F86.9090102@methics.fi>
References: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org>
<5118DFDB.4080103@vmware.com>
<51190F86.9090102@methics.fi>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 02/11/2013 05:34 PM, Matti Aarnio wrote:
> On 02/11/2013 02:11 PM, Heikki Linnakangas wrote:
>> Works for me:
>>
>> postgres=# do $$
>> begin
>> insert into example values ('2001-01-01', 'foo', 'bar');
>> insert into example values ('2001-01-01', 'foo', 'bar');
>> exception
>> when others then raise notice 'caught %', sqlstate;
>> end;
>> $$;
>> NOTICE: caught 23505
>> DO
>>
>> How exactly are you seeing the wrong status code? What client are you
>> using?
> I am calling PostgreSQL JDBC driver through Tomcat 7 Pool manager..
> Which could of course scramble the status code report (unlikely, but
> possible..)
>
> The driver binary I was using is: postgresql-9.0-801.jdbc3.jar
>
> Switching to jdbc4 driver binary of otherwise same version makes no
> difference.
> Neither switching to latest version makes any difference:
> postgresql-9.2-1002.jdbc4.jar
Catching the SQLException, and printing the backtrace shows:
2013-02-11 17:47:08,559 [http-bio-8080-exec-7] ERROR fi.methics.ExampleDatabase - Insert into example at jdbc:kiuru:pool:example resulted unexpected SQL Exception code: 0 ERROR: duplicate key value violates unique constraint "replay_attack_detector_pkey"
Detail: Key (a, b, c)=(a, b, 2013-02-11 17:47:08.163) already exists.
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "example_pkey"
Detail: Key (a, b, c)=(a, b, 2013-02-11 17:47:08.163) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:235)
at $Proxy7.executeUpdate(Unknown Source)
at fi.methics.ExampleDatabase.exampleInsert(ExampleDatabase.java:123)
....
Attachments:
smime.p7s (application/pkcs7-signature, 1.8K) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: matti.aarnio@methics.fi, hlinnakangas@vmware.com
Subject: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
In-Reply-To: <51191894.4030703@methics.fi>
References: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org> <5118DFDB.4080103@vmware.com> <51190F86.9090102@methics.fi> <51191894.4030703@methics.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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