Re: Problems with transactions and sequences

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: shridhar_daithankar(at)persistent(dot)co(dot)in
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems with transactions and sequences
Date: 2003-08-28 15:22:47
Message-ID: 3F4E1E47.1080804@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

if one gives a value for the seirial field, the trigger for the serial
on that table doesn't generate another value?

Shridhar Daithankar wrote:

>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;
>>
>>
>
>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..
>
>Bye
> Shridhar
>
>--
>Vulcans do not approve of violence. -- Spock, "Journey to Babel", stardate
>3842.4
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sune Nielsen 2003-08-28 15:23:57 Re: Problems with transactions and sequences
Previous Message Ivar 2003-08-28 15:22:02 Re: Functions have 32 args limt ???