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

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: example of really weird caching (or whatever) problem
Дата
Msg-id 49258025.5060101@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  ("Brandon Metcalf" <bmetcalf@nortel.com>)
Список pgsql-general
Brandon Metcalf wrote:
> Yep, it seems that's the problem.  If I pass in $table and use a
> lexical variable defined inside do_delete(), the problem goes away.
> So, this is where my understanding of how triggers work lacks.  For a
> given session, each execution of a trigger isn't completely
> independent?

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

#!/usr/bin/perl

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

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

foo(1);
foo(2);
exit;

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

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

--
  Richard Huxton
  Archonet Ltd

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

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