Re: List last value of all sequences

Поиск
Список
Период
Сортировка
От
Тема Re: List last value of all sequences
Дата
Msg-id 65137.216.238.112.88.1059081319.squirrel@$HOSTNAME
обсуждение исходный текст
Ответ на Re: List last value of all sequences  (greg@turnstep.com)
Список pgsql-general
>> The main problem with this approach is that, while you get the
>> "current value", the sequence is incremented by the call. I just want
>> to (strictly) look at the value.
>
> The sequence values do not change: test it for yourself.

I guess nothing beats empirical evidence! I was basing my comments on my
(mis?)understanding of what the documentation says.

>>  IF  l_last_value = 0 THEN
>>    PERFORM setval(l_sequence_name,1, False);
>>  ELSE
>>    PERFORM setval(l_sequence_name,l_last_value);
>>  END IF;
>
> Pretty good idea; just beware of sequences that do not start at 1 :)
>

Good point. I think I can deal with that. Thank you.

~Berend Tober




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

Предыдущее
От: Vivek Khera
Дата:
Сообщение: Re: dump_all/restore times?
Следующее
От: greg@turnstep.com
Дата:
Сообщение: Re: List last value of all sequences