Retrieving last InsertedID : INSERT... RETURNING safe ? - Mailing list pgsql-jdbc

From
Subject Retrieving last InsertedID : INSERT... RETURNING safe ?
Date
Msg-id 38245.1203500677@motionsponsor.com
Whole thread Raw
Responses Re: Retrieving last InsertedID : INSERT... RETURNING safe ?  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
List pgsql-jdbc
Hello everyone,

This is my very first POST in this list. I am just starting to work with postgresql and the jdbc driver and so far so
good! 
Only one exception is regarding the best method to retrieve the last inserted id (serial). There are many posts on this
topicbut i couldn t find a definitive response.  
I am using postgresql version 8.2.6 and jdbc  8.2_p505, i ve been experiencing INSERT statement with RETURNING myID,
usingan executeQuery it works great, i retrieve the proper value everytime at least  from the few tests i have been
doin locally. 
Is it THAT easy or could this method break somehow in a live environement ? If yes could you advise on another method ?


Thanks in advance


Sebastien.


pgsql-jdbc by date:

Previous
From: Gustav Trede
Date:
Subject: Re: extra rowcopy in ResultSet allways needed ?.
Next
From: "Heikki Linnakangas"
Date:
Subject: Re: Retrieving last InsertedID : INSERT... RETURNING safe ?