summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <antony@ltantony.mysql.com>2005-05-08 22:56:58 +0100
committerunknown <antony@ltantony.mysql.com>2005-05-08 22:56:58 +0100
commit3ac2df4e4c2366d4b30b3251590207a3d07f483d (patch)
tree10cc2644866c76b24f2a1d676cdec9c02762c378
parentede028b0638239f61812e3a0f226ca7adf451ed7 (diff)
downloadmariadb-git-3ac2df4e4c2366d4b30b3251590207a3d07f483d.tar.gz
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
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--mysql-test/include/have_outfile.inc5
-rw-r--r--mysql-test/include/test_outfile.inc1
-rw-r--r--mysql-test/r/have_outfile.require3
-rw-r--r--mysql-test/r/outfile.resultbin0 -> 953 bytes
-rw-r--r--mysql-test/t/outfile.test60
-rw-r--r--sql/sql_yacc.yy7
7 files changed, 56 insertions, 21 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index bf0dfb9e31d..5a34dbbb1d8 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
antony@ltantony.dsl-verizon.net
+antony@ltantony.mysql.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com
arjen@co3064164-a.bitbike.com
diff --git a/mysql-test/include/have_outfile.inc b/mysql-test/include/have_outfile.inc
new file mode 100644
index 00000000000..31e95f4810a
--- /dev/null
+++ b/mysql-test/include/have_outfile.inc
@@ -0,0 +1,5 @@
+-- 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;
diff --git a/mysql-test/include/test_outfile.inc b/mysql-test/include/test_outfile.inc
new file mode 100644
index 00000000000..0bede4938c6
--- /dev/null
+++ b/mysql-test/include/test_outfile.inc
@@ -0,0 +1 @@
+eval select "Outfile OK" into outfile "$MYSQL_TEST_DIR/var/tmp/outfile.test";
diff --git a/mysql-test/r/have_outfile.require b/mysql-test/r/have_outfile.require
new file mode 100644
index 00000000000..9fc2f8fdb5a
--- /dev/null
+++ b/mysql-test/r/have_outfile.require
@@ -0,0 +1,3 @@
+load_file(concat(@tmpdir,"/outfile.test"))
+Outfile OK
+
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
new file mode 100644
index 00000000000..a2720be075a
--- /dev/null
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index c126d221bd2..f86c4163289 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -1,23 +1,47 @@
+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
#
-# 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;
-#create table t1 (`a` blob);
-#insert into t1 values("hello world"),("Hello mars"),(NULL);
-#select * into outfile "/tmp/select-test.1" from t1;
-#select load_file("/tmp/select-test.1");
-#select * into dumpfile "/tmp/select-test.2" from t1 limit 1;
-#select load_file("/tmp/select-test.2");
-#select * into dumpfile "/tmp/select-test.3" from t1 where a is null;
-#select load_file("/tmp/select-test.3");
-#
-## the following should give errors
-#
-#select * into outfile "/tmp/select-test.1" from t1;
-#select * into dumpfile "/tmp/select-test.1" from t1;
-#select * into dumpfile "/tmp/select-test.99" from t1;
-#select load_file("/tmp/select-test.not-exist");
-#drop table t1;
+# the following should give errors
+
+disable_query_log;
+--error 1086
+eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
+--error 1086
+eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1;
+--error 1086
+eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
+enable_query_log;
+select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
+--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
+--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
+--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3
+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
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 8c5c4d61d1d..68d08b353d9 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1537,9 +1537,10 @@ select_part2:
select_into:
limit_clause {}
+ | into
| select_from
- | opt_into select_from
- | select_from opt_into;
+ | into select_from
+ | select_from into;
select_from:
FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause;
@@ -2507,7 +2508,7 @@ procedure_item:
$2->set_name($1,(uint) ((char*) lex->tok_end - $1));
};
-opt_into:
+into:
INTO OUTFILE TEXT_STRING
{
THD *thd= current_thd;