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: 87acoxuqcn.fsf@meuh.mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Roland Walter 2005-03-21 12:39:23 Re: getting a sequence value
Previous Message Dave Cramer 2005-03-21 12:28:42 Re: getting a sequence value