Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VebUy-0006IJ-Md for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2013 02:08:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VebUy-0007sn-5H for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2013 02:08:36 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VebUw-0007r1-GR for pgsql-hackers@postgresql.org; Fri, 08 Nov 2013 02:08:34 +0000 Received: from outmail148102.authsmtp.net ([62.13.148.102]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VebUt-0000vl-8F for pgsql-hackers@postgresql.org; Fri, 08 Nov 2013 02:08:33 +0000 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt14.authsmtp.com (8.14.2/8.14.2) with ESMTP id rA828LLu074470; Fri, 8 Nov 2013 02:08:21 GMT Received: from ayaki.localdomain (106-68-157-59.dyn.iinet.net.au [106.68.157.59]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id rA828ERp064955 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 8 Nov 2013 02:08:17 GMT Message-ID: <527C478D.4070901@2ndquadrant.com> Date: Fri, 08 Nov 2013 10:08:13 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Greg Stark CC: Robert Haas , Tom Lane , Stephen Frost , Josh Berkus , Kohei KaiGai , "ktm@rice.edu" , Alexander Korotkov , Oleg Bartunov , Greg Smith , PgHacker Subject: Re: [v9.4] row level security References: <521F7DFB.8060602@agliodbs.com> <5220D832.7090104@agliodbs.com> <20130830192729.GO2706@tamriel.snowman.net> <16798.1377891794@sss.pgh.pa.us> <1398.1378305956@sss.pgh.pa.us> <1543.1378306249@sss.pgh.pa.us> <2620.1378308159@sss.pgh.pa.us> <52775604.9090306@2ndquadrant.com> <11101.1383575839@sss.pgh.pa.us> <52784DF9.9040205@2ndquadrant.com> <5279E3CA.7050400@2ndquadrant.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Server-Quench: a42626c8-481a-11e3-b802-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZeVg0b BQteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadwMSJgVMAnde RXkJW1VXQF1zU2N9 YQhQIwRdZFRIVxtr VU9XR1tNFgBqBAMA SFxvWht6AmcGeHh0 bENnEHVaWkJ6Oxd5 QEhWEz4OeGNoaTEC UUENdB4GeANIYx9F aFV2VCIMZDFWYTQC El17DBAYFhZyEh9g CjITfBROdA4RGSF0 Qx0cEDFnBkAOWj8y Mw1O X-Authentic-SMTP: 61633235383639.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 106.68.157.59/2525 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 11/07/2013 09:47 PM, Greg Stark wrote: > Incidentally I still feel this is at root the problem with updateable > views in general. I know it's a bit off to be tossing in concerns from > the peanut gallery when I'm not actually offering to work on it and > others are having putting in serious efforts in this area and having > some success. So take this for what it's worth... Frankly, the peanut gallery input can be quite handy. It's easy to get so stuck in the way you've seen it thought about already that you don't see other ways to view it. Plus, sometimes the peanut gallery becomes the "oh, I don't like this at all" crowd when commit time is approaching, so early comments are better than no comments then last minute complaints. > I think the right approach for updateable views would be to support a > syntax like this in the planner: > > UPDATE (select * from tab1,tab2 ...) WHERE tab1.id = .. > SET ... I want to support that for rewritten parse trees, and therefore (because of recursive rewrite) in pre-rewrite parse trees. It's exactly what's needed to make this sane, IMO, and I think this is what Robert was suggesting with making UPDATE capable of dealing with operating directly on a subquery scan. I'm not at all convinced it should be exposed to the user and accepted by the parser as SQL, but I don't know if that's what you were suggesting. Robert? Is this what you meant? If so, any chance you can point a planner neophyte like me in vaguely the right direction? > I'm not sure if this solves all the problems with RLS but it would solve > the concern about plan invalidations and I think it would make it > simpler to reason about security rules that are otherwise happening at > plan time. I don't think it'd help with plan invalidations. View expansion happens at rewrite time, and we don't re-run the rewriter on the original parse tree when we invalidate plans and re-plan. The current patch entirely elides the RLS quals and subquery when running as superuser and that won't work with view expansion at the rewrite stage. So we still have that to deal with, and need to handle a few side issues with portals and user id changes etc, but the biggest issue is coming up with an acceptable way to update a security barrier view or subquery. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers