pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Riccardo G. Facchini <abief_ag_-postgresql@yahoo.com>
To: Michael Fuhr <mike@fuhr.org>
To: pgsql-sql@postgresql.org
Subject: Re: session_id
Date: Thu, 18 Nov 2004 04:38:31 -0800 (PST)
Message-ID: <20041118123831.5789.qmail@web13925.mail.yahoo.com> (raw)
In-Reply-To: <20041117151939.GA4078@winnie.fuhr.org>


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



view thread (11+ messages)  latest in thread

Message-ID: <20041118123831.5789.qmail@web13925.mail.yahoo.com>
Permalink:  ../20041118123831.5789.qmail@web13925.mail.yahoo.com/
Also on:    postgresql.org/message-id/20041118123831.5789.qmail@web13925.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: abief_ag_-postgresql@yahoo.com, mike@fuhr.org
  Subject: Re: session_id
  In-Reply-To: <20041118123831.5789.qmail@web13925.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox