pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Csaba Nagy <nagy@ecircle-ag.com>
To: Peter.Zoche@materna.de
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: INSERT and get ID
Date: Wed, 27 Jul 2005 15:40:32 +0200
Message-ID: <1122471632.2837.79.camel@coppola.muc.ecircle.de> (raw)
In-Reply-To: <3617A3C21370D045B75C0A40A7A6530D0B37E19A@ntexc2buc.do-office.buc.materna.com>
References: <3617A3C21370D045B75C0A40A7A6530D0B37E19A@ntexc2buc.do-office.buc.materna.com>

It will be perfectly safe, as curval will return you the last value
created in the current session. So you can be sure it's your value
unless you use the same connection concurrently in different threads,
but in that case you would have bigger problems :-)

Cheers,
Csaba.

On Wed, 2005-07-27 at 15:29, Peter.Zoche@materna.de wrote:
> > You have to do a a "SELECT curval('myseq')" after the insert.
> 
> I had this in mind, too, but I am not sure if it is really safe if
> there are several inserts at the same time...
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend




view thread (9+ messages)  latest in thread

Message-ID: <1122471632.2837.79.camel@coppola.muc.ecircle.de>
Permalink:  ../1122471632.2837.79.camel@coppola.muc.ecircle.de/
Also on:    postgresql.org/message-id/1122471632.2837.79.camel@coppola.muc.ecircle.de

 · 

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: nagy@ecircle-ag.com, Peter.Zoche@materna.de
  Subject: Re: INSERT and get ID
  In-Reply-To: <1122471632.2837.79.camel@coppola.muc.ecircle.de>
  References: <3617A3C21370D045B75C0A40A7A6530D0B37E19A@ntexc2buc.do-office.buc.materna.com> <1122471632.2837.79.camel@coppola.muc.ecircle.de>

* 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