Hi, Sanja! On Apr 27, Oleksandr Byelkin wrote:
revision-id: a7032fbb32d (mariadb-10.2.31-906-ga7032fbb32d) parent(s): b862377c3e9 author: Oleksandr Byelkin <sanja@mariadb.com> committer: Oleksandr Byelkin <sanja@mariadb.com> timestamp: 2021-04-27 16:24:43 +0200 message:
Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY
The problem is that sharing default expression among set instruction leads to attempt access result field of function created in other instruction runtime MEM_ROOT and already freed (a bit different then MySQL problem).
Fix is the same as in MySQL (but no optimisation for constant), turn DECLARE a, b, c type DEFAULT expr; to DECLARE a type DEFAULT expr, b type DEFAULT a, c type DEFAULT a;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index f13b3fbc281..007dfd1a10b 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -10025,4 +10025,22 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1;
+ +--echo # +--echo #
forgot the bug summary (the first line of the commit comment)
+--echo # + +delimiter |; +create function f1() returns bigint return now()-1| +create procedure p1() +begin + declare b, c bigint default f1(); + select b-c; +end| +call p1()| +drop procedure p1| +drop function f1| +delimiter ;| + + --echo #End of 10.2 tests diff --git a/sql/item.cc b/sql/item.cc index 42272fe0148..ec9f4ffb993 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2933,7 +2933,7 @@ bool Item_field::eq(const Item *item, bool binary_cmp) const
table_map Item_field::used_tables() const { - if (field->table->const_table) + if (!field || !field->table || field->table->const_table)
in what cases can field or field->table be NULL here?
return 0; // const item return (get_depended_from() ? OUTER_REF_TABLE_BIT : field->table->map); }
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org