Re: more RLS oversights

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Joe Conway <joe(dot)conway(at)crunchydata(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: more RLS oversights
Date: 2015-07-29 19:58:49
Message-ID: 20150729195849.GL2441@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway wrote:
> On 07/29/2015 02:41 AM, Dean Rasheed wrote:
> > I don't think there is any point in adding the new function
> > transformPolicyClause(), which is identical to transformWhereClause().
> > You can just use transformWhereClause() with EXPR_KIND_POLICY. It's
> > already used for lots of other expression kinds.
>
> Ok -- I went back to using transformWhereClause. I'd still prefer to
> change the name -- more than half the uses of the function are for other
> than EXPR_KIND_WHERE -- but I don't feel that strongly about it.

Currently the comment about it says "for WHERE and allied", maybe this
should be a bit more explicit. I think it was originally for things
like WHERE and HAVING, and usage slowly extended beyond that. Does it
make sense to consider the USING clause in CREATE/ALTER POLICY as an
"allied" clause of WHERE? I don't particularly think so. I'm just
talking about a small rewording of the comment.

> > I think that check_agglevels_and_constraints() and
> > transformWindowFuncCall() could be made to emit more targeted error
> > messages for EXPR_KIND_POLICY, for example "aggregate functions are
> > not allowed in policy USING and WITH CHECK expressions".
>
> done

> + case EXPR_KIND_POLICY:
> + if (isAgg)
> + err = _("aggregate functions are not allowed in POLICY USING and WITH CHECK expressions");
> + else
> + err = _("grouping operations are not allowed in POLICY USING and WITH CHECK expressions");

I think this reads a bit funny. What's a "POLICY USING" clause? I
expect that translators will treat the two words POLICY USING as a
single token, and the result is not going to make any sense.

Maybe "in a policy's USING and WITH CHECK expressions", or perhaps "in
policies's USING and WITH CHECK exprs", not sure.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2015-07-29 20:04:54 Re: pg_basebackup and replication slots
Previous Message Dean Rasheed 2015-07-29 19:53:43 Re: more RLS oversights