Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



d == dev@xxxxxxxxxxxx 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux