Bug #29783 LOAD XML INFILE uses current directory for relative paths
Submitted: 13 Jul 2007 7:55 Modified: 13 Jul 2007 8:08
Reporter: Jon Stephens Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.2.5-bk OS:Linux (OpenSUSE 10.2/32-bit)
Assigned to: CPU Architecture:Any
Tags: load xml infile, paths, XML

[13 Jul 2007 7:55] Jon Stephens
Description:
LOAD XML INFILE appears to use the current directory for relative paths rather than calculating them reltive to the mysql data directory as is the case with LOAD DATA.

How to repeat:
mothra:/usr/local/mysql # ls -l bin | grep 'per'
-rwxr-xr-x 1 root root    17275 2007-07-12 18:34 mysql_setpermission
-rwxr-xr-x 1 root root  1758260 2007-07-12 18:34 perror
-rw-r--r-- 1 root root      846 2007-07-12 10:40 persondump.xml

mothra:/usr/local/mysql # bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.2.5-alpha-debug Source distribution

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

mysql> load xml local infile 'persondump.xml' into table test.person rows identified by '<person>';
ERROR 2 (HY000): File 'persondump.xml' not found (Errcode: 2)
mysql> load xml local infile 'bin/persondump.xml' into table test.person rows identified by '<person>';
Query OK, 0 rows affected (0.05 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

Suggested fix:
Make LOAD XML work like LOAD DATA in this regard.
[13 Jul 2007 8:08] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

See also http://dev.mysql.com/doc/refman/5.0/en/load-data.html:

The LOCAL keyword, if specified, is interpreted with respect to the client end of the connection:

*If LOCAL is specified, the file is read by the client program on the client host and sent to the server. The file can be given as a full pathname to specify its exact location. If given as a relative pathname, the name is interpreted relative to the directory in which the client program was started.