[Bucardo-general] How to skip a failing command ?

Greg Sabino Mullane greg at endpoint.com
Sun Jul 10 16:02:52 UTC 2011


On Tue, Jul 05, 2011 at 12:26:30PM +0300, Kiriakos Tsourapas wrote:
> Without knowing perl, I made the following change :
> 
> if ($g->{pkcols} > 1) {
>   $list .= sprintf '(%s),' => join ',' => map { s{\\}{\\\\}; qq{$_}; } @$row;
> }

Ah, I think I found the bug, and it won't require the change above. 
@$row comes from @srcdelete, which in turn is populated by @pkvals. That array 
is already escaped like so:

for my $pk (@{$info1->{$pkval}{BUCARDO_PKVALS}}) {
  if ($g->{pkeytype}[0] =~ /int$/o) {
    push @safepk => $pk;
  }
  else {
    (my $safepkval = $pk) =~ s/\'/''/go;
    $safepkval =~ s{\\}{\\\\}go;
    push @safepk => qq{'$safepkval'};
  }
}

However, at some point the data type normalizations were removed, so that 
it is now possible to have a pkeytype of 'int4', which I suspect is what 
is happening here. Try changing the regex in that line like so:

  if ($g->{pkeytype}[0] =~ /int\d?$/o) {

Two places need changing: line 5491 and line 5503. Here's the diff:

diff --git a/Bucardo.pm b/Bucardo.pm
index 5ca9bc6..3488bbc 100644
--- a/Bucardo.pm
+++ b/Bucardo.pm
@@ -5488,7 +5488,7 @@ sub start_kid {
                     ## We are manually building lists, so we may need to escape the pkeys
                     my @safepk;
                     if ($g->{pkcols} <= 1) {
-                        if ($g->{pkeytype}[0] =~ /int$/o) {
+                        if ($g->{pkeytype}[0] =~ /int\d?$/o) {
                             push @safepk => $pkval;
                         }
                         else {
@@ -5500,7 +5500,7 @@ sub start_kid {
                     else {
                         $x=0;
                         for my $pk (@{$info1->{$pkval}{BUCARDO_PKVALS}}) {
-                            if ($g->{pkeytype}[0] =~ /int$/o) {
+                            if ($g->{pkeytype}[0] =~ /int\d?$/o) {
                                 push @safepk => $pk;
                             }
                             else {

I'll spin up a version 4.4.6 with this fix shortly. Thanks for the original 
report and persisting with feedback.

-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20110710/7058ea90/attachment.bin 


More information about the Bucardo-general mailing list