summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-07-13 10:45:23 -0700
committerIgor Babaev <igor@askmonty.org>2010-07-13 10:45:23 -0700
commit683154d1fa6249a8bfcde4bb9227570c452ea802 (patch)
tree3db8fdc9f017571f782938a6a05804dc3f9dc474 /sql
parent73be27c07f3283cb35e0fb7085b5068ab360bc01 (diff)
downloadmariadb-git-683154d1fa6249a8bfcde4bb9227570c452ea802.tar.gz
Fixed bug #603654.
If a virtual column was used in the ORDER BY clause of a query and some of the columns this virtual column was based upon were not referenced anywhere in the query then the execution of the query could cause an assertion failure. It happened because in this case the bitmap of the columns used for ordering keys was not formed correctly.
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 33c838f1bcb..270f0f1ac37 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1009,7 +1009,14 @@ static void register_used_fields(SORTPARAM *param)
if ((field= sort_field->field))
{
if (field->table == table)
- bitmap_set_bit(bitmap, field->field_index);
+ {
+ if (field->vcol_info)
+ {
+ Item *vcol_item= field->vcol_info->expr_item;
+ vcol_item->walk(&Item::register_field_in_read_map, 1, (uchar *) 0);
+ }
+ bitmap_set_bit(bitmap, field->field_index);
+ }
}
else
{ // Item