Обсуждение: pl/perl interpreter instance(s) - how long does it persist?

Поиск
Список
Период
Сортировка

pl/perl interpreter instance(s) - how long does it persist?

От
Toby Corkindale
Дата:
Hi,
Apologies in advance if this has been covered before, but I've searched
extensively without finding anything so far.

I would like to know how long the pl/perl interpreter instances persist?

I ask because I'm doing some work where we have PL/Perlu code that loads
some Perl modules in trigger code. If I change the underlying modules
that have been loaded, then when can I expect the new version to take
effect?

Initial testing seems to give me contrary results.
In some cases, creating a new DB then loading the same module in a new
stored procedure will get the old version.
But in some other cases, the new DB will pick up the new version of the
module.

I wondered if this might be due to the backend having a number of perl
interpreters in different processes, and I'm getting a fresh process
sometimes, and sometimes I'm getting an old one that's already loaded
the modules.


So.. I'm a bit confused and hoped I could come and ask for advice.

Thanks,
Toby

Re: pl/perl interpreter instance(s) - how long does it persist?

От
Tom Lane
Дата:
Toby Corkindale <toby.corkindale@strategicdata.com.au> writes:
> I would like to know how long the pl/perl interpreter instances persist?

Till end of session.

> Initial testing seems to give me contrary results.
> In some cases, creating a new DB then loading the same module in a new
> stored procedure will get the old version.
> But in some other cases, the new DB will pick up the new version of the
> module.

"Creating a DB" doesn't affect the current session ... where in there
did you reconnect?

            regards, tom lane

Re: pl/perl interpreter instance(s) - how long does it persist?

От
Toby Corkindale
Дата:
On 09/12/10 13:37, Tom Lane wrote:
> Toby Corkindale<toby.corkindale@strategicdata.com.au>  writes:
>> I would like to know how long the pl/perl interpreter instances persist?
>
> Till end of session.

Where session = connection (whether from psql, DBI, etc), yes?


>> Initial testing seems to give me contrary results.
>> In some cases, creating a new DB then loading the same module in a new
>> stored procedure will get the old version.
>> But in some other cases, the new DB will pick up the new version of the
>> module.
>
> "Creating a DB" doesn't affect the current session ... where in there
> did you reconnect?


To be honest, I'm not 100% sure I was reconnecting. I think I had it in
my head that the perl instance would be related to role or database, so
was creating new databases with new roles and testing code straight away.

I thought I tried reconnecting, since that's obvious too, and in my
limited local testing that seems to work; in staging/production environs
its trickier to bounce the apps, so maybe I haven't been restarting them
when I thought I was.

Thanks for the advice; it sounds like I have been missing the obvious
here, so will head off and do some more checking.

Thanks for the quick response!
Toby