Sequences - Mailing list pgsql-general

From Anand Surelia
Subject Sequences
Date
Msg-id 362D1977.850A84B5@bytekinc.com
Whole thread Raw
Responses Re: [GENERAL] Sequences
List pgsql-general
Hi All,
I am using a sequence to automatically generate a transaction number in
my database. I've set up the transaction number to have a default value
from the sequence, so that I don't have to provide a number while
entering. However, I want to know the number of the transaction I've
just entered. I can do that by calling curval(sequence), but in a
dynamic situation with lot of transactions being recorded by multiple
users, how can I be sure I am getting the value which I had entered.
It sounds silly, but I am sure there is a simple solution for it. Do I
have to lock the sequence while I am using so that no one else can use
it, or do I fire both the queries in the same TRANSACTION block?
Thanks for any help,
Anand.


pgsql-general by date:

Previous
From: ZioBudda
Date:
Subject: questions
Next
From: Anand Surelia
Date:
Subject: Re: [GENERAL] Sequences