dbTalk Databases Forums  

[BUGS] BUG #1988: keygen not implemented

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1988: keygen not implemented in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike Clements
 
Posts: n/a

Default [BUGS] BUG #1988: keygen not implemented - 10-23-2005 , 12:08 PM







The following bug has been logged online:

Bug reference: 1988
Logged by: Mike Clements
Email address: mikec (AT) actional (DOT) com
PostgreSQL version: 8.0.3
Operating system: WinXP
Description: keygen not implemented
Details:

Create a table with an integer primary key using a sequence to automatically
assign values.
Connect to the database with a JDBC client.
Insert a row into the table using:
Connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
The driver throws an exception saying this method is not yet implemented.
What it should do is create the prepared statement so when you execute it,
the returned ResultSet has the generated primary key.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

Reply With Quote
  #2  
Old   
Oliver Jowett
 
Posts: n/a

Default Re: [BUGS] BUG #1988: keygen not implemented - 10-23-2005 , 04:30 PM






Mike Clements wrote:

Quote:
Insert a row into the table using:
Connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
The driver throws an exception saying this method is not yet implemented.
This is an optional part of the JDBC spec, and the driver doesn't claim
to support it in the metadata it provides
(DatabaseMetaData.supportsGetGeneratedKeys() returns false).

Quote:
What it should do is create the prepared statement so when you execute it,
the returned ResultSet has the generated primary key.
Unfortunately this requires functionality in the backend that does not
yet exist (support for "INSERT .. RETURNING ...", or similar).

-O

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #3  
Old   
Mike Clements
 
Posts: n/a

Default Re: [BUGS] BUG #1988: keygen not implemented - 10-24-2005 , 04:06 PM



Thanks for the info. I found a workaround by selecting the current value of=
the sequence after doing the insert. This however is not desirable since i=
t requires another round trip call to the DB, and it requires PostGRE SQL s=
pecific code in my "generic" JDBC client. If the driver supported getGenera=
tedKeys(), client applications could perform better and be truly generic.

Also looking at the release notes I see I'm not the only person asking for =
this feature... Good luck.

Quote:
-----Original Message-----
From: Oliver Jowett [mailtoliver (AT) opencloud (DOT) com]=20
Sent: Sunday, October 23, 2005 2:24 PM
To: Mike Clements
Cc: pgsql-bugs (AT) postgresql (DOT) org
Subject: Re: [BUGS] BUG #1988: keygen not implemented
=20
Mike Clements wrote:
=20
Insert a row into the table using:
Connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
The driver throws an exception saying this method is not=20
yet implemented.
=20
This is an optional part of the JDBC spec, and the driver=20
doesn't claim=20
to support it in the metadata it provides=20
(DatabaseMetaData.supportsGetGeneratedKeys() returns false).
=20
What it should do is create the prepared statement so when=20
you execute it,
the returned ResultSet has the generated primary key.
=20
Unfortunately this requires functionality in the backend that=20
does not=20
yet exist (support for "INSERT .. RETURNING ...", or similar).
=20
-O
=20
=20
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.