summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-05-18 00:55:28 +0400
committerunknown <evgen@moonbone.local>2006-05-18 00:55:28 +0400
commit1c6beaee06a2c9aefc7d0cdefa149091504318a3 (patch)
tree48910fb8a117df90e551cbb46930664c58ad3b21 /sql/item.h
parentab9eadf21551e0465ac1523b82741e2fc51621ba (diff)
downloadmariadb-git-1c6beaee06a2c9aefc7d0cdefa149091504318a3.tar.gz
Fixed bug#19077: A nested materialized derived table is used before being populated.
The convert_constant_item() function converts constant items to ints on prepare phase to optimize execution speed. In this case it tries to evaluate subselect which contains a derived table and is contained in a derived table. All derived tables are filled only after all derived tables are prepared. So evaluation of subselect with derived table at the prepare phase will return a wrong result. A new flag with_subselect is added to the Item class. It indicates that expression which this item represents is a subselect or contains a subselect. It is set to 0 by default. It is set to 1 in the Item_subselect constructor for subselects. For Item_func and Item_cond derived classes it is set after fixing any argument in Item_func::fix_fields() and Item_cond::fix_fields accordingly. The convert_constant_item() function now doesn't convert a constant item if the with_subselect flag set in it. mysql-test/t/view.test: Added test case for bug#19077: A nested materialized derived table is used before being populated. mysql-test/t/subselect.test: Added test case for bug#19077: A nested materialized derived table is used before being populated. mysql-test/r/view.result: Added test case for bug#19077: A nested materialized derived table is used before being populated. mysql-test/r/subselect.result: Added test case for bug#19077: A nested materialized derived table is used before being populated. sql/item_subselect.cc: Fixed bug#19077: A nested materialized derived table is used before being populated. The Item_subselect class constructor sets new with_subselect flag to 1. sql/item_func.cc: Fixed bug#19077: A nested materialized derived table is used before being populated. The Item_func::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments. sql/item_cmpfunc.cc: Fixed bug#19077: A nested materialized derived table is used before being populated. The convert_constant_item() function now doesn't convert a constant item with the with_subselect flag set. The Item_cond::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments. sql/item.cc: Fixed bug#19077: A nested materialized derived table is used before being populated. Set new with_subselect flag to default value - 0 in the Item constructor. sql/item.h: Fixed bug#19077: A nested materialized derived table is used before being populated. A new flag with_subselect is added to the Item class. It indicates that expression which this item represents is a subselect or contains a subselect. It is set to 0 by default.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 19a57a10720..28b1f54add7 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -460,6 +460,9 @@ public:
my_bool is_autogenerated_name; /* indicate was name of this Item
autogenerated or set by user */
DTCollation collation;
+ my_bool with_subselect; /* If this item is a subselect or some
+ of its arguments is or contains a
+ subselect */
// alloc & destruct is done as start of select using sql_alloc
Item();