[Bucardo-general] Not able to specify internal db name

dmitriy kultashev dkultashev at intersog.com
Thu Jul 7 05:40:31 UTC 2011


Hello,
I tried to create new database in bucardo 5 and specify internal name by
following command:
bucardo add db real_db_name name=internal_db_name type=postgres port=5432
host=localhost

and I got following error:
DBD::Pg::st execute failed: ERROR:  Error: Could not find a database with a
name of test
CONTEXT:  PL/Perl function "db_getconn" at /usr/local/bin/bucardo line 844.

However it worked fine if I wouldn't specify internal name. By default it
was inserting internal name as real_db_name:
bucardo add db real_db_name type=postgres port=5432 host=localhost

I checked the source code and found out that it is soing:
    my $item_name = shift @nouns || '';
...
        $SQL = 'SELECT bucardo.db_getconn(?)';
        $sth = $dbh->prepare($SQL);
        $count = $sth->execute($item_name);

and in bucardo.db_getconn we have:
$SQL = "SELECT * FROM bucardo.db WHERE name = '$name'";
$rv = spi_exec_query($SQL);
if (!$rv->{processed}) {
    elog(ERROR, qq{Error: Could not find a database with a name of
$name\n});
}

So, it is passing the real_db_name and in procedure is checking
internal_db_name.

Attached the changed source code.

BR,
Dmitrij Kultasev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20110707/e6789044/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bucardo
Type: application/octet-stream
Size: 272990 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20110707/e6789044/attachment-0001.obj 


More information about the Bucardo-general mailing list