summaryrefslogtreecommitdiff
path: root/sql/item_row.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-12 13:44:20 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-12 13:44:20 +0400
commit46cffd7f5b585527387e2a23d1c3c43d2b14bf2c (patch)
treeeb5fe8ec07789d4b60868b31919ad12b97c01348 /sql/item_row.cc
parent80164ae9a08041e67c65460d9bb2a6b0e1aeb277 (diff)
downloadmariadb-git-46cffd7f5b585527387e2a23d1c3c43d2b14bf2c.tar.gz
Bug#48294 assertion when creating a view based on some row() construct in select query
In case of 'CREATE VIEW' subselect transformation does not happen(see JOIN::prepare). During fix_fields Item_row may call is_null() method for its arugmens which leads to item calculation(wrong subselect in our case as transformation did not happen before). This is_null() call does not make sence for 'CREATE VIEW'. Note: Only Item_row is affected because other items don't call is_null() during fix_fields() for arguments. mysql-test/r/view.result: test case mysql-test/t/view.test: test case sql/item_row.cc: skip is_null() call in case of 'CREATE VIEW' as unnecessary.
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r--sql/item_row.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 28de03bf049..29b37eb2bc0 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -71,7 +71,12 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
Item *item= *arg;
used_tables_cache |= item->used_tables();
const_item_cache&= item->const_item() && !with_null;
- if (const_item_cache)
+ /*
+ Some subqueries transformations aren't done in the view_prepare_mode thus
+ is_null() will fail. So we skip is_null() calculation for CREATE VIEW as
+ not necessary.
+ */
+ if (const_item_cache && !thd->lex->view_prepare_mode)
{
if (item->cols() > 1)
with_null|= item->null_inside();