Bug #25807 LOAD DATA INFILE does not work with Pipes
Submitted: 23 Jan 2007 22:25 Modified: 21 Feb 2007 3:08
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.32 OS:Linux (Linux)
Assigned to: Chad MILLER CPU Architecture:Any
Tags: regression

[23 Jan 2007 22:25] Christian Hammers
Description:
Hello

As reported by TJ <tj.trevelyan@gmail.com> on http://bugs.debian.org/408159:

"When doing LOAD DATA INFILE 'pipe' INTO TABLE table..;
as soon as the writing process starts to write, the mysql process just stops
with no errors, just:

Query OK, 0 rows affected (0.19 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

I know that many months ago mysql 5.0 (or 4.1) were patched upstream
to support unix pipes, however this now appears to have regressed."

LOAD DATA LOCAL INFILE does work as expected.

bye,

-christian-

How to repeat:
In the first shell:
  mkfifo /tmp/pipe
  chmod 666 /tmp/pipe
  cat > /tmp/pipe

In the second shell:
  mysql test
  CREATE TABLE t (i int);
  LOAD DATA INFILE '/tmp/pipe' INTO TABLE t;

Suggested fix:
Take a look at the difference between the file reading of "LOAD DATA INFILE" and "LOAD DATA LOCAL INFILE" as the latter works.
[24 Jan 2007 2:31] MySQL Verification Team
Thank you for the bug report.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.36-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE t (i int);
Query OK, 0 rows affected (0.02 sec)

mysql> LOAD DATA INFILE '/tmp/pipe' INTO TABLE t;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0
[24 Jan 2007 12:58] Christian Hammers
The original Debian bug reporter just told me that it does work with the older
MySQL 5.0.24a.

bye,

-christian-
[13 Feb 2007 21:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/19806

ChangeSet@1.2413, 2007-02-13 16:35:29-05:00, cmiller@zippy.cornsilk.net +2 -0
  Bug#25807: LOAD DATA INFILE does not work with Pipes
  
  Showstopper and regression against 5.0.24.
  
  Previously, we ignored seek() errors (see Bug#22828) and let seek()s
  against pipes fail.  Now, since we check that a seek didn't fail,
  and return without reading, this bug popped up.
  
  This restores the behavior for file-ish objects that could never be 
  seek()ed.
[14 Feb 2007 16:09] Chad MILLER
Available in 5.0.36 and 5.1.16-beta.
[20 Feb 2007 10:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/20164

ChangeSet@1.2434, 2007-02-20 12:06:04+01:00, msvensson@pilot.blaudden +1 -0
  Bug#25807 LOAD DATA INFILE does not work with Pipes
   - Additional fix for io_cache_init being called on a closed file
[21 Feb 2007 3:09] Paul DuBois
Noted in 5.0.36, 5.1.16 changelogs.