Bug #11959 tab written as \<tab> to outfile
Submitted: 15 Jul 2005 8:42 Modified: 19 Jul 2005 18:06
Reporter: Kai Sautter (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.7 OS:Windows (WINdows XP (SP2))
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Jul 2005 8:42] Kai Sautter
Description:
I am writing some result of a text query to an outfile using select, say

"select 'some\twords' as 'text' into outfile c:/somepath/somefile.txt;"

The result I expected based on the documentation is to find the text exactly the same way in the file as phrased in the select statement ("some\twords"), so I could reuse it. Yet what I get is

"some\	words" ("some\<tab>words").

If the text is displayed within the command shell utitlity or Query Browser it is correctly translated to "some	words" (i.e. "some<tab>words").

How to repeat:
execute the following statement:

select 'some\twords' as 'text' into outfile c:/somepath/somefile.txt;

You can also compare the results to the (correct) results of:

select 'some\twords' as 'text';
[15 Jul 2005 8:44] Kai Sautter
See this file for results of select into outfile statement

Attachment: tabtest.txt (text/plain), 12 bytes.

[19 Jul 2005 18:06] Reggie Burnett
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:

This is not a bug.  Select into outfile uses the same field and line separator semantics as load data infile.  By default, the field separator character is \t.  If you don't change it, it will escape any \t characters that appear in the text since it is using \t to separate the columns.  If you wanted to include \t in your text and not have it escaped, then use a different field separator.  An example would be:
select 'text\ttext2' as col1, 'text2\ttext3' into outfile '/tmp/myfile' fields terminated by ','