DBI->data_sources("Pg") problem

[email protected] (Laslo Forro)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
Hi there,
I am trying to get the databases from a running PostgreSQL database.
However, this piece of code gives nothing:
my @dbs=DBI->data_sources("Pg)";
I tried to trace the situation and ended up here in DBI module:

DBD::Pg::dr::data_sources(/home/salmonix/perl5/lib/perl5/x86_64-linux-thread-multi/DBD/Pg.pm:189):
189: my $SQL = 'SELECT pg_catalog.quote_ident(datname) FROM
pg_catalog.pg_database ORDER BY 1';
190: my $sth = $dbh->prepare($SQL);
191: $sth->execute() or die $DBI::errstr;
192: $attr and $attr = ";$attr";
193: my @sources = map { "dbi:Pg:dbname=$_->[0]$attr" }
@{$sth->fetchall_arrayref()};
(happens 6 times)
194: $dbh->disconnect;
195: return @sources;

At this point I check @sources, if that returns what is expected:
  DB<2> x \@sources
0  ARRAY(0x3167a68)
   0  'dbi:Pg:dbname=postgres'
   1  'dbi:Pg:dbname=template0'
   2  'dbi:Pg:dbname=template1'
   3  'dbi:Pg:dbname=test'

So far so good. Step on.

  DB<3> s
DBI::data_sources(/home/salmonix/perl5/lib/perl5/x86_64-linux-thread-multi/DBI.pm:1043):
1043:    return @ds;
  DB<3> v
1040:    my ($class, $driver, @other) = @_;
1041:    my $drh = $class->install_driver($driver);
1042:    my @ds = $drh->data_sources(@other);
1043==>    return @ds;
1044 }

Check @ds:

  DB<3> x \@ds
0  ARRAY(0x20cd0e8)
     empty array
  DB<4>

And this empty array is returned to my programline. ?????????????
Could anyone give me any idea why?

Installation is in users local folder, with

export MODULEBUILDRC="/home/salmonix/perl5/.modulebuildrc"
export PERL_MM_OPT="INSTALL_BASE=/home/salmonix/perl5"
export
PERL5LIB="/home/salmonix/perl5/lib/perl5/x86_64-linux-thread-multi:/home/salmonix/perl5/lib/perl5"
export PATH="/home/salmonix/perl5/bin:$PATH"
export MANPATH="/home/salmonix/perl5/man:$MANPATH"
export INSTALL_BASE="/home/salmonix/perl5"

in .bashrc.
User 'user' - the owner of the script - has right to connect to the
PostgreSQL database, create database etc.
Using Perl 5.12. on Gentoo amd64.

Thanx!
Laslo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.