Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGaJb-0002fy-Bw for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Jul 2015 22:10:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZGaJa-00039e-TQ for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Jul 2015 22:10:38 +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) (envelope-from ) id 1ZGaJY-00036T-N5 for pgsql-bugs@postgresql.org; Sat, 18 Jul 2015 22:10:36 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZGaJR-0003d6-39 for pgsql-bugs@postgresql.org; Sat, 18 Jul 2015 22:10:35 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [195.39.71.250]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 039A1400DD7; Sat, 18 Jul 2015 15:10:23 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id C1287206E; Sun, 19 Jul 2015 00:19:15 +0400 (SAMT) Date: Sat, 18 Jul 2015 22:19:15 +0200 From: Alvaro Herrera To: Michael Paquier Cc: Tom Lane , Bill Parker , PostgreSQL mailing lists Subject: Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x Message-ID: <20150718201915.GA2297@postgresql.org> References: <20150612194716.GQ133018@postgresql.org> <4457.1434166911@sss.pgh.pa.us> <20150718155421.GZ2301@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150718155421.GZ2301@postgresql.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Alvaro Herrera wrote: > > Now, perhaps we could do more efforts with prodesc as well, see for > > example compile_pltcl_function for pltcl and similarly for plperl. > > Thoughts? > > Right. It would simplify the code: create a memory context child of > TopTransactionContext, then compile the function, and if successful, > then MemoryContextSetParent to some longer-lived context. When the > function is invalidated, it's sufficient to delete the context and > create a new one. Creating the context as child of > TopTransactionContext allows you to avoid an explicit > MemoryContextDelete() in the elog(ERROR) cases while compiling. With some additional effort, we could get rid of perm_fmgr_info, at least in pltcl. (That hack was introduced in a3ed622b63b and 7748e9e7e5a back in 2001 and we never actually fixed it ...) -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs