Re: Problems with transactions and sequences

From: lanette(at)poynter(dot)org (Lanette Miller)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems with transactions and sequences
Date: 2003-08-28 19:37:09
Message-ID: 6ec1a27c.0308281137.1862dfd9@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> You need to extract the current val first and explicitly use it in insert
> statement. That way you won't have to produce work-arounds later..
This statement is wrong. If you were going to use this method (
getting the value first - then setting it), I believe you would need
to call nextval not currval.

Lanette

shridhar_daithankar(at)persistent(dot)co(dot)in ("Shridhar Daithankar") wrote in message news:<3F4E650B(dot)3698(dot)795CE8(at)localhost>...
> On 28 Aug 2003 at 14:35, Sune Nielsen wrote:
> > INSERT INTO Users (name) VALUES ('JohnDoe');
> > SELECT CURRVAL('users_bid_seq');
> >
> > This works perfectly(!), but my project involves multiple simultanous
> > users so I have to use transactions like this:
> >
> > BEGIN;
> > INSERT INTO Users (name) VALUES ('JohnDoe');
> > SELECT CURRVAL('users_bid_seq');
> > COMMIT;
>
>
> Bye
> Shridhar

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-28 19:52:47 Re: left outer join terrible slow compared to inner join
Previous Message Tom Lane 2003-08-28 19:26:40 Re: left outer join terrible slow compared to inner join