Re: [PATCHES] Extending grant insert on tables to sequences

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Extending grant insert on tables to sequences
Date: 2008-07-08 13:32:44
Message-ID: 20080708133244.GB4095@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Jaime Casanova escribió:
> On Thu, May 22, 2008 at 1:18 PM, Jaime Casanova <systemguards(at)gmail(dot)com> wrote:
> > Hi,
> >
> > The idea of this patch is to avoid the need to make explicit grants on
> > sequences owned by tables.
>
> I've noted that the patch i attached is an older version that doesn't
> compile because of a typo...
> Re-attaching right patch and fix documentation to indicate the new behaviour...

I had a look at this patch and it looks good. The only thing that's not
clear to me is whether we have agreed we want this to be the default
behavior?

A quibble:

> + foreach(cell, istmt.objects)
> + {
> + [...]
> +
> + istmt_seq.objects = getOwnedSequences(lfirst_oid(cell));
> + if (istmt_seq.objects != NIL)
> + {
> + if (istmt.privileges & (ACL_INSERT))
> + istmt_seq.privileges |= ACL_USAGE;
> + else if (istmt.privileges & (ACL_UPDATE))
> + istmt_seq.privileges |= ACL_UPDATE;
> + else if (istmt.privileges & (ACL_SELECT))
> + istmt_seq.privileges |= ACL_SELECT;
> +
> + ExecGrantStmt_oids(&istmt_seq);
> + }

Wouldn't it be clearer to build a list with all the sequences owned by
the tables in istmt.objects, and then call ExecGrantStmt_oids() a single
time with the big list?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-07-08 13:39:39 Re: CommitFest rules
Previous Message Hans-Juergen Schoenig 2008-07-08 13:06:33 Re: New relkind (was Re: Exposing quals)

Browse pgsql-patches by date

  From Date Subject
Next Message Heikki Linnakangas 2008-07-08 15:13:13 Re: Bug fix for pg_standby keepfiles calculation
Previous Message Simon Riggs 2008-07-08 12:16:31 Re: [PATCHES] WIP: executor_hook for pg_stat_statements