Re: MoveToInsertRow on a table without a primary key

From: Andrew Hastie <andrew(at)ahastie(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: MoveToInsertRow on a table without a primary key
Date: 2012-03-14 14:46:07
Message-ID: 4F60AF2F.3000308@ahastie.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Not sure if this helps but:-
1. Examination of the JBC4 spec makes no mention of a PK being a
pre-requisite for an updatable ResultSet. It implies "cursors" or
similar are employed.
2. MS SQLServer 2008 and IBM DB2 for Linux/Unix/Windows also have a
similar restriction.

Anyway, a table with no PK is bad design of your database tables anyway ;-)

Andrew

On 14/03/12 14:05, Dave Cramer wrote:
> Pretty sure a primary key is a pre-requisite for an updatable result set.
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
>
> On Wed, Mar 14, 2012 at 9:03 AM,<patrick(dot)balleux(at)gmail(dot)com> wrote:
>> Hello all,
>>
>> I have a table in a database that does not have a primary key. In the process of migrating data from Oracle to Postgres, I am using ResultSets to populate the Postgres tables.
>>
>> Basically, all is working well except for tables that do not have a primary key. When I reach the "movetoinsertrow" instruction in my code, the jdbc driver raises an exception about the missing primary key.
>>
>> The workaround would be to add a temporary primary key to such table, but I want to avoid that. I did the same test with HSQLDB and it works. To me, it seems like a bug.
>>
>> I googled around for the solution, but found nothing.
>>
>> Any tips?
>>
>> --
>> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2012-03-14 14:46:59 Re: MoveToInsertRow on a table without a primary key
Previous Message Dave Cramer 2012-03-14 14:05:38 Re: MoveToInsertRow on a table without a primary key