-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
For the same reason SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO' is included in export / import operations it needs to precede the INSERT INTO statement that copies table data. Here's a diff of my modification that solves the problem.
diff -bu Table.class-orig.php Table.class.php
--- Table.class-orig.php 2011-12-01 11:21:14.000000000 -0600
+++ Table.class.php 2011-12-13 03:41:06.536499576 -0600
@@ -775,6 +775,10 @@
// Copy the data unless this is a VIEW
if (($what == 'data' || $what == 'dataonly') && ! PMA_Table::_isView($target_db,$target_table)) {
-
$sql_set_mode = -
"SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'"; -
PMA_DBI_query($sql_set_mode); -
$GLOBALS['sql_query'] .= "\n\n" . $sql_set_mode . ';';
$sql_insert_data =
'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
PMA_DBI_query($sql_insert_data);
Not that it matters much in this case, here are relevant apps and versions:
Linux lindev2 3.1.0-1-686-pae #1 SMP Mon Nov 14 08:24:20 UTC 2011 i686 GNU/Linux
PHP extension: mysqli
PHP 5.3.8
MySQL sever 5.1.52
MySQL client 5.1.58
Apache/2.2.21 (Debian)
- Original URL: https://sourceforge.net/p/phpmyadmin/patches/698/
- Original author: glennh-satx