[Bucardo-general] [SOLVED] b5 / pg84 : "arguments of row IN must all be row expressions"

Bill McGonigle bill at bfccomputing.com
Fri Sep 28 15:26:37 UTC 2012


On 09/25/2012 11:51 PM, Greg Sabino Mullane wrote:
> Give it a whirl and let us know if this fixes it please.

Thanks for the patch and the perl wisdom, Greg.  Such a bad default - I've got some of my own code to fix, now!

The patch does appear to handle the case I reported.  Thanks.

My data seems to have found what appears to be a similar case.  On the current git pull, it's flagging line 8104:

    my $res = $t->{deletesth}->execute($SQL{ANYargs}->[$loop-1]);

with: 

Sep 28 09:30:34 database3 Bucardo[9240]: KID Warning! Aborting due to exception for public.item:? Error was Invalid array - all arrays must be of equal size at /usr/lib/perl5/site_perl/5.8.8/Bucardo.pm line 8104. 

With a little debugging code before that execute, I see (blinded):

Sep 28 09:47:30 database3 Bucardo[11700]: KID ERROR TRACKING: "/* Bucardo 4.99.5 */DELETE FROM public.item WHERE id = ANY(?) $BUCARDO1 = [   [     'FOO'   ],   [],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'   ],   [     'FOO'  

The second element in that array is [], not [ '' ].  Sure enough deleting these two rows allows things to continue:

ecommerce=# select * from bucardo.delta_public_item where id = '';
 id |            txntime            
----+-------------------------------
    | 2012-09-28 03:54:01.509443-04
    | 2012-09-28 03:54:01.621715-04
(2 rows)


The  split() at my line 8014 has the '-1', as appropriate:

   push @{$SQL[$round]} => [split '\0', $key, -1];

Since this is a single column primary key, I think it's taking the optimized code path, which leads back to the initial join on [''] with '\0'.  Some test code:

  use Data::Dumper;
  $Data::Dumper::Useqq = 1;

  my @foo = ('');
  print "foo: " . Dumper(\@foo);

  my $foo_string  = join "\0" => @foo;
  print "foo_string: " . Dumper( $foo_string );

  @foo = split "\0", $foo_string, -1;
  print "foo: " . Dumper (\@foo);
 
  my @bar = ('','');
  print "bar: " . Dumper(\@bar);

  my $bar_string = join "\0" => @bar;
  print "bar_string: " . Dumper ( $bar_string );

  @bar = split "\0", $bar_string, -1;
  print "bar: " . Dumper( \@bar );
 
  my @baz = ('b');
  print "baz: " . Dumper( \@baz );

  my $baz_string = join "\0" => @baz;
  print "baz string: " . Dumper ( $baz_string );

  @baz = split "\0", $baz_string, -1;
  print "baz: " . Dumper ( \@baz );

and the output:

  foo: $VAR1 = [
          ""
        ];
  foo_string: $VAR1 = "";
  foo: $VAR1 = [];
  bar: $VAR1 = [
          "",
          ""
        ];
  bar_string: $VAR1 = "\0";
  bar: $VAR1 = [
          "",
          ""
        ];
  baz: $VAR1 = [
          "b"
        ];
  baz string: $VAR1 = "b";
  baz: $VAR1 = [
          "b"
        ];

I think what we need here is a way for join('\0',('')) to respect the leading whitespace but I didn't see one documented.  I suppose special-casing it with a myJoin() is possible, but a bit ghetto.  I'm sure you'll have a more elegant idea.

-Bill 

-- 
Bill McGonigle, Owner   
BFC Computing, LLC       
http://bfccomputing.com/ 
Telephone: +1.855.SW.LIBRE
Email, IM, VOIP: bill at bfccomputing.com           
VCard: http://bfccomputing.com/vcard/bill.vcf
Social networks: bill_mcgonigle/bill.mcgonigle


More information about the Bucardo-general mailing list