Re: Knowing when it is safe to call currval()

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Knowing when it is safe to call currval()
Дата
Msg-id 20030511044104.GA20184@wolff.to
обсуждение исходный текст
Ответ на Knowing when it is safe to call currval()  (Matthew Horoschun <mhoroschun@canprint.com.au>)
Список pgsql-sql
On Sun, May 11, 2003 at 14:11:01 +1000, Matthew Horoschun <mhoroschun@canprint.com.au> wrote:
> Hi All,
> 
> Is there any way to know ahead of time whether calling currval() on a 
> sequence will cause an exception like:
> 
> ERROR:  some_id_seq.currval is not yet defined in this session
> 
> In my function I can't be sure whether nextval() will have previously 
> been called in the session.

Well you could just call nextval at the start of the session to make sure
it has a value.

Howvere it is odd that you would want to call currval when there may not
have already been a call to nextval. What are you doing with the returned
value?



В списке pgsql-sql по дате отправления:

Предыдущее
От: Matthew Horoschun
Дата:
Сообщение: Knowing when it is safe to call currval()
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Knowing when it is safe to call currval()