Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 303A6B5D95B for ; Sun, 15 May 2011 17:02:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 81506-08 for ; Sun, 15 May 2011 20:02:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id CCD2EB5D94C for ; Sun, 15 May 2011 17:02:11 -0300 (ADT) Received: by gyd10 with SMTP id 10so1333955gyd.19 for ; Sun, 15 May 2011 13:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=k6rfVf8+OdnucOi75/tcPxeFIMH8Pf1UIdMBIj4FYgI=; b=Uow8tbAlj0vm4xlbpVgfC8/Tw3Oi/1KdH2HTXRNPcpFvllFitHMcqpgf8+dsFdDkys s0zyjjOQNawL64Sn3vdBjN2lO/xxbvYpdbK2f6DPtS+u1OH1UckHAZW9ntW6CLonubtg TO0QRx2UDzE+279v7DMUxol0uGmO9D+r8j+p4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=EXnVF/EYz0e2Hp2RnY/Hq5pcvWns3f0aNUQAfPMjtoo1kzQFh6NK1BJCIL3jvGVLKk dx3/2pvlzjVI9lhkWgsU4caguHQeDNBX/HMgjuk/OyKpa7ai19W4cdIQXugJa0vIs26Q YQ6gk02luwmgOQKoRgR1xxnY3ttkcTzKaO+o0= MIME-Version: 1.0 Received: by 10.236.108.177 with SMTP id q37mr3705784yhg.14.1305489730174; Sun, 15 May 2011 13:02:10 -0700 (PDT) Received: by 10.236.110.41 with HTTP; Sun, 15 May 2011 13:02:10 -0700 (PDT) In-Reply-To: References: <20110503234033.GE2701@core.home> <1304599769-sup-6735@alvh.no-ip.org> Date: Sun, 15 May 2011 16:02:10 -0400 Message-ID: Subject: Re: Plperl trigger variables no longer global From: Robert Haas To: Alex Hunsaker Cc: Alvaro Herrera , Greg Sabino Mullane , pgsql-bugs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/125 X-Sequence-Number: 30264 On Thu, May 5, 2011 at 12:14 PM, Alex Hunsaker wrote: > On Thu, May 5, 2011 at 06:51, Alvaro Herrera = wrote: >> Excerpts from Alex Hunsaker's message of mi=E9 may 04 23:53:34 -0300 201= 1: >> >>> After playing with it a bit more I see 2 clear options: >>> 1) make $_TD global like %_SHARED. This should not cause any problems >>> as we make $_TD private via local() before each trigger call. Also pre >>> 9.1 non trigger functions could still access and check the definedness >>> of $_TD so if someone was relying on that (for whatever unknown >>> reason) that will work again. >> >> This is strange. =A0Are you saying that there's no decent way to make a >> variable global in C code? > > Im sure we could... I don't see any reason to do it in C. (performance > or otherwise) > > In other news I found another bug with this-- it was trying to > local($_TD) by using SAVESPTR() when it seems it really should be > using save_item(). Currently its not really localizing $_TD, which at > the very least means recursive triggers might modify the callers $_TD. > Ugh. > > Fixed in the attached plus added regression tests for both issues (use > strict; && Global symbol "$_TD" requires explicit package name, test > recursive trigger calls). Although Ill admit, given the point we are > in the release I could see a revert also being justified. > > Greg, big thanks for testing! keep it up! :) Do we need to apply this patch? --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company