Current value of a sequence?
| От | Adam Haberlach |
|---|---|
| Тема | Current value of a sequence? |
| Дата | |
| Msg-id | 20010603123422.A29898@newsnipple.com обсуждение исходный текст |
| Ответы |
Re: Current value of a sequence?
Re: Current value of a sequence? |
| Список | 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@newsnipple.com | a leisure class. -- Eric Beck 1965
http://www.newsnipple.com |
'88 EX500 '00 >^< | http://youlook.org
В списке pgsql-general по дате отправления: