mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 15:45:33 +02:00
Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
We should disable const subselect item evaluation because subselect transformation does not happen in view_prepare_mode and thus val_...() methods can not be called. mysql-test/r/ctype_ucs.result: test case mysql-test/r/view.result: test case mysql-test/t/ctype_ucs.test: test case mysql-test/t/view.test: test case sql/item.cc: disabled const subselect item evaluation in view prepare mode. sql/item_subselect.cc: added Item_subselect::safe_charset_converter which prevents const item evaluation in view prepare mode. sql/item_subselect.h: added Item_subselect::safe_charset_converter which prevents const item evaluation in view prepare mode.
This commit is contained in:
parent
01fb1c8938
commit
ba229d799a
7 changed files with 60 additions and 1 deletions
11
sql/item.cc
11
sql/item.cc
|
|
@ -1713,7 +1713,16 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
|||
|
||||
if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
|
||||
((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
|
||||
conv= new Item_func_conv_charset(*arg, coll.collation, 1);
|
||||
{
|
||||
/*
|
||||
We should disable const subselect item evaluation because
|
||||
subselect transformation does not happen in view_prepare_mode
|
||||
and thus val_...() methods can not be called for const items.
|
||||
*/
|
||||
bool resolve_const= ((*arg)->type() == Item::SUBSELECT_ITEM &&
|
||||
thd->lex->view_prepare_mode) ? FALSE : TRUE;
|
||||
conv= new Item_func_conv_charset(*arg, coll.collation, resolve_const);
|
||||
}
|
||||
|
||||
if (!conv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -122,6 +122,21 @@ void Item_subselect::cleanup()
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
We cannot use generic Item::safe_charset_converter() because
|
||||
Subselect transformation does not happen in view_prepare_mode
|
||||
and thus we can not evaluate val_...() for const items.
|
||||
*/
|
||||
|
||||
Item *Item_subselect::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
{
|
||||
Item_func_conv_charset *conv=
|
||||
new Item_func_conv_charset(this, tocs, thd->lex->view_prepare_mode ? 0 : 1);
|
||||
return conv->safe ? conv : NULL;
|
||||
}
|
||||
|
||||
|
||||
void Item_singlerow_subselect::cleanup()
|
||||
{
|
||||
DBUG_ENTER("Item_singlerow_subselect::cleanup");
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ public:
|
|||
virtual void reset_value_registration() {}
|
||||
enum_parsing_place place() { return parsing_place; }
|
||||
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs);
|
||||
|
||||
/**
|
||||
Get the SELECT_LEX structure associated with this Item.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue