Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKF4M-00009W-RE for pgsql-committers@arkaria.postgresql.org; Mon, 12 Jun 2017 02:27:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKF4M-0003Uz-7t for pgsql-committers@arkaria.postgresql.org; Mon, 12 Jun 2017 02:27:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKF46-0002cf-RQ for pgsql-committers@postgresql.org; Mon, 12 Jun 2017 02:26:50 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKF42-0005pv-HO for pgsql-committers@postgresql.org; Mon, 12 Jun 2017 02:26:49 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id v5C2Qec5022313; Mon, 12 Jun 2017 11:26:40 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 4342F5F63F; Mon, 12 Jun 2017 11:26:40 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 2027D5F593; Mon, 12 Jun 2017 11:26:40 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 0E605400A83; Mon, 12 Jun 2017 11:26:40 +0900 (JST) Subject: Re: pgsql: Apply RLS policies to partitioned tables. References: <10974.1497227727@sss.pgh.pa.us> <0c5b8b18-262d-de09-50e1-6cf4815d74ab@joeconway.com> From: Amit Langote Message-ID: Date: Mon, 12 Jun 2017 11:26:24 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <0c5b8b18-262d-de09-50e1-6cf4815d74ab@joeconway.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Joe Conway , Tom Lane Cc: pgsql-committers@postgresql.org X-TM-AS-MML: disable List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2017/06/12 11:09, Joe Conway wrote: > On 06/11/2017 05:35 PM, Tom Lane wrote: >> Joe Conway writes: >>> Apply RLS policies to partitioned tables. >> >> Buildfarm member skink has grown a "make check" failure with this commit. >> >> ==28150== VALGRINDERROR-BEGIN >> ==28150== Invalid read of size 8 >> ==28150== at 0x39A355: ExecInitModifyTable (nodeModifyTable.c:1862) >> ==28150== by 0x37F0F8: ExecInitNode (execProcnode.c:168) >> ==28150== by 0x37C219: InitPlan (execMain.c:1044) >> ==28150== by 0x37C3AF: standard_ExecutorStart (execMain.c:256) >> ==28150== by 0x37C4B8: ExecutorStart (execMain.c:151) >> ==28150== by 0x4CCCCE: ProcessQuery (pquery.c:157) >> ==28150== by 0x4CCEDF: PortalRunMulti (pquery.c:1287) >> ==28150== by 0x4CDE19: PortalRun (pquery.c:800) >> ==28150== by 0x4C9E85: exec_simple_query (postgres.c:1099) >> ==28150== by 0x4CBF20: PostgresMain (postgres.c:4087) >> ==28150== by 0x44DC04: BackendRun (postmaster.c:4331) >> ==28150== by 0x44FD9B: BackendStartup (postmaster.c:4003) >> ==28150== Address 0xbbdbec8 is 8,008 bytes inside a recently re-allocated block of size 8,192 alloc'd >> ==28150== at 0x4C2AB76: malloc (vg_replace_malloc.c:299) >> ==28150== by 0x6002D2: AllocSetAlloc (aset.c:760) >> ==28150== by 0x606EB5: MemoryContextAllocZeroAligned (mcxt.c:791) >> ==28150== by 0x3832B1: CreateExecutorState (execUtils.c:99) >> ==28150== by 0x37C2E6: standard_ExecutorStart (execMain.c:186) >> ==28150== by 0x37C4B8: ExecutorStart (execMain.c:151) >> ==28150== by 0x4CCCCE: ProcessQuery (pquery.c:157) >> ==28150== by 0x4CCEDF: PortalRunMulti (pquery.c:1287) >> ==28150== by 0x4CDE19: PortalRun (pquery.c:800) >> ==28150== by 0x4C9E85: exec_simple_query (postgres.c:1099) >> ==28150== by 0x4CBF20: PostgresMain (postgres.c:4087) >> ==28150== by 0x44DC04: BackendRun (postmaster.c:4331) >> ==28150== >> ==28150== VALGRINDERROR-END >> >> The cited line is the ExecInitQual call here: >> >> /* varno = node->nominalRelation */ >> mapped_wcoList = map_partition_varattnos(wcoList, >> node->nominalRelation, >> partrel, rel); >> foreach(ll, mapped_wcoList) >> { >> WithCheckOption *wco = (WithCheckOption *) lfirst(ll); >> ExprState *wcoExpr = ExecInitQual((List *) wco->qual, >> mtstate->mt_plans[i]); >> >> wcoExprs = lappend(wcoExprs, wcoExpr); >> } >> >> First guess is that map_partition_varattnos has forgotten to handle >> WithCheckOption.qual. If so, though, and if that's not resulting >> in visible misbehavior in the regression tests, then we are missing >> a case that the regression tests should be covering. >> >> BTW, it might be advisable to use castNode(WithCheckOption, ...) >> in the line before that. > > Drat. I'll take a look, but it would probably be good if someone > generally familiar with the partitioned tables patches have a look as well. I am looking too. Commit 587cda35ca3 which added that code did add a test in updatable_views.sql, but tests added by this commit have perhaps exposed something not previously covered. Thanks, Amit -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers