Re: Test to see if currval will fail?
От | Kelly McDonald |
---|---|
Тема | Re: Test to see if currval will fail? |
Дата | |
Msg-id | 1039180730.26641.19.camel@shadrach обсуждение исходный текст |
Ответ на | Re: Test to see if currval will fail? ("Josh Berkus" <josh@agliodbs.com>) |
Ответы |
Re: Test to see if currval will fail?
Re: Test to see if currval will fail? |
Список | pgsql-novice |
Josh, Actually, I'm not really concerned about what the last value was or is, but I am trying to find out if nextval has already been called within the current session. so I can do something like: if currval_wont_puke('sequence') then select currval('sequence') else select nextval('sequence') the part that I'm looking for is the currval_wont_puke() function. I have already tried every way that I can think of to catch an exception by currval, (and learned more since then) and I'm certain that there is no way to catch an exception, no matter what language you write it in. I know how to create a function like this, but I'd have to tinker with backend source (sequence.c) to make it work. - I thought I'd see if there is an easier way before I go do something crazy like that. Thanks, Kelly. On Thu, 2002-12-05 at 17:56, Josh Berkus wrote: > Kelly, > You could do "select last_value from <sequence name>" instead. > However, I'm not sure that that method of getting the currval is > session-protected in the way that currval is. > > -Josh Berkus
В списке pgsql-novice по дате отправления: