pt-duplicate-key-checker doesn't support triple quote in column name

Bug #1462904 reported by Nilnandan Joshi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
Medium
Daniel Nichter

Bug Description

mysql> CREATE TABLE order_new (
    -> `id` int(20) DEFAULT NULL,
    -> `code` varchar(20) DEFAULT NULL,
    -> `date` datetime DEFAULT NULL,
    -> ```Size_Change``` double(6,4) NOT NULL DEFAULT '0.0000',
    -> `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
    -> KEY `indx_updated` (`updated`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
nilnandan@desktop:~$ pt-duplicate-key-checker
Can't determine column type for ```size_change``` double(6,4) not null default '0.0000' at /usr/bin/pt-duplicate-key-checker line 360.
nilnandan@desktop:~$

Workaround can be,

nilnandan@desktop:~$ pt-duplicate-key-checker --ignore-tables=order_new
# ########################################################################
# Summary of indexes
# ########################################################################

# Total Indexes 55
nilnandan@desktop:~$

Tags: i55250
description: updated
tags: added: i55250
Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

I can suggested some stupid straightforward patch:

[openxs@chief percona-toolkit-2.2]$ bzr diff
=== modified file 'bin/pt-duplicate-key-checker'
--- bin/pt-duplicate-key-checker 2015-01-23 10:19:56 +0000
+++ bin/pt-duplicate-key-checker 2015-06-08 08:54:54 +0000
@@ -356,7 +356,12 @@
    my (%type_for, %is_nullable, %is_numeric, %is_autoinc);
    foreach my $col ( @cols ) {
       my $def = $def_for{$col};
- my ( $type ) = $def =~ m/`[^`]+`\s([a-z]+)/;
+ my ( $type );
+ ($type) = $def =~ m/`[^`]+`\s([a-z]+)/;
+ unless ($type) {
+ ($type) = $def =~ m/```[^`]+```\s([a-z]+)/;
+ }
+# my ( $type ) = $def =~ m/`[^`]+`\s([a-z]+)/;
       die "Can't determine column type for $def" unless $type;
       $type_for{$col} = $type;
       if ( $type =~ m/(?:(?:tiny|big|medium|small)?int|float|double|decimal|year)/ ) {

Revision history for this message
Daniel Nichter (daniel-nichter) wrote :
Changed in percona-toolkit:
importance: Undecided → Medium
status: Confirmed → Fix Committed
assignee: nobody → Daniel Nichter (daniel-nichter)
Changed in percona-toolkit:
milestone: none → 2.2.15
Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-687

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.