Re: session_id - Mailing list pgsql-sql

From Richard Huxton
Subject Re: session_id
Date
Msg-id 419B6D27.5020804@archonet.com
Whole thread Raw
In response to Re: session_id  ("Riccardo G. Facchini" <abief_ag_-postgresql@yahoo.com>)
List pgsql-sql
Riccardo G. Facchini wrote:
>>Add a new sequence to your database:
>>   CREATE SEQUENCE my_session_id;
>>
>>Then, at the start of every session:
>>   SELECT nextval('my_session_id');
>>
>>and whenever you need the value:
>>   SELECT currval('my_session_id');

> 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.

No - other sessions will see different values. Test it and see.
--   Richard Huxton  Archonet Ltd


pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: session_id
Next
From: Thomas F.O'Connell
Date:
Subject: Re: Counting Distinct Records