Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHFTR-0006sr-EL for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Sep 2013 15:58:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VHFTQ-0003YV-V1 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Sep 2013 15:58:28 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHFTQ-0003YN-1w for pgsql-hackers@postgresql.org; Wed, 04 Sep 2013 15:58:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHFTN-00044Z-Gw for pgsql-hackers@postgresql.org; Wed, 04 Sep 2013 15:58:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id r84FwJcO003944; Wed, 4 Sep 2013 11:58:19 -0400 From: Tom Lane To: Kohei KaiGai cc: Robert Haas , Stephen Frost , Josh Berkus , "ktm@rice.edu" , Alexander Korotkov , Oleg Bartunov , Greg Smith , PgHacker Subject: Re: [v9.4] row level security In-reply-to: References: <20130829142321.GA30496@aart.rice.edu> <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> Comments: In-reply-to Kohei KaiGai message dated "Wed, 04 Sep 2013 17:28:59 +0200" Date: Wed, 04 Sep 2013 11:58:19 -0400 Message-ID: <3942.1378310299@sss.pgh.pa.us> X-Pg-Spam-Score: -4.3 (----) 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 Kohei KaiGai writes: > 2013/9/4 Tom Lane : >> And for insert/update/delete, we do what exactly? > Regarding to update/delete, this patch also enhanced to allow update or > delete mechanism allows to take a sub-query on top of the table scan plan. > So, its explain output shows as follows: > postgres=> EXPLAIN (costs off) UPDATE customer SET email = 'alice@example.com'; > QUERY PLAN > -------------------------------------------------- > Update on customer > -> Subquery Scan on customer > -> Seq Scan on customer customer_1 > Filter: ("current_user"() = uname) > You can see this update has Subquery plan instead of regular relation scan. Really? That wasn't apparent from reading the patch. (Have I mentioned it's desperately underdocumented? Aside from needing a lot more in-code comments than it's got, it would benefit from having an overview section added to optimizer/README explaining stuff at the level of this discussion.) I'm a bit surprised that setrefs.c doesn't eliminate the Subquery Scan as being a no-op, given that no quals end up getting applied at that level. You might look into why not, since if that plan node were eliminated at the end, it'd fix any efficiency complaints about this approach. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers