Bug #4815 embedded server calculates wrong place for outfiles
Submitted: 29 Jul 2004 20:46 Modified: 14 Sep 2004 6:11
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S2 (Serious)
Version:4.1 OS:
Assigned to: Alexey Botchkov CPU Architecture:Any

[29 Jul 2004 20:46] Matthias Leich
Description:
The embedded server seems to use a different method to calculate where outfiles should be
stored than the common server.
Example: database name is "test"
               statement  is "select * into outfile 't1.data' from t1 ;" (executed via mysqltest)
    mysqltest + common server
        --> I get a file <datadir>/test/t1.data

    mysqltest(embedded server)
         --> error message
               query 'select * into outfile 't1.data' from t1 ' failed: 1: 
               Can't create/write to file 'test/t1.data' (Errcode: 2)  .
               If I create a subdirectory "test" (database name) under the starting point of 
               mysqltest I get a file
                     <start_dir>/test/t1.data

Second Example: database name is "test"
               statement  is "select * into outfile './t1.data' from t1 ;" (executed via mysqltest)
    mysqltest + common server
        --> I get a file <datadir>/t1.data

    mysqltest(embedded server)
         --> I get a file <start_dir>/t1.data .

The manual says in the chapter about LOAD ... INFILE:

Note that these rules mean that a file named as `./myfile.txt' is read from the server's data directory, whereas the same file named as `myfile.txt' is read from the database directory of the default database.

So I have the feeling that the embedded server ignores the assigned datadir when it comes
to outfiles. I don't belief that the error is inside mysqltest, because I start mysqltest with
the "-A --datadir=...." option and this option causes the expected effects when it comes to 
the creation of tables.

My environment: Intel PC with Linux(SuSE 9.0)
                          MySQL 4.1 source distrib. (last bk pull 2004-07-28)

How to repeat:
use test ;

create table t1 ( a char(10)) ;
insert into t1 values ('abc');

select * into outfile 't1.data' from t1 ;
[24 Aug 2004 19:32] Alexey Botchkov
bk commit - 4.1 tree (hf:1.1984) BUG#4815
[14 Sep 2004 6:11] Alexey Botchkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html