Bug #4093 select into outfile: file existance delayed
Submitted: 10 Jun 2004 18:55 Modified: 16 Jun 2004 12:40
Reporter: dave mausner Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1 OS:Windows (win2000)
Assigned to: Bugs System CPU Architecture:Any

[10 Jun 2004 18:55] dave mausner
in windows 2000, executed SELECT ... INTO OUTFILE ... on the mysql server using mysql client, in a batch command script. the OUTFILE does not exist immediately after mysql terminates normally, so the command after mysql fails to find it. the OUTFILE suddenly exists after a short delay.

How to repeat:
batch script file--
mysql.lnk -v -v -u root -e "source dump.sql" ww >dump.log
if not exist load1.txt goto wait1

sql script file--
select ... 
INTO OUTFILE 'C:/Documents and Settings/Name/My Documents/WW/load1.txt' 
from ...
order by ... ;

NOTE: one may observe that the batch script loops several times until the OUTFILE exists.

Suggested fix:
the wait loop is the only workaround, since i have no idea why the OUTFILE is absent immediately after mysql terminates normally.

i speculate that this is windows-specific.
[16 Jun 2004 12:40] Vasily Kishkin
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:

the OUTFILE (load1.txt) does not exist immediately after mysql terminates normally, because after OUTFILE is closed by mysql, Windows start to flush buffer of the file. And that moment any program can't see the file (if file is short). When Windows finish to flush, you can see the file. It is a feature of Windows OS.