On Tue, Mar 21, 2006 at 11:41:11PM -0800, Steven Brown wrote: > I want to allow access to a table's rows without allowing that table to > be damaged. A problem I have is with my serial primary key 'id' field. > Although I can block its UPDATE, if users INSERT with an explicit 'id' > higher than the sequence, future INSERTs will fail due to the values > colliding. Ditto if users modify the sequence (setval) to be lower than > existing 'id' fields. This is rather bad, as it prevents > anyone/anything from INSERTing until fixed by manual intervention. IIRC you can set the permissions on a sequence to allow nextval but not setval. Secondly, if you don't want people to be able to stuff with your ID column, you could set a BEFORE INSERT trigger to overwrite whatever they provide and a BEFORE UPDATE trigger to cancel any changes... Have a nice dat, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Attachment:
signature.asc
Description: Digital signature