1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-29537 Creation of view with UNION and SELECT ... FOR UPDATE in definition is failed with error

lock_type is writen in the last SELECT of the unit even if it parsed last,
so it should be printed last from the last select of the unit.
This commit is contained in:
Oleksandr Byelkin
2024-09-20 14:58:23 +02:00
parent cc810e64d4
commit 8d810e9426
5 changed files with 96 additions and 4 deletions

View File

@ -28787,6 +28787,16 @@ void st_select_lex::print_on_duplicate_key_clause(THD *thd, String *str,
}
}
void st_select_lex::print_lock_type(String *str)
{
if (lock_type == TL_READ_WITH_SHARED_LOCKS)
str->append(" lock in share mode");
else if (lock_type == TL_WRITE)
str->append(" for update");
}
void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
{
DBUG_ASSERT(thd);
@ -29059,10 +29069,9 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
print_limit(thd, str, query_type);
// lock type
if (lock_type == TL_READ_WITH_SHARED_LOCKS)
str->append(" lock in share mode");
else if (lock_type == TL_WRITE)
str->append(" for update");
if (braces) /* no braces processed in
SELECT_LEX_UNIT::print_lock_from_the_last_select */
print_lock_type(str);
if ((sel_type == INSERT_CMD || sel_type == REPLACE_CMD) &&
thd->lex->update_list.elements)