[check_postgres] Problems with connect_database() in bucardo_ctl

dmitriy kultashev dkultashev at intersog.com
Fri Jun 24 09:25:44 UTC 2011


Hello!
I do not know what happened but I got the problem executing following
command:
bucardo_ctl add all tables standard_conflict=latest herd=herdName --verbose
db=dbName
Error was:
Can't call method "prepare" on an undefined value at
/usr/local/bin/bucardo_ctl line 3621.

I started to investigate the source code and found that the problem was
here:
sub connect_database {
    ## Connect to a datbase and return a dbh
    my $dbh2;
    my $opt = shift || {};
    if (exists $opt->{name}) {
        $SQL = qq{SELECT bucardo.db_getconn('$opt->{name}')};
        my $conn = $dbh->selectall_arrayref($SQL)->[0][0];
*         my ($dsn,$user,$pass) = split /\n/ => $conn;*
        eval {
*            $dbh2 = DBI->connect_cached($dsn, $user, $pass,
{AutoCommit=>0,RaiseError=>1,PrintError=>0});*
        };
...
    }

I checked the bucardo.connect_cached function and found there:

if ($dbtype eq 'postgres') {
...
*    return "$dbtype\n$connstring\n$db{user}\n$db{pass}\n$ssp";*
} ## end postgres

So, if I do *my ($dsn,$user,$pass) = split /\n/ => $conn; *it supposed to
put to $dsn = 'postgres'.
I did work around as *my ($dump,$dsn,$user,$pass) = split /\n/ => $conn; *but
could you please explain how was it working previously?

Thanks,
Dmitrij
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/check_postgres/attachments/20110624/8c4c685d/attachment.html 


More information about the Check_postgres mailing list