From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-admin@postgresql.org
Subject: Re: Why sequence grant is separated from table?
Date: Thu, 20 Jun 2013 12:46:21 +0300
Message-ID: <51C2CF6D.8070704@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAFjNrYto7C0G_2+UFLcWng3T6rZih5t54P0tRO4w+_Z0wONxMA@mail.gmail.com>
References: <51C17B74.4070109@gmail.com>
<CAFjNrYto7C0G_2+UFLcWng3T6rZih5t54P0tRO4w+_Z0wONxMA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
On 19/06/2013 12:47, Szymon Guz wrote:
> On 19 June 2013 11:35, Rural Hunter <ruralhunter@gmail.com
> <mailto:ruralhunter@gmail.com>> wrote:
>
> I really hate the error "permission denied for sequence xxxxx"
> when I grant on a table but forget to grant additionally on the
> related sequence to users. Can the permission of table and related
> sequences be merged?
>
>
> I can imagine a situation where you want a user to be granted rights
> on a table, to use sequence with curval and nextval functions, but not
> setval, as it can provide some database problems.
>
> What's more, in general, you cannot say which sequence is used for
> which table, if the sequence is not owned by the table.
Right, there might be cases, when one sequence is used by more than one
table. Like for instance when the user wishes to create a view on a
union of two tables, with their IDs included, and still those IDs to be
guaranteed to be unique across the union.
However, after I dumped a table recently whose sequence is shared by
another table as wee i noticed this :
ALTER SEQUENCE vessels_id_seq OWNED BY vessels.id;
Which means that the initial relationship between the "creating" table
and the sequence is preserved for the whole life of the table. This
could tempt new users to think that it could be meaningful to bind those
two in the GRANT.
>
> Which permissions of a table do you want to merge with which
> permissions of sequences?
>
> regards
> Szymon
--
Achilleas Mantzios
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-admin@postgresql.org
Cc: achill@matrix.gatewaynet.com
Subject: Re: Why sequence grant is separated from table?
In-Reply-To: <51C2CF6D.8070704@matrix.gatewaynet.com>
* 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