From: Guillaume Cottenceau <gc@mnc.ch>
To: pg@fastcrypt.com
Cc: Nico <nicohmail-postgresql@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: getting a sequence value
Date: 21 Mar 2005 13:37:44 +0100
Message-ID: <87acoxuqcn.fsf@meuh.mnc.ch> (raw)
In-Reply-To: <423EBDFA.9040507@fastcrypt.com>
References: <d1mb4u$1j89$1@news.hub.org>
<423EBDFA.9040507@fastcrypt.com>
Dave Cramer <pg 'at' fastcrypt.com> writes:
> 2)
> allow the insert to go through
> select currval('public."tblTable1_FieldID_seq"'::text)
> and then use this to insert into table 2
>
> FYI currval does the "right" thing. It is guaranteed to be the value
> your connection retrieved from the sequence.
Which can be wrong in case of multithreaded applications without
synchronization over the two requests, if I'm correct.
--
Guillaume Cottenceau
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: gc@mnc.ch, pg@fastcrypt.com, nicohmail-postgresql@yahoo.com
Subject: Re: getting a sequence value
In-Reply-To: <87acoxuqcn.fsf@meuh.mnc.ch>
References: <d1mb4u$1j89$1@news.hub.org> <423EBDFA.9040507@fastcrypt.com> <87acoxuqcn.fsf@meuh.mnc.ch>
* 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