summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorgluh@eagle.(none) <>2007-12-13 15:56:04 +0400
committergluh@eagle.(none) <>2007-12-13 15:56:04 +0400
commit4f5868114a1fe46f139f80d894dd28f1f7c180c1 (patch)
treee37ba43ba6ed4171e2b64ad9dbba79328c95a875 /sql/item_func.cc
parent8506efa91e2bccbd312411a949960ec8736a363f (diff)
parentd3889cac7ca8a2188abfd2bcdbe928cee9fd893b (diff)
downloadmariadb-git-4f5868114a1fe46f139f80d894dd28f1f7c180c1.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 101832b58a9..c89474f46b3 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2961,6 +2961,12 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
func->maybe_null=initid.maybe_null;
const_item_cache=initid.const_item;
+ /*
+ Keep used_tables_cache in sync with const_item_cache.
+ See the comment in Item_udf_func::update_used tables.
+ */
+ if (!const_item_cache && !used_tables_cache)
+ used_tables_cache= RAND_TABLE_BIT;
func->decimals=min(initid.decimals,NOT_FIXED_DEC);
}
initialized=1;
@@ -3841,10 +3847,12 @@ Item_func_set_user_var::fix_length_and_dec()
bool Item_func_set_user_var::register_field_in_read_map(uchar *arg)
{
- TABLE *table= (TABLE *) arg;
- if (result_field &&
- (!table || result_field->table == table))
- bitmap_set_bit(result_field->table->read_set, result_field->field_index);
+ if (result_field)
+ {
+ TABLE *table= (TABLE *) arg;
+ if (result_field->table == table || !table)
+ bitmap_set_bit(result_field->table->read_set, result_field->field_index);
+ }
return 0;
}