Bug #66257 | LOAD DATA INFILE issues after update Mysql from 5.3.6 to 5.5.25a | ||
---|---|---|---|
Submitted: | 8 Aug 2012 8:51 | Modified: | 8 Aug 2012 17:22 |
Reporter: | Narbot Vincent | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.5.25a | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[8 Aug 2012 8:51]
Narbot Vincent
[8 Aug 2012 9:27]
Valeriy Kravchuk
Please, send the output of: show create table Import_Table\G from mysql command line client.
[8 Aug 2012 11:53]
Narbot Vincent
CSV file
Attachment: Report.csv (application/vnd.ms-excel, text), 13 bytes.
[8 Aug 2012 11:53]
Narbot Vincent
php programm to import the data
Attachment: index.php (application/octet-stream, text), 964 bytes.
[8 Aug 2012 11:55]
Narbot Vincent
I created a database my_base_temp with the table ... CREATE TABLE IF NOT EXISTS `import_table` ( `Text_1` varchar(5) NOT NULL, `Inte_1` int(8) NOT NULL, `Inte_2` int(8) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; I sent 2 files : the csv file and the PHP programm to execute the LOAD DATA INFILE instruction.
[8 Aug 2012 12:25]
Peter Laursen
Let us discard PHP for the disucssion. This is about SQL and not a specific client environment. On the SQL statement LOAD DATA INFILE 'Report.csv' INTO TABLE import_table FIELDS TERMINATED BY ';' .. I get the warning (in non-strict mode using MySQL 5.5.23): "Incorrect integer value: '' for column 'Inte_1' at row 2;". Data get inserted as Text_1 Inte_1 Inte_2 ------ ------ -------- AA 1 2 0 3 Everything is as expected as far as I can see. 'empty string' in 2nd line and 2nd position of your file gets truncated and inserts as "0" to the `Inte_1` column (with a warning). Maybe you are running another sql_mode with the new server than before (strict mode now - non-strict mode before)? Peter (not a MySQL/Oracle person)
[8 Aug 2012 13:08]
Narbot Vincent
In the my.ini file, I put in comments the line #sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" and I have now the same result as you. I did not know this variable, and it was not present in the previous version which I used. Thank you
[8 Aug 2012 13:40]
Peter Laursen
If you have a strict mode, I believe that you will get an *error* and not a *warning* and data from the file will not insert completely. 'empty string' cannot be converted to "0" in strit mode.
[8 Aug 2012 17:22]
Sveta Smirnova
Thank you for help, Peter. Report closed as "Not a Bug".