Re: plperl - make $_TD global

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: plperl - make $_TD global
Date: 2006-05-23 19:38:29
Message-ID: 200605231938.k4NJcTw06402@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andrew Dunstan wrote:
> >>The attached tiny patch will fix the problem Greg Sabino Mullane had
> >>with a shared lexical $_TD, by making it a global and just pushing a
> >>local value in the trigger function.
> >>...
> >>I don't think a docs change is needed.
> >
> >Are you sure this doesn't cause any user-visible semantics change
> >(ie, something that might break someone's code)?
> >
> >
> >
> >
>
> I think it should be mentioned in the release notes.
>
> I would be fairly stretched to come up with an example that it breaks.
> Essentially it's a way around the sharing violation that Greg got from
> using $_TD in a nested subroutine. All we are doing is moving $_TD from
> the local namespace to the global namespace. It still gets a per
> trigger-call value (that's what the "local $_TD = $_[0];" does) and that
> will work correctly even under recursive calls, so I think it's fairly safe.
>
> Maybe it is worth putting somethng in the plperl Trigger docs about the
> nature of the beast. I will do that if you like.
>

Yes, I think something for docs would be good.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-05-23 22:13:06 Re: [GENERAL] Querying libpq compile time options
Previous Message Bruce Momjian 2006-05-23 19:27:46 Re: [HACKERS] Duplicate definition of LOCALEDIR