pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aasmund Midttun Godal <postgresql@envisity.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sequence permission suggestion
Date: Sun, 25 Nov 2001 20:19:22 -0500
Message-ID: <7249.1006737562@sss.pgh.pa.us> (raw)
In-Reply-To: <20011126005514.10436.qmail@ns.krot.org>
References: <20011126005514.10436.qmail@ns.krot.org>

"Aasmund Midttun Godal" <postgresql@envisity.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <7249.1006737562@sss.pgh.pa.us>
Permalink:  ../7249.1006737562@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7249.1006737562@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, postgresql@envisity.com
  Subject: Re: Sequence permission suggestion
  In-Reply-To: <7249.1006737562@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox