diff options
-rw-r--r-- | LedgerSMB/DBObject.pm | 15 | ||||
-rw-r--r-- | LedgerSMB/Sysconfig.pm | 1 | ||||
-rw-r--r-- | ledgersmb.conf.default | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 40d621c5..6a44fde8 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -104,9 +104,18 @@ sub exec_method { @in_args = @{ $args{args}} if $args{args}; my @call_args; - my $query = "SELECT proname, pronargs, proargnames FROM pg_proc WHERE proname = ?"; - my $sth = $self->{dbh}->prepare($query); - $sth->execute($funcname) || $self->error($DBI::errstr . "in exec_method"); + my $query = " + SELECT proname, pronargs, proargnames FROM pg_proc + WHERE proname = ? + AND pronamespace = + coalesce((SELECT oid FROM pg_namespace WHERE nspname = ?), + pronamespace) + "; + my $sth = $self->{dbh}->prepare( + $query + ); + $sth->execute($funcname, $LedgerSMB::Sysconfig::db_namespace) + || $self->error($DBI::errstr . "in exec_method"); my $ref; $ref = $sth->fetchrow_hashref('NAME_lc'); diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm index 45304eb0..ed27c176 100644 --- a/LedgerSMB/Sysconfig.pm +++ b/LedgerSMB/Sysconfig.pm @@ -138,5 +138,6 @@ for $var (qw(DBhost DBport DBname DBUserName DBPassword)) { $ENV{PGHOST} = $config{database}{host}; $ENV{PGPORT} = $config{database}{port}; our $default_db = $config{database}{default_db}; +our $db_namespace = $config{database}{db_namespace}; 1; diff --git a/ledgersmb.conf.default b/ledgersmb.conf.default index 2440912d..4fd3d54c 100644 --- a/ledgersmb.conf.default +++ b/ledgersmb.conf.default @@ -52,3 +52,4 @@ Epson = lpr -PEpson port = 5432 default_db = lsmb13 host = localhost +db_namespace = public |