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

Re: checking currval

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Jodi Kanter <jkanter(at)virginia(dot)edu>
Cc: Weiping He <laser(at)zhengmai(dot)com(dot)cn>,Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: checking currval
Date: 2003-06-18 15:13:13
Message-ID: Pine.LNX.4.33.0306180911080.4868-100000@css120.ihs.com (view raw or flat)
Thread:
Lists: pgsql-admin
What flavor Postgresql are you running?  That works on both my 7.2.x boxes 
and my 7.3 boxes.  If you're running anything older than 7.2.x, you might 
wanna upgrade before asking for help, since folks tend to assume you're 
running at least 7.2 around here.

Note that this IS NOT TRANSACTION safe.  If two processes do this at the 
same time and operate on that number, you can have a race condition that 
will cause you problems.

Use the nextval,setval,currval functions for transaction safe sequence 
work.

On Wed, 18 Jun 2003, Jodi Kanter wrote:

> I tried that and it did not work. It won't be a problem in the code 
> since it appears that we are always doing a nextval prior to currval, 
> but I was just wondering about how to do it while in a psql session.
> 
> Weiping He wrote:
> 
> > select last_value from your_sequence;
> >
> > Jodi Kanter wrote:
> >
> >> I cannot view the currval because it is not set in the session yet. 
> >> Is there a way to set it without having to increment the value?
> >> Thanks
> >> Jodi
> >
> >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> 
> 
> 


In response to

pgsql-admin by date

Next:From: Chris GamacheDate: 2003-06-18 16:54:01
Subject: PostgreSQL calibration
Previous:From: Bruno Wolff IIIDate: 2003-06-18 14:34:23
Subject: Re: checking currval

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