Re: Problems with transactions and sequences

Поиск
Список
Период
Сортировка
От lanette@poynter.org (Lanette Miller)
Тема Re: Problems with transactions and sequences
Дата
Msg-id 6ec1a27c.0308281137.1862dfd9@posting.google.com
обсуждение исходный текст
Ответ на Problems with transactions and sequences  (Sune Nielsen <sunegn@image.dk>)
Список 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@persistent.co.in ("Shridhar Daithankar") wrote in message news:<3F4E650B.3698.795CE8@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

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Re: left outer join terrible slow compared to inner join
Следующее
От: jason dang
Дата:
Сообщение: Install PostgreSQL on AIX 5.1