Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 6CCE1C7DB12 for ; Mon, 19 Mar 2012 17:41:01 -0300 (ADT) Received: from 30.55.colo.spiretech.net ([69.168.55.30] helo=lists.commandprompt.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S9jNw-00088X-Mx for pgsql-bugs@postgresql.org; Mon, 19 Mar 2012 20:41:00 +0000 Received: from perhan.alvh.no-ip.org (spinlock.commandprompt.com [69.168.55.30]) by lists.commandprompt.com (Postfix) with ESMTPA id 28CC0EB; Mon, 19 Mar 2012 13:41:31 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([200.126.81.219] helo=perhan.alvh.no-ip.org) by assp.commandprompt.com with ESMTPS(AES256-SHA) (2.1.1); 19 Mar 2012 13:41:29 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 49DE46E306; Mon, 19 Mar 2012 17:40:37 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: marko , Pg Bugs Subject: Re: BUG #6511: calling spi_exec_query from non-main package, results in: couldn't fetch $_TD From: Alvaro Herrera To: Alex Hunsaker In-reply-to: References: Date: Mon, 19 Mar 2012 17:40:37 -0300 Message-Id: <1332189577-sup-8497@alvh.no-ip.org> User-Agent: Sup/git X-Assp-Version: 2.1.1(11364) on assp.commandprompt.com X-Assp-Client-TLS: yes X-Assp-ID: assp.commandprompt.com m1-89691-10784 X-Assp-Envelope-From: alvherre@alvh.no-ip.org X-Assp-Intended-For: badalex@gmail.com X-Assp-Original-Subject: Re: [BUGS] BUG #6511: calling spi_exec_query from non-main package, results in: couldn't fetch $_TD Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/144 X-Sequence-Number: 32705 Excerpts from Alex Hunsaker's message of mi=C3=A9 mar 07 01:08:25 -0300 2= 012: > On Sat, Mar 3, 2012 at 12:19, wrote: > Yeah, there were some optimization done for 9.1 to try and make calls > a bit faster. The problem is we are fetching "_TD" not "main::_TD", > which means we try to find and use $_TD from whatever the current > package is. This should only happen from a nested plperl to plperl > trigger where the outer call was in a different package, otherwise the > package is always main. >=20 > The attached fixes it for me, It would be great if you could confirm th= at. Thanks -- applied to 9.1 and master. --=20 =C3=81lvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support