pl/perl function life and variable scope - concurrency problem?

Поиск
Список
Период
Сортировка
От Christopher Murtagh
Тема pl/perl function life and variable scope - concurrency problem?
Дата
Msg-id 1068667533.879.105.camel@mafalda.murtagh.name
обсуждение исходный текст
Ответы Re: pl/perl function life and variable scope - concurrency problem?  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Список pgsql-general
 Greetings,

 Thanks to a lot of help on this list, I've managed to get my pl/perl
function working. However, I have an unexpected result. Here's a simple
way to reproduce this problem:

CREATE or REPLACE FUNCTION perltest(integer)
returns integer as '
  $MyInt = $MyInt + 1;
  return $MyInt;
' language plperlu;


Executing it produces:

chris=# select perltest(1);
 perltest
----------
        1
(1 row)

chris=# select perltest(1);
 perltest
----------
        2
(1 row)

chris=# select perltest(1);
 perltest
----------
        3
(1 row)

chris=# select perltest(1);
 perltest
----------
        4
(1 row)

 Doing the right thing and initialzing variables before using them
solves this. Should I worry about this? Are concurrent callings of this
function protected from each other?

 Any info would be much appreciated.

Cheers,

Chris


--
Christopher Murtagh
Enterprise Systems Administrator
ISR / Web Communications Group
McGill University
Montreal, Quebec
Canada

Tel.: (514) 398-3122
Fax:  (514) 398-2017

В списке pgsql-general по дате отправления:

Предыдущее
От: Hans-Jürgen Schönig
Дата:
Сообщение: Re: [HACKERS] Proposal for a cascaded master-slave replication system
Следующее
От: Greg Stark
Дата:
Сообщение: Re: using NOLOCK cause Cartesian joins