From: | Adam Haberlach <adam(at)newsnipple(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Current value of a sequence? |
Date: | 2001-06-03 19:34:22 |
Message-ID: | 20010603123422.A29898@newsnipple.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm trying to find the next value that will be assigned by a sequence
without actually incrementing it (yes, I know it isn't atomic-safe
and all)
I had a lot of trouble finding information about sequences in
the current documentation (maybe it is in the A4 PDF version or
something). When I finally resorted to trolling through the
source code, and found currval, it seems to have an odd (IMHO)
behavior:
zipcode=# select currval('messages_pkey_seq');
ERROR: messages_pkey_seq.currval is not yet defined in this session
...however, if I select nextval() first, it works. Is this
lazy caching? Is there a good way to find the current value of
sequence without querying directly (and possibly breaking in
future implementations?)
--
Adam Haberlach | At either end of the social spectrum there lies
adam(at)newsnipple(dot)com | a leisure class. -- Eric Beck 1965
http://www.newsnipple.com |
'88 EX500 '00 >^< | http://youlook.org
From | Date | Subject | |
---|---|---|---|
Next Message | Francesco Casadei | 2001-06-04 00:26:05 | return value of a version-1 C function |
Previous Message | Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= | 2001-06-03 17:05:00 | Re: 7.1.2 packaging |