Re: session_id

From: "Riccardo G(dot) Facchini" <abief_ag_-postgresql(at)yahoo(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: session_id
Date: 2004-11-18 12:38:31
Message-ID: 20041118123831.5789.qmail@web13925.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


--- Michael Fuhr <__> wrote:

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

No, I can't provide it because your'e right. currval() is NOT affected
by other sessions.

Thanks anyway for the suggestion, using pg_backend_pid() solved the
uniqueness I needed. I'll keep the nextval/currval for another
opportunity.

thanks to all for the support!

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Justine.Cleary 2004-11-18 19:28:03 missing... at end of sql expression
Previous Message Premsun Choltanwanich 2004-11-18 10:45:12 How to make lo_import and lo_export to use file on client local machine?