Menu

#4386 (ok 4.2.2) Export with AUTO_INCREMENT column fails to import

4.2.0
fixed
None
1
2014-05-21
2014-05-07
No

Create a table with a primary key and AUTO_INCREMENT column.
Copy this table.
In MySQL 5.0 you get an error that its not possible to create a AI with no key
in MySQL 5.6 it ignores this problem and doesn't add at the AI property to the column.

I think the problem is that phpmyadmin changed the export from primary key in the create statement to a separated sql query (alter table add primary)

Discussion

  • Marc Delisle

    Marc Delisle - 2014-05-21

    In the title, you talk about Export/Import. In the report, you talk about Copy (I assume Operations/copy). Which one is your problem?

    Also, MySQL 5.0 is too old for this phpMyAdmin version (5.5 is the documented minimum version). I tried with phpMyAdmin 4.2.2 and MySQL 5.6.15, and could not reproduce this bug. Please attach an export of your table's structure.

     
  • Harald Leithner

    Harald Leithner - 2014-05-21

    I think the export and the copy function uses the same method to create the sql statement.

    The export of a table with a primary key ends in this:

    --
    -- Tabellenstruktur für Tabelle `test`
    --
    
    CREATE TABLE IF NOT EXISTS `test` (
      `id` int(11) NOT NULL auto_increment,
      `test` int(11) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    
    --
    -- Indexes for dumped tables
    --
    
    --
    -- Indexes for table `test`
    --
    ALTER TABLE `test`
     ADD PRIMARY KEY  (`id`);
    

    You see that the table create statement is without the PRIMARY KEY, this leads mysql to ignore the auto_increment statement.

     
  • Marc Delisle

    Marc Delisle - 2014-05-21

    In my test with version 4.2.2, after this ALTER TABLE statement, another one is generated, which takes care of the AUTO_INCREMENT part.

     
  • Harald Leithner

    Harald Leithner - 2014-05-21

    Ok it seams to be a problem of mysql 5.0, I tested it again on 5.6 and it worked.

    phpmyadmin doesn't support mysql anymore 5.0 so it think you wouldn't fix it correct?

    Not a real problem for me I like 3.5.8.1 more then 4.x and migration to 5.6 is on its way.

     
  • Marc Delisle

    Marc Delisle - 2014-05-21

    Correct, it won't be fixed for MySQL 5.0 (see explanations on http://www.phpmyadmin.net/home_page/downloads.php).

     
  • Marc Delisle

    Marc Delisle - 2014-05-21
    • summary: Export with AUTO_INCREMENT column fails to import --> (ok 4.2.2) Export with AUTO_INCREMENT column fails to import
    • status: open --> fixed
    • assigned_to: Marc Delisle
    • Priority: 8 --> 1