~percona-toolkit-dev/percona-toolkit/fix-1062563-1063912-ptc-pxc-bugs

« back to all changes in this revision

Viewing changes to bin/pt-query-advisor

Merge fix-978133-remove-pqd-priv-checks

Show diffs side-by-side

added added

removed removed

Lines of Context:
5490
5490
      return 0;
5491
5491
   }
5492
5492
 
5493
 
   PTDEBUG && _d('Table exists; no privs to check');
5494
 
   return 1 unless $args{all_privs};
5495
 
 
5496
 
   $sql = "SHOW FULL COLUMNS FROM $db_tbl";
5497
 
   PTDEBUG && _d($sql);
5498
 
   eval {
5499
 
      $row = $dbh->selectrow_hashref($sql);
5500
 
   };
5501
 
   if ( $EVAL_ERROR ) {
5502
 
      PTDEBUG && _d($EVAL_ERROR);
5503
 
      return 0;
5504
 
   }
5505
 
   if ( !scalar keys %$row ) {
5506
 
      PTDEBUG && _d('Table has no columns:', Dumper($row));
5507
 
      return 0;
5508
 
   }
5509
 
   my $privs = $row->{privileges} || $row->{Privileges};
5510
 
 
5511
 
   $sql = "DELETE FROM $db_tbl LIMIT 0";
5512
 
   PTDEBUG && _d($sql);
5513
 
   eval {
5514
 
      $dbh->do($sql);
5515
 
   };
5516
 
   my $can_delete = $EVAL_ERROR ? 0 : 1;
5517
 
 
5518
 
   PTDEBUG && _d('User privs on', $db_tbl, ':', $privs,
5519
 
      ($can_delete ? 'delete' : ''));
5520
 
 
5521
 
   if ( !($privs =~ m/select/ && $privs =~ m/insert/ && $privs =~ m/update/
5522
 
          && $can_delete) ) {
5523
 
      PTDEBUG && _d('User does not have all privs');
5524
 
      return 0;
5525
 
   }
5526
 
 
5527
 
   PTDEBUG && _d('User has all privs');
 
5493
   PTDEBUG && _d('Table', $db, $tbl, 'exists');
5528
5494
   return 1;
 
5495
 
5529
5496
}
5530
5497
 
5531
5498
sub get_engine {