Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 543D364FC3E for ; Mon, 22 Sep 2008 14:44:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55780-01 for ; Mon, 22 Sep 2008 14:44:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by postgresql.org (Postfix) with ESMTP id 3FA446500EA for ; Mon, 22 Sep 2008 14:41:52 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id c7so566314nfi.23 for ; Mon, 22 Sep 2008 10:41:50 -0700 (PDT) Received: by 10.210.25.19 with SMTP id 19mr5224643eby.134.1222105310667; Mon, 22 Sep 2008 10:41:50 -0700 (PDT) Received: from oxford.xeocode.com.enterprisedb.com ([82.16.16.210]) by mx.google.com with ESMTPS id m5sm726330gve.3.2008.09.22.10.41.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Sep 2008 10:41:49 -0700 (PDT) To: Simon Riggs Cc: Postgres Subject: Re: get_relation_stats_hook() References: <1218062303.4549.302.camel@ebony.2ndQuadrant> From: Gregory Stark X-Draft-From: ("nnimap+imap.gmail.com:HACKERS" 1705) Date: Mon, 22 Sep 2008 18:41:48 +0100 Message-ID: <87fxnsoz6r.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/1432 X-Sequence-Number: 124561 Hm, I assume we want to be able to turn on and off plugins in a running session? I think the "free_using_plugin" flag: ! if (get_relation_stats_hook) ! vardata->statsTuple = (*get_relation_stats_hook) ! (rte->relid, ! var->varattno); ! ! if (vardata->statsTuple) ! vardata->free_using_plugin = true; ! else ! vardata->statsTuple = SearchSysCache(STATRELATT, is insufficient to handle this. vardata->free_using_plugin could be true but by the time the variable is released the plugin pointer could have been cleared. Or worse, set to a different plugin. The easiest way to fix this seems like also the best way, instead of storing a boolean store the pointer to the release function. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's 24x7 Postgres support!