Re: getting a sequence value - Mailing list pgsql-jdbc

From Guillaume Cottenceau
Subject Re: getting a sequence value
Date
Msg-id 87acoxuqcn.fsf@meuh.mnc.ch
Whole thread Raw
In response to Re: getting a sequence value  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: getting a sequence value
List 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

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: getting a sequence value
Next
From: Roland Walter
Date:
Subject: Re: getting a sequence value