Re: New patch for Column-level privileges

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Markus Wanner <markus(at)bluegap(dot)ch>, Alex Hunsaker <badalex(at)gmail(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New patch for Column-level privileges
Date: 2009-01-13 16:48:36
Message-ID: 20090113164836.GC4656@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> What I see being tested is SELECT *, which is a different animal
> entirely. As required by spec, SELECT * is expanded to a list of
> ordinary variables at parse time and then it's not really a special
> case anymore. A true whole-row variable only occurs when you have
> something like
>
> create function myfunc(mytable) ...
>
> select myfunc(mytable.*) from mytable ...

Wouldn't this test cover those?

SELECT atest5 FROM atest5; -- fail

Which I added after KaiGai brought it up.

> This is different from the *-expansion case in that you get just
> a single Var with attno 0 in the resulting parse tree.

Right, that's part of the reason that pg_attribute_aclmask has the for
loop through all of the columns- because if an attno of 0 is passed in,
it has to check that the requestor has rights on *all* of the columns.

> Because of this action-at-a-distance in terms of what columns are
> implicitly referenced, I think that the only feasible implementation is
> to carry the "reference to column 0" notation in cols_sel right through
> to execMain, and have execMain understand that as demanding select
> rights on all currently existing non-dropped non-system columns.
> I have not yet checked to see if that's what actually happens;
> but it's certainly not being exercised in the added regression tests.

Right, that's what happens because execMain passes the zero attrno down
into pg_attribute_aclmask which then checks all columns. I could move
that looping logic up into execMain if you'd rather (along with the
special case for 'any column rights') but then I'd have to get the set
of columns which exist in the table referenced by the RTE in execMain.
Dunno if that'd be hard or not.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-01-13 16:57:00 Re: New patch for Column-level privileges
Previous Message Andrew Chernow 2009-01-13 16:28:12 Re: solaris libpq threaded build fails