pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Hastie <andrew@ahastie.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: MoveToInsertRow on a table without a primary key
Date: Wed, 14 Mar 2012 14:46:07 +0000
Message-ID: <4F60AF2F.3000308@ahastie.net> (raw)
In-Reply-To: <CADK3HH+BhuRYZH+-cUfqsyqDOjU63ySO3ZZo2tmr+aDMq1pxXg@mail.gmail.com>
References: <1911821.1566.1331730216537.JavaMail.geo-discussion-forums@pbjv6>
	<CADK3HH+BhuRYZH+-cUfqsyqDOjU63ySO3ZZo2tmr+aDMq1pxXg@mail.gmail.com>

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.balleux@gmail.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@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (4+ messages)  latest in thread

Message-ID: <4F60AF2F.3000308@ahastie.net>
Permalink:  ../4F60AF2F.3000308@ahastie.net/
Also on:    postgresql.org/message-id/4F60AF2F.3000308@ahastie.net

 · 

reply

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-jdbc@postgresql.org
  Cc: andrew@ahastie.net
  Subject: Re: MoveToInsertRow on a table without a primary key
  In-Reply-To: <4F60AF2F.3000308@ahastie.net>
  References: <1911821.1566.1331730216537.JavaMail.geo-discussion-forums@pbjv6> <CADK3HH+BhuRYZH+-cUfqsyqDOjU63ySO3ZZo2tmr+aDMq1pxXg@mail.gmail.com> <4F60AF2F.3000308@ahastie.net>

* 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