Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLo5M-0008BS-08 for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Sep 2020 13:48:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kLo5K-0001eX-TD for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Sep 2020 13:48:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLo5K-0001eQ-NS for pgsql-bugs@lists.postgresql.org; Fri, 25 Sep 2020 13:48:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLo5G-00006X-HP for pgsql-bugs@lists.postgresql.org; Fri, 25 Sep 2020 13:48:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08PDmJrv1852788; Fri, 25 Sep 2020 09:48:20 -0400 From: Tom Lane To: Konstantin Knizhnik cc: pgsql-bugs@lists.postgresql.org Subject: Re: Memory leak in RelationBuildRowSecurity In-reply-to: <21356c12-8917-8249-b35f-1c447231922b@postgrespro.ru> References: <21356c12-8917-8249-b35f-1c447231922b@postgrespro.ru> Comments: In-reply-to Konstantin Knizhnik message dated "Fri, 25 Sep 2020 12:52:18 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1852786.1601041699.1@sss.pgh.pa.us> Date: Fri, 25 Sep 2020 09:48:19 -0400 Message-ID: <1852787.1601041699@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Konstantin Knizhnik writes: > There is memory leak in RelationBuildRowSecurity function - it converts > node to expression tree in current memory context: Hm ... this smells a whole lot like the issue we fixed recently for partition expressions, namely: what the devil are we doing reloading these expressions during RelationClearRelation? We should delay populating that cache until the value is requested. regards, tom lane