mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user