Archive

Monthly Archives: July 2010

I have installed dbi-link version 2.0.0 into my PostgreSQL 8.4 environment. The purpose is to query or modify remote mysql table from within postgresql user-defined-function. And whenever I try to insert/update/delete record into/from remote mysql table, I consistently get error message:
ERROR: error from Perl function “shadow_trigger_func”: Can’t call method “quote” on an undefined value at line 61
So i go to the mentioned function and found out sub functions: make_pairs, do_insert, do_update and do_delete try to access variables: $data_source_id and $table which are declared locally in main function.
Knowing that problem, I have modified parameter passing as follows:

Within main function:

if ($iud->{ $_TD->{new}{iud_action} }) {
   $iud->{ $_TD->{new}{iud_action} }->({
      payload => $_TD->{new},
      tbl => $table,
      source_id => $data_source_id
   });
}
else {
   die “Trigger event was $_TD->{new}{iud_action}<, but should have been one of I, U or D!"
}
And inside sub functions: modify $table and $data_source_id into $params->{tbl} and $params->{source_id}, respectively.
Advertisements