Description:
SELECT * INTO OUTFILE crashes for some tables in MySQL 4.1
How to repeat:
CREATE TABLE t (
t timestamp NOT NULL,
c char(200) character set latin1 NOT NULL default '',
KEY t (t)
) TYPE=MyISAM;
INSERT INTO t VALUES ('2002-12-20 12:01:20','');
INSERT INTO t VALUES ('2002-12-20 12:01:20','');
INSERT INTO t VALUES ('2002-12-20 12:01:20','');
INSERT INTO t VALUES ('2002-12-20 12:01:21','');
INSERT INTO t VALUES ('2002-12-20 12:01:21','');
INSERT INTO t VALUES ('2002-12-20 12:01:21','');
INSERT INTO t VALUES ('2002-12-20 12:01:22','');
INSERT INTO t VALUES ('2002-12-20 12:01:22','');
INSERT INTO t VALUES ('2002-12-20 12:01:22','');
INSERT INTO t VALUES ('2002-12-20 12:01:22','');
INSERT INTO t VALUES ('2002-12-20 12:01:23','');
INSERT INTO t VALUES ('2002-12-20 12:01:23','');
INSERT INTO t VALUES ('2002-12-20 12:01:23','');
INSERT INTO t VALUES ('2002-12-20 12:01:23','');
INSERT INTO t VALUES ('2002-12-20 12:01:24','');
INSERT INTO t VALUES ('2002-12-20 12:01:24','');
INSERT INTO t VALUES ('2002-12-20 12:01:24','');
INSERT INTO t VALUES ('2002-12-20 12:01:25','');
INSERT INTO t VALUES ('2002-12-20 12:01:25','');
INSERT INTO t VALUES ('2002-12-20 12:01:25','');
INSERT INTO t VALUES ('2002-12-20 12:01:25','');
INSERT INTO t VALUES ('2002-12-20 12:01:26','');
INSERT INTO t VALUES ('2002-12-20 12:01:26','');
INSERT INTO t VALUES ('2002-12-20 12:01:26','');
INSERT INTO t VALUES ('2002-12-20 12:01:27','');
INSERT INTO t VALUES ('2002-12-20 12:01:27','');
INSERT INTO t VALUES ('2002-12-20 12:01:27','');
INSERT INTO t VALUES ('2002-12-20 12:01:28','');
INSERT INTO t VALUES ('2002-12-20 12:01:28','');
INSERT INTO t VALUES ('2002-12-20 12:01:28','');
INSERT INTO t VALUES ('2002-12-20 12:01:28','');
INSERT INTO t VALUES ('2002-12-20 12:01:29','');
INSERT INTO t VALUES ('2002-12-20 12:01:29','');
INSERT INTO t VALUES ('2002-12-20 12:01:29','');
INSERT INTO t VALUES ('2002-12-20 12:01:29','');
INSERT INTO t VALUES ('2002-12-20 12:01:30','');
INSERT INTO t VALUES ('2002-12-20 12:01:30','');
INSERT INTO t VALUES ('2002-12-20 12:01:30','');
INSERT INTO t VALUES ('2002-12-20 12:01:31','');
INSERT INTO t VALUES ('2002-12-20 12:01:31','');
INSERT INTO t VALUES ('2002-12-20 12:01:31','');
INSERT INTO t VALUES ('2002-12-20 12:01:31','');
INSERT INTO t VALUES ('2002-12-20 12:01:32','');
INSERT INTO t VALUES ('2002-12-20 12:01:32','');
INSERT INTO t VALUES ('2002-12-20 12:01:32','');
mysql> select * from t into outfile "/tmp/fdg";
Suggested fix:
*** /tmp/field.cc-1.91-17903 Thu Dec 19 13:27:44 2002
--- edited/sql/field.cc Thu Dec 26 20:43:00 2002
***************
*** 2845,2850 ****
--- 2845,2851 ----
val_buffer->alloc(field_length+1);
char *to=(char*) val_buffer->ptr(),*end=to+field_length;
val_buffer->length(field_length);
+ val_buffer->set_charset(val_ptr->charset());
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)