From ceb40ef45b735f7e35aa87306b220a8493f4d754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Aug 2021 14:26:27 +0300 Subject: [PATCH] MDEV-26504 THD::copy_db_to() fails to return true if THD::db is null THD::copy_db_to(): Always return true if the output parameter was left uninitialized. This fixes a regression that was caused by commit 7d0d934ca642e485b2c008727dc20c83e26cce10 (MDEV-16473). MariaDB Server 10.3 and later were unaffected by this bug thanks to commit a7e352b54ddfaf91c92951d605cb02a4ffd2676b. Possibly this bug only affects mysql_list_fields() in the Embedded Server (libmysqld). This bug was found by GCC 11.2.0 in CMAKE_BUILD_TYPE=RelWithDebInfo. --- sql/sql_class.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 50ab3c56ca9..5f871f9caf6 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4003,10 +4003,8 @@ public: for any CTE references. */ if (!lex->with_cte_resolution) - { my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); - return TRUE; - } + return TRUE; } else {