Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W84DI-0004lc-PX for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2014 08:40:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W84DI-00059A-8P for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2014 08:40:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W84DG-00057H-01 for pgsql-hackers@postgresql.org; Tue, 28 Jan 2014 08:40:06 +0000 Received: from outmail148102.authsmtp.net ([62.13.148.102]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W84DC-0007qM-QG for pgsql-hackers@postgresql.org; Tue, 28 Jan 2014 08:40:05 +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 s0S8dw7C094641; Tue, 28 Jan 2014 08:39:58 GMT Received: from ayaki.localdomain (106-68-140-97.dyn.iinet.net.au [106.68.140.97]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id s0S8dp2M091544 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 28 Jan 2014 08:39:54 GMT Message-ID: <52E76CD6.1010704@2ndquadrant.com> Date: Tue, 28 Jan 2014 16:39:50 +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: Dean Rasheed CC: Gregory Smith , Greg Stark , Kohei KaiGai , PostgreSQL Hackers Subject: Re: Infinite recursion in row-security based on updatable s.b. views References: <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> <527C478D.4070901@2ndquadrant.com> <52ABCF6C.4010409@gmail.com> <52ABE150.6050201@2ndquadrant.com> <52D98436.2030508@gmail.com> <52DC82E2.5010801@2ndquadrant.com> <52DCBEF1.3010004@2ndquadrant.com> <52E1CC04.8040907@2ndquadrant.com> <52E1DAD8.30909@2ndquadrant.com> <52E22C8E.2020702@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: c42a857f-87f7-11e3-b802-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZeVg0b BQteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksacxtFag1bZ1hf HGQLWlBEUFV7Wmp/ bgwfbAVbfExGQQRu UFZARU1QEQdtHh1P RR59Wk0ydXhGcX91 YUIsX3hYWkQ0JkJ/ E0ZREjsbbWA2b30e URVbalFccAFXfh9H b1l/BXIINTQAKBg1 TUcAHxkaHhhlExEd YwcDLFQTXUtDBDM3 WgoZHDIpVUwDDz80 MFk9J1UBBkcNIw04 OEAsVRofNVcPEgFX A0hHBCI7b0JHTWxj EwJXQlV2 X-Authentic-SMTP: 61633235383639.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 106.68.140.97/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 01/24/2014 07:16 PM, Dean Rasheed wrote: > think recursively calling the rewriter > to expand view references in the new RLS qual, and > expand_security_qual() to expand any additional RLS quals in the > securityQuals list With this, it'd be helpful if expand_security_qual(...) took a RangeTblEntry instead of an rt_index. That'd also be much more efficient with large rtables if we can arrange a scan through the rtable when looking for security quals. Like other places that operate on the rangetable while it's being modified, we can walk the rangetable list up until the final entry that existed when we started walking. This approach saves the series of rt_fetch calls, which are something like O(n log n) for n relations. It's safe because the operation will only append rangetable entries. (I can't help wonder how much we'd gain by making the rtable an array that gets doubled in size and copied whenever it overflows, rather than a linked list, given all the walking of it that gets done, and how dead entries to get flagged as dead rather than actually removed.) I'm looking for where I found the code that already does this so I can point and say "I'm not crazy, we already do it here". Will follow up with a patch. -- 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