Bug #44874 | select into outfile exports wrong integer width | ||
---|---|---|---|
Submitted: | 14 May 2009 11:56 | Modified: | 18 May 2009 13:05 |
Reporter: | Marcus Mueller | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.0, 5.1, 6.0 | OS: | Linux (debian 7) |
Assigned to: | CPU Architecture: | Any |
[14 May 2009 11:56]
Marcus Mueller
[14 May 2009 12:39]
MySQL Verification Team
Thank you for the bug report. Could you please try with the latest released version and if you still get the same behavior provide a dump file with create table and some insert statements. Thanks in advance.
[14 May 2009 13:08]
Marcus Mueller
here the create script: CREATE TABLE `diabt1_dok` ( `MD_INDEX` int(10) unsigned NOT NULL auto_increment, `MD_VERSION` int(2) unsigned zerofill NOT NULL default '00', `KVBEREICH` char(2) NOT NULL default '', `DATENSTELLE_IK` varchar(9) NOT NULL default '', `DATEINAME` varchar(11) NOT NULL default '', `KZ_LIEFERUNG` int(1) NOT NULL default '0' `MD_TS` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`MD_INDEX`) ) ENGINE=MyISAM AUTO_INCREMENT=34182 DEFAULT CHARSET=latin1 COMMENT=''; the table is same to the table on mysql server 4.x ... data was migrated to 5.0.32 ...
[15 May 2009 7:23]
Marcus Mueller
i found a hint ... the problem is the "fields terminated by ''" statement. if i replace it with "fields terminated by '#'" the correct width of the integer values is dumped to the file. is this issue known allready?
[15 May 2009 7:55]
Marcus Mueller
I was wrong ... the terminated ('#') export correctly exports the integer values with correct length int(2) as #02# ... problem is i need a fixed length export. so i use "terminated by ''" ... but when i do so, the int(2) field is exported as '02 ' like an int(11) ... any suggestions?
[18 May 2009 13:05]
Susanne Ebrecht
Verfied as described: CREATE TABLE t(i integer, k integer); CREATE TABLE t1(i int(2), k int(2)); INSERT INTO t VALUES(1,1),(2,2),(3,3),(4,4); INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4); SELECT * FROM t INTO OUTFILE 'foo_t_terminated_with_nothing' FIELDS TERMINATED BY ''; SELECT * FROM t INTO OUTFILE 'foo_t_terminated_with_something' FIELDS TERMINATED BY '|'; SELECT * FROM t1 INTO OUTFILE 'foo_t1_terminated_with_nothing' FIELDS TERMINATED BY ''; SELECT * FROM t1 INTO OUTFILE 'foo_t1_terminated_with_something' FIELDS TERMINATED BY '|'; $ less foo_TABLE_terminated_with_nothing You have 10 spaces between the first and next value $ less foo_TABLE_terminated_with_something None spaces between first and next value .... Unfortunately when length was given in table it will be ignored here too and in stead of "1 " output is "1".
[16 May 2010 11:17]
Richard C
Hi I found the same bug reported (Bug #1806 SELECT INTO OUTFILE) It was reported in 2003 and is marked as won't fix. I think this bug should be re-looked at and fixed. I can't imagine that it is a difficult fix!!
[1 Sep 2011 14:50]
Marcelo Gomes
Obrigado ! Funcionou corretamente.