Skip site navigation (1) Skip section navigation (2)

Re: session_id

From: Richard Huxton <dev(at)archonet(dot)com>
To: abief_ag_-postgresql(at)yahoo(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: session_id
Date: 2004-11-17 15:24:23
Message-ID: 419B6D27.5020804@archonet.com (view raw or flat)
Thread:
Lists: 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

In response to

pgsql-sql by date

Next:From: Thomas F.O'ConnellDate: 2004-11-17 19:27:17
Subject: Re: Counting Distinct Records
Previous:From: Michael FuhrDate: 2004-11-17 15:19:39
Subject: Re: session_id

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group