Search Postgresql Archives

Re: Enforcing serial uniqueness?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane <tgl@xxxxxxxxxxxxx> writes:

> Steven Brown <swbrown@xxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux