Re: Enforcing serial uniqueness?

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Enforcing serial uniqueness?
Дата
Msg-id 87y7z2lfhj.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Enforcing serial uniqueness?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Steven Brown <swbrown@ucsd.edu> writes:
> > Martijn van Oosterhout wrote:
> >> IIRC you can set the permissions on a sequence to allow nextval but not
> >> setval.
>
> > I've not been able to find a way - granting UPDATE grants the use of
> > both.
>
> Yes.  This is intentional, on the grounds that being able to do NEXTVAL
> enough times is equivalent to SETVAL.  (Only strictly true for a CYCLE
> sequence, but the point is that if you don't want to allow SETVAL you
> shouldn't want to allow unrestricted use of NEXTVAL either.)

What if you don't mind someone being able to use up unused values but don't
want someone to be able to rewind the sequence and generate duplicate key
violations breaking the application?

--
greg

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: back slash separated values
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg 8.1.3 on AIX