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

From: Richard Huxton <dev(at)archonet(dot)com>
To: Brandon Metcalf <bmetcalf(at)nortel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: example of really weird caching (or whatever) problem
Date: 2008-11-20 15:20:05
Message-ID: 49258025.5060101@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Metcalf 2008-11-20 15:32:17 Re: example of really weird caching (or whatever) problem
Previous Message Brandon Metcalf 2008-11-20 14:53:41 Re: example of really weird caching (or whatever) problem