summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-01-31 10:04:16 +0400
committerunknown <ram@gw.mysql.r18.ru>2004-01-31 10:04:16 +0400
commitabc17f8f3c132971a04cc76543d3c0ef23386b79 (patch)
tree8ecd530e159e09b3b4589e988c143514e603d6df /sql/opt_range.cc
parent150c99dffe2737ef4de7534bf297ff6943612cd0 (diff)
downloadmariadb-git-abc17f8f3c132971a04cc76543d3c0ef23386b79.tar.gz
fix for the bug #2419: order by ignores rows.
null_ref_key moved to TABLE_REF. new null range created if necessary. mysql-test/r/order_by.result: fix for the bug #2419: order by ignores rows mysql-test/t/order_by.test: fix for the bug #2419: order by ignores rows sql/item_subselect.cc: fix for the bug #2419: order by ignores rows sql/opt_range.cc: fix for the bug #2419: order by ignores rows sql/sql_select.cc: fix for the bug #2419: order by ignores rows sql/sql_select.h: fix for the bug #2419: order by ignores rows
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index acc23924f75..9f56064cfb1 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2513,8 +2513,25 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
key_part->part_length+=HA_KEY_BLOB_LENGTH;
key_part->null_bit= key_info->key_part[part].null_bit;
}
- if (!quick->ranges.push_back(range))
- return quick;
+ if (quick->ranges.push_back(range))
+ goto err;
+
+ if (ref->null_ref_key)
+ {
+ QUICK_RANGE *null_range;
+
+ *ref->null_ref_key= 1; // Set null byte then create a range
+ if (!(null_range= new QUICK_RANGE(ref->key_buff, ref->key_length,
+ ref->key_buff, ref->key_length,
+ EQ_RANGE)))
+ goto err;
+ *ref->null_ref_key= 0; // Clear null byte
+ /* Do we need to do something with key_parts here? Looks like we don't */
+ if (quick->ranges.push_back(null_range))
+ goto err;
+ }
+
+ return quick;
err:
delete quick;