Bug #54893 select .. into dumpfile can write 2 rows into the file instead of 1
Submitted: 29 Jun 2010 9:57 Modified: 29 Jun 2010 10:03
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.48 OS:Any
Assigned to: CPU Architecture:Any

[29 Jun 2010 9:57] Shane Bester
Description:
http://dev.mysql.com/doc/refman/5.5/en/select.html
"If you use INTO DUMPFILE instead of INTO OUTFILE, MySQL writes only one row into the file, without any column or line termination and without performing any escape processing."

However, the following proves that two rows can be written out to file a.txt
whereas 3 or more fails with error.

mysql> create table t1(a int)engine=myisam;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values (1),(2);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from t1 into dumpfile 'a.txt';
Query OK, 2 rows affected (0.00 sec)

mysql> insert into t1 values (3);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1 into dumpfile 'b.txt';
ERROR 1172 (42000): Result consisted of more than one row

I think both the selects should yield an error, and they should only
write 1 row, not two concatted rows.

How to repeat:
drop table if exists t1;
create table t1(a int)engine=myisam;
insert into t1 values (1),(2);
select * from t1 into dumpfile 'a.txt';
insert into t1 values (3);
select * from t1 into dumpfile 'b.txt';
[29 Jun 2010 10:03] Valeriy Kravchuk
Verified just as described.