Menu

#2519 (ok 2.11.1) NO_AUTO_VALUE_ON_ZERO and MySQL version

2.11.0
fixed
1
2013-06-11
2007-08-28
No

When exporting a table or database from a server with MySQL version 4.0.27 I get a file starting with the following content:
##### START #####
-- phpMyAdmin SQL Dump
-- version 2.11.0
-- http://www.phpmyadmin.net
--
-- Host: *****
-- Generation Time: Aug 29, 2007 at 12:05 AM
-- Server version: 4.0.27
-- PHP Version: 5.2.0

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
##### STOP #####

If I try to import this file on the same server I get the error:
"#1193 - Unknown system variable 'SQL_MODE'"

This is because the value "NO_AUTO_VALUE_ON_ZERO" was added in MySQL 4.1.1 (http://dev.mysql.com/doc/refman/4.1/en/server-sql-mode.html)

The code in libraries/export/sql.php doesn't check the MySQL server version:
##### START #####
/* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */
if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') {
$head .= $crlf . 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf;
}
##### STOP #####

Discussion

  • Marc Delisle

    Marc Delisle - 2007-08-29
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2007-08-30
    • priority: 5 --> 1
    • summary: NO_AUTO_VALUE_ON_ZERO not available in MySQL 4.0.x --> (ok 2.11.1) NO_AUTO_VALUE_ON_ZERO and MySQL version
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2007-09-20
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed