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

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: example of really weird caching (or whatever) problem
Дата
Msg-id 4925785D.1060306@archonet.com
обсуждение исходный текст
Ответ на 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:
> 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

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

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