summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2005-01-24 17:17:19 +0200
committerbell@sanja.is.com.ua <>2005-01-24 17:17:19 +0200
commit6d71acf01ed93e486261734f17068f8f7495f6c9 (patch)
treebdb7b62ed717ce3a1b17d2ff18aec941f7c63f8f /sql/sql_base.cc
parent2371c992de11618844235f9b50d7bcdb6d0e2102 (diff)
downloadmariadb-git-6d71acf01ed93e486261734f17068f8f7495f6c9.tar.gz
fixed way of forward reference detection to support literal constant (BUG#8025)
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 263c68a82b7..fc987ef09b2 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2405,6 +2405,20 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
thd->allow_sum_func= allow_sum_func;
thd->where="field list";
+ /*
+ To prevent fail on forward lookup we fill it with zerows,
+ then if we got pointer on zero after find_item_in_list we will know
+ that it is forward lookup.
+
+ There is other way to solve problem: fill array with pointers to list,
+ but it will be slower.
+
+ TODO: remove it when (if) we made one list for allfields and
+ ref_pointer_array
+ */
+ if (ref_pointer_array)
+ bzero(ref_pointer_array, sizeof(Item *) * fields.elements);
+
Item **ref= ref_pointer_array;
while ((item= it++))
{