Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAQ1Jxm26580 for ; Sun, 25 Nov 2001 20:19:59 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fAQ1JN807252; Sun, 25 Nov 2001 20:19:23 -0500 (EST) To: "Aasmund Midttun Godal" cc: pgsql-sql@postgresql.org Subject: Re: Sequence permission suggestion In-reply-to: <20011126005514.10436.qmail@ns.krot.org> References: <20011126005514.10436.qmail@ns.krot.org> Comments: In-reply-to "Aasmund Midttun Godal" message dated "Mon, 26 Nov 2001 00:55:14 +0000" Date: Sun, 25 Nov 2001 20:19:22 -0500 Message-ID: <7249.1006737562@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200111/360 X-Sequence-Number: 5742 "Aasmund Midttun Godal" writes: > Today it seems that the following rules governs the permissions of sequences: > SELECT - allow you to select * from seq_name; > INSERT - no effect > UPDATE - allows nextval, setval - and yes implicitly currval > DELETE - no effect > I suggest nextval is moved into the insert permission as this is quite > natural It looks like an update to me; in particular, it allows you to determine the old state of the sequence, and thus has read+write semantics not only write semantics. > normally you only need to call nextval when you insert a new value > into a table. I think this issue is important because setting the > sequence to a value lower than the max value in a table will cause > errors for other users. This seems to be exceedingly SERIAL-centric thinking; there are other uses for sequences than serials. It might make sense to allow either INSERT or UPDATE permission to grant nextval() access, while still requiring UPDATE for setval(). But I'm not convinced yet ... regards, tom lane