Re: Row-security on updatable s.b. views

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Gregory Smith <gregsmithpgsql(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Yeb Havinga <yebhavinga(at)gmail(dot)com>
Subject: Re: Row-security on updatable s.b. views
Date: 2014-02-06 14:28:23
Message-ID: 52F39C07.5060301@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/06/2014 10:19 PM, Craig Ringer wrote:
> On 02/06/2014 12:43 PM, Craig Ringer wrote:
>> 1. Try (again) to do row-security in the rewriter. This was previously
>> impossible because of the definition of row-security behaviour around
>> inheritance, but with the simplified inheritance model now proposed I
>> think it's possible.
>
> Thanks to the simplified requirements for inheritance, this turns out to
> be fairly easy. There's a version rewritten to use the rewriter in the tag:
>
> rls-9.4-upd-sb-views-v6
>
> on https://github.com/ringerc/postgres.git
>
> The trickiest bit remaining is how to register the PlanInvalItem to
> force plan invalidation when the user-id changes. This was easy in the
> optimizer, but it's not obvious how to do it cleanly in the rewriter.
> I've got a couple of ideas but don't much like either of them.
> Recommendations from the experienced welcomed.

Or, after thinking about it for a second with my tired brain, "not so much".

We don't rerun rewrite on plan invalidation.

So that means the superuser exemption won't work properly with this patch.

So much for having a hope, that's not a small thing to fix.

So: either I invoke the rewriter from within the optimizer on the
security quals, or I make the rewriter re-run on plan invalidation.
Neither is small or simple.

Blast.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafael Martinez Guerrero 2014-02-06 14:35:41 open and close columns in the NEW record not allowed
Previous Message Robert Haas 2014-02-06 14:22:32 Re: Minor performance improvement in transition to external sort