Skip site navigation (1) Skip section navigation (2)

Re: getting a sequence value

From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: pg(at)fastcrypt(dot)com
Cc: Nico <nicohmail-postgresql(at)yahoo(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: getting a sequence value
Date: 2005-03-21 12:37:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Dave Cramer <pg 'at'> 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

In response to


pgsql-jdbc by date

Next:From: Roland WalterDate: 2005-03-21 12:39:23
Subject: Re: getting a sequence value
Previous:From: Dave CramerDate: 2005-03-21 12:28:42
Subject: Re: getting a sequence value

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group