Skip to content

Commit 8f27ab9

Browse files
committed
Bug#34239456: Assertion '!thd->is_error()' failed in MySQL 8.0.29
Problem was a missing error return when processing an invalid ORDER BY expression in a view definition. Fixed by adding an error return. Change-Id: I5a89cb3dbb986863dfb70e10a5b303b0631a1f8d
1 parent 1d88401 commit 8f27ab9

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

mysql-test/r/view.result

+14
Original file line numberDiff line numberDiff line change
@@ -6808,3 +6808,17 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
68086808
Warnings:
68096809
Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `foo`,`test`.`t1`.`col_int_key` AS `bar` from `test`.`t1`
68106810
DROP TABLE t1;
6811+
# Bug#34239456: Assertion '!thd->is_error()' failed in MySQL 8.0.29
6812+
CREATE TABLE t0 (c0 INTEGER, c1 INTEGER);
6813+
CREATE VIEW v0 AS
6814+
SELECT c0
6815+
FROM t0
6816+
WHERE c1 = (SELECT 1
6817+
UNION
6818+
SELECT c0 FROM t0
6819+
ORDER BY c1
6820+
);
6821+
SELECT * FROM v0;
6822+
ERROR 42000: Table 't0' from one of the SELECTs cannot be used in global ORDER clause
6823+
DROP VIEW v0;
6824+
DROP TABLE t0;

mysql-test/t/view.test

+19
Original file line numberDiff line numberDiff line change
@@ -6311,3 +6311,22 @@ DROP VIEW v1;
63116311
EXPLAIN SELECT pk AS foo, col_int_key AS bar FROM t1;
63126312

63136313
DROP TABLE t1;
6314+
6315+
--echo # Bug#34239456: Assertion '!thd->is_error()' failed in MySQL 8.0.29
6316+
6317+
CREATE TABLE t0 (c0 INTEGER, c1 INTEGER);
6318+
6319+
CREATE VIEW v0 AS
6320+
SELECT c0
6321+
FROM t0
6322+
WHERE c1 = (SELECT 1
6323+
UNION
6324+
SELECT c0 FROM t0
6325+
ORDER BY c1
6326+
);
6327+
6328+
--error ER_TABLENAME_NOT_ALLOWED_HERE
6329+
SELECT * FROM v0;
6330+
6331+
DROP VIEW v0;
6332+
DROP TABLE t0;

sql/parse_tree_items.cc

+1
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ bool PTI_simple_ident_q_3d::itemize(Parse_context *pc, Item **res) {
393393
: db;
394394
if (pc->select->no_table_names_allowed) {
395395
my_error(ER_TABLENAME_NOT_ALLOWED_HERE, MYF(0), table, thd->where);
396+
return true;
396397
}
397398
if ((pc->select->parsing_place != CTX_HAVING) ||
398399
(pc->select->get_in_sum_expr() > 0)) {

0 commit comments

Comments
 (0)