summaryrefslogtreecommitdiff
path: root/mysql-test/t/delete.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-02-23 18:49:41 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-02-23 18:49:41 +0200
commit4e4152c56f70367a98717f2329ca1b8be39c2eb0 (patch)
treeb505b29146f11fd016c6ab59c903d9eb4052ed2e /mysql-test/t/delete.test
parent1f93b0c83af4b30b90e3a71eb6f2a663375feebc (diff)
downloadmariadb-git-4e4152c56f70367a98717f2329ca1b8be39c2eb0.tar.gz
Bug #26186:
When handling DELETE ... FROM if there is no condition it is internally transformed to TRUNCATE for more efficient execution by the storage handler. The check for validity of the optional ORDER BY clause is done after the check for the above optimization and will not be performed if the optimization can be applied. Moved the validity check for ORDER BY before the optimization so it performed regardless of the optimization. mysql-test/r/delete.result: Bug #26186: test case mysql-test/t/delete.test: Bug #26186: test case sql/sql_delete.cc: Bug #26186: do validity check of the ORDER BY before deciding to skip it.
Diffstat (limited to 'mysql-test/t/delete.test')
-rw-r--r--mysql-test/t/delete.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 306447dbd5a..36d627209db 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -203,3 +203,21 @@ select * from t1 where a is null;
delete from t1 where a is null;
select count(*) from t1;
drop table t1;
+
+#
+# Bug #26186: delete order by, sometimes accept unknown column
+#
+CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1);
+
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY x;
+
+# even columns from a table not used in query (and not even existing)
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY t2.x;
+
+# subquery (as long as the subquery from is valid or DUAL)
+--error ER_BAD_FIELD_ERROR
+DELETE FROM t1 ORDER BY (SELECT x);
+
+DROP TABLE t1;