pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: spastor@motionsponsor.com
To: pgsql-jdbc@postgresql.org
Subject: Retrieving last InsertedID : INSERT... RETURNING safe ?
Date: Wed, 20 Feb 2008 10:44:37 +0100
Message-ID: <38245.1203500677@motionsponsor.com> (raw)

 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 topic but 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, using an 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.




view thread (19+ messages)  latest in thread

Message-ID: <38245.1203500677@motionsponsor.com>
Permalink:  ../38245.1203500677@motionsponsor.com/
Also on:    postgresql.org/message-id/38245.1203500677@motionsponsor.com

 · 

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: spastor@motionsponsor.com
  Subject: Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
  In-Reply-To: <38245.1203500677@motionsponsor.com>
  References: <38245.1203500677@motionsponsor.com>

* 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