Bug #13602 LOAD DATA INFILE Windows pipe
Submitted: 29 Sep 2005 11:22 Modified: 11 Oct 2005 16:31
Reporter: Sela Lerer Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.11 OS:Windows (Windows 2000)
Assigned to: MySQL Verification Team CPU Architecture:Any

[29 Sep 2005 11:22] Sela Lerer
Description:
When a LOAD DATA INFILE query is sent with a Windows pipe name, the name is either:
- parsed by the MySQL server of MySQL client library in a faulty way so that a pipe name '//./pipe/pipeName' is tarnsformed to '//pipe/pipeName/'.
- opened with a Windows API call that can not open pipes (only files).

How to repeat:
Open in a pipe server program a pipe:

	HANDLE pipe=CreateNamedPipe("//./pipe/mypipe",PIPE_ACCESS_OUTBOUND
		,PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT,1,1024*4,1024*4
		,NMPWAIT_USE_DEFAULT_WAIT,NULL);
	if(INVALID_HANDLE_VALUE==pipe)
	{
		cerr<<"No pipe :-("<<endl;
		return 1;
	}

Then send from another process/thread a LOAD DATA INFILE query, in which the file is the pipe:

string query="LOAD DATA INFILE '//./pipe/mypipe' INTO TABLE t3";
mysql_real_query(&conn,query.c_str(),query.size());

And you'll get the following error:

MySQL(29): File '\\pipe\mypipe' not found (Errcode: 2)

Suggested fix:
Don't parse the file name from LOAD DATA INFILE in systems that do not require it (systems that can deal with / instead of \).
Don't use Windows API functions that can open pipes.
[29 Sep 2005 16:13] MySQL Verification Team
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

http://dev.mysql.com/doc/mysql/en/load-data.html

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. The filename must be given as a literal string.
[2 Oct 2005 6:50] Sela Lerer
I do not understand what is wrong with this bug.

Is my code not good enough?
Does LOAD DATA INFILE not supposed to read data from Windows pipes?
Is the name I used for the pipe not OK?

One simple sentence to let me know what's wrong will be much more informative then sending me to read the manual again (which I did, again).

Thank you,
Sela.
[11 Oct 2005 16:31] MySQL Verification Team
Hi,

"Does LOAD DATA INFILE not supposed to read data from Windows pipes?"

Yes, it isn't prepared for to read Windows's pipes which behaves different
than Unix's pipes.