Re: example of really weird caching (or whatever) problem

Поиск
Список
Период
Сортировка
От Brandon Metcalf
Тема Re: example of really weird caching (or whatever) problem
Дата
Msg-id Pine.LNX.4.58L.0811200929110.13425@cash.us.nortel.com
обсуждение исходный текст
Ответ на Re: example of really weird caching (or whatever) problem  (Richard Huxton <dev@archonet.com>)
Ответы Re: example of really weird caching (or whatever) problem  ("Brandon Metcalf" <bmetcalf@nortel.com>)
Re: example of really weird caching (or whatever) problem  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
d == dev@archonet.com writes:

 d> Brandon Metcalf wrote:
 d> > Yep, it seems that's the problem.  If I pass in $table and use a
 d> > lexical variable defined inside do_delete(), the problem goes away.
 d> > So, this is where my understanding of how triggers work lacks.  For a
 d> > given session, each execution of a trigger isn't completely
 d> > independent?

 d> Nothing to do with triggers - it's all to do with your Perl code.


I respectfully disagree because if I don't execute a DELETE on foo2 as
shown in my original email, the problem doesn't occur.  Somewhere in
the trigger execution it's remembering the first table on which the
trigger fired.  So, the information about foo2 is coming from
somewhere and it's in the Perl code.  In other words, I performing two
different DELETEs which cause two different invocations of the same
trigger.


 d> #!/usr/bin/perl

 d> sub foo {
 d>     my $x = shift;
 d>     print "foo x = $x\n";
 d>     bar();
 d>     return;

 d>     sub bar {
 d>         print "bar x = $x\n";
 d>     }
 d> }

 d> foo(1);
 d> foo(2);
 d> exit;

 d> $ ./perl_example.pl
 d> foo x = 1
 d> bar x = 1
 d> foo x = 2
 d> bar x = 1

 d> If you use warnings it'll tell you about it too with this example.



--
Brandon

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: example of really weird caching (or whatever) problem
Следующее
От: "Brandon Metcalf"
Дата:
Сообщение: Re: example of really weird caching (or whatever) problem