Commit 3ac2df4e authored by unknown's avatar unknown

Bug#8191 - SELECT INTO OUTFILE insists on FROM clause

  Fix bug + include test case.
  Enable outfile tests.


mysql-test/t/outfile.test:
  Reenable outfile tests
  Add test for Bug#8191
sql/sql_yacc.yy:
  Fix Bug#8191
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent ede028b0
...@@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com ...@@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com akishkin@work.mysql.com
antony@ltantony.dsl-verizon.net antony@ltantony.dsl-verizon.net
antony@ltantony.mysql.com
antony@ltantony.rdg.cyberkinetica.homeunix.net antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com arjen@bitbike.com
arjen@co3064164-a.bitbike.com arjen@co3064164-a.bitbike.com
......
-- require r/have_outfile.require
disable_query_log;
select load_file(concat(@tmpdir,"/outfile.test"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile.test
enable_query_log;
eval select "Outfile OK" into outfile "$MYSQL_TEST_DIR/var/tmp/outfile.test";
load_file(concat(@tmpdir,"/outfile.test"))
Outfile OK
disable_query_log;
-- source include/test_outfile.inc
eval set @tmpdir="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
-- source include/have_outfile.inc
# #
# test of into outfile|dumpfile # test of into outfile|dumpfile
# #
# We need to check that we have 'file' privilege. drop table if exists t1;
create table t1 (`a` blob);
insert into t1 values("hello world"),("Hello mars"),(NULL);
disable_query_log;
eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.1"));
disable_query_log;
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1 limit 1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.2"));
disable_query_log;
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1 where a is null;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.3"));
#drop table if exists t1; # the following should give errors
#create table t1 (`a` blob);
#insert into t1 values("hello world"),("Hello mars"),(NULL); disable_query_log;
#select * into outfile "/tmp/select-test.1" from t1; --error 1086
#select load_file("/tmp/select-test.1"); eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
#select * into dumpfile "/tmp/select-test.2" from t1 limit 1; --error 1086
#select load_file("/tmp/select-test.2"); eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1;
#select * into dumpfile "/tmp/select-test.3" from t1 where a is null; --error 1086
#select load_file("/tmp/select-test.3"); eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
# enable_query_log;
## the following should give errors select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
# --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
#select * into outfile "/tmp/select-test.1" from t1; --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
#select * into dumpfile "/tmp/select-test.1" from t1; --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3
#select * into dumpfile "/tmp/select-test.99" from t1; drop table t1;
#select load_file("/tmp/select-test.not-exist");
#drop table t1; # Bug#8191
disable_query_log;
eval select 1 into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.4";
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.4"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
...@@ -1537,9 +1537,10 @@ select_part2: ...@@ -1537,9 +1537,10 @@ select_part2:
select_into: select_into:
limit_clause {} limit_clause {}
| into
| select_from | select_from
| opt_into select_from | into select_from
| select_from opt_into; | select_from into;
select_from: select_from:
FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause; FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause;
...@@ -2507,7 +2508,7 @@ procedure_item: ...@@ -2507,7 +2508,7 @@ procedure_item:
$2->set_name($1,(uint) ((char*) lex->tok_end - $1)); $2->set_name($1,(uint) ((char*) lex->tok_end - $1));
}; };
opt_into: into:
INTO OUTFILE TEXT_STRING INTO OUTFILE TEXT_STRING
{ {
THD *thd= current_thd; THD *thd= current_thd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment