Re: Enforcing serial uniqueness? - Mailing list pgsql-general

From Greg Stark
Subject Re: Enforcing serial uniqueness?
Date
Msg-id 87y7z2lfhj.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Enforcing serial uniqueness?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: back slash separated values
Next
From: Tom Lane
Date:
Subject: Re: pg 8.1.3 on AIX