Re: BUG #1308: Bug with JDBC driver on duplicate

From: Kris Jurka <books(at)ejurka(dot)com>
To: Simon Lesage-Tremblay <simonlt(at)thevco(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1308: Bug with JDBC driver on duplicate
Date: 2004-11-09 21:39:26
Message-ID: Pine.BSO.4.56.0411091635060.944@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 9 Nov 2004, PostgreSQL Bugs List wrote:

>
> Bug reference: 1308
> Logged by: Simon Lesage-Tremblay
> Email address: simonlt(at)thevco(dot)com
>
> Description: Bug with JDBC driver on duplicate
>
> Details:
>
> My problem is when I insert a record that have a problem of duplicate key,
> my request fall in a frozing mode.
>
> I test my commands with pgadmin and I got a message of duplicate key. So I
> supposed that is a problem with the driver.
>

This is not a problem with the JDBC driver, but likely a problem of two
concurrent sessions issuing the same insert inside two separate
transactions. Consider:

Session 1:

CREATE TABLE t(a int primary key);

BEGIN;

INSERT INTO t(a) VALUES(1);

Session 2:

BEGIN;

INSERT INTO t(a) VALUES(1);

Since Session 1 has not committed or rolled back Session 2 cannot tell if
the insert is a duplicate key error or is valid, so it must wait for
Session 1 to do something first. This is likely the "frozing mode" you
are seeing as the insert waits.

Kris Jurka

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-11-09 22:15:10 BUG #1309: PL/PGSQL function: ORDER BY does not accept variables
Previous Message PostgreSQL Bugs List 2004-11-09 21:01:41 BUG #1308: Bug with JDBC driver on duplicate