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

Bug #1462904 reported by Nilnandan Joshi on 2015-06-08
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:~$

description: updated
tags: added: i55250
Changed in percona-toolkit:
status: New → Confirmed

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)/ ) {

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

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  Edit
Everyone can see this information.

Other bug subscribers