Re: session_id - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: session_id
Date
Msg-id 20041117151939.GA4078@winnie.fuhr.org
Whole thread Raw
In response to Re: session_id  ("Riccardo G. Facchini" <abief_ag_-postgresql@yahoo.com>)
Responses Re: session_id
List pgsql-sql
On Wed, Nov 17, 2004 at 06:25:25AM -0800, Riccardo G. Facchini wrote:
> 
> --- Richard Huxton <__> wrote:
> >
> > Add a new sequence to your database:

[snip]

> Good idea, but it won't work for what I need.
> I'll be able to do get the nextval('my_session_id') as soon as the
> session initiates, but my problem is that I need to make all the
> subsecuent actions aware of that particular value. using
> currval('my_session_id') is not good, as any other session is likely to
> also change my_session_id to another value.

Where did you get the idea that currval() would be affected by other
sessions?  Richard mentioned that sequences are concurrency-safe,
as does the documentation.

http://www.postgresql.org/docs/7.4/static/functions-sequence.html

Can you give us an example of where this wouldn't work?

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


pgsql-sql by date:

Previous
From: "Riccardo G. Facchini"
Date:
Subject: Re: session_id
Next
From: Richard Huxton
Date:
Subject: Re: session_id