Re: PrimaryKeyExists Error - Mailing list pgsql-jdbc

From Jon Swinth
Subject Re: PrimaryKeyExists Error
Date
Msg-id 200302181037.32382.jswinth@atomicpc.com
Whole thread Raw
In response to PrimaryKeyExists Error  (Yan Yan Che <yysydney@yahoo.com.au>)
List pgsql-jdbc
This is actually a PostgreSQL issue and not a JDBC issue.  PostgreSQL
transactioning has a flaw in that once an exception is thrown the transaction
is aborted and you must call rollback before any further SQL.  That is why
you are getting the message "current transaction is aborted, queries ignored
until end of transaction".  Borland Appserver is probably calling some SQL
that results in an exception, catching the exception, and expecting to be
able to run a different SQL statement.  This is very common, especially on
applications writting originally for Oracle.  Unfortunately, this will not
work in PostgreSQL.

I have lobbied to have this changed, since this and the write locks taken by
foreign keys are the only two things keeping PostgreSQL from being able to be
used instead of Oracle on most every project I have ever done.
Unfortunately, there is still no concept of save points (internal or
external) in PostgreSQL so continuing after an exception is not possible.

Hope this helps explain things.

On Monday 17 February 2003 03:20 pm, pgsql-jdbc-owner@postgresql.org wrote:
> Date: Mon, 17 Feb 2003 15:21:20 +1100 (EST)
> From: =?iso-8859-1?q?Yan=20Yan=20Che?= <yysydney@yahoo.com.au>
> To: pgsql-jdbc@postgresql.org
> Subject: PrimaryKeyExists Error
> Message-ID: <20030217042120.39469.qmail@web11304.mail.yahoo.com>
>
>
> Dear psql friends,
> I am trying to replace an Oracle Db by Postgresql.
> The problem is that I am using Borland Appserver
> application which talks to the oracle db. After i
> changed to a postgresql db, i re-imported the data
> schemas in JBuilder and changed the driver to jdbc.
> all are fine. but when i tried to insert into the db,
> tables with a single primary key field was inserted
> fine, but tables with composit primary keys reports a
> "primaryKeyExists" error like this:
>
>
> -- Calling
> create(Stub[repository_id=RMI:au.com.cybernetics.thinkplando.ejb.ActivityRe
>mote:000000000000 ...
>
>
> java.rmi.ServerException: java.rmi.ServerException:
> primaryKeyExists failed; nested exception is:
> java.sql.SQLException: ERROR:  current transaction is
> aborted, queries ignored until end of transaction
> block
> ; nested exception is:
>         java.sql.SQLException: ERROR:  current transaction is
> aborted, queries ignored until end of transaction
> block
>
>
>
> java.sql.SQLException: ERROR:  current transaction is
> aborted, queries ignored until end of transaction
> block



pgsql-jdbc by date:

Previous
From: Felipe Schnack
Date:
Subject: problem in preparedstatements
Next
From: Felipe Schnack
Date:
Subject: 7.3.2 psql error!