Brandon Metcalf wrote: > Here is an example of the caching problem I described yesterday in a > post. I have the following tables: > And here is the SQL for the function and trigger definitions: > > CREATE OR REPLACE FUNCTION bmetcalf.foo_func() > RETURNS TRIGGER > LANGUAGE plperlu > AS $$ > require 5.8.0; > > my $table = $_TD->{relname}; > warn "table name is $table"; > warn "BWM before call: table name is $table"; > > do_delete(); > > return 'SKIP'; > > sub do_delete { > warn "BWM in call: table name is $table"; > } > > $$; Umm - you've got a named closure inside your funciton here - "sub do_delete". It's warning isn't using the "my $table" variable, it's using a localised copy of that variable. That gets defined when the sub is defined, which will be on the first call (my $table=foo2) and still exists, unchanged on the second call (my $table=foo1). Warning - can't remember if I'm using the right terminology on the above, although I think it's the right diagnosis. -- Richard Huxton Archonet Ltd -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general