diff options
author | ram@gw.mysql.r18.ru <> | 2004-01-31 10:04:16 +0400 |
---|---|---|
committer | ram@gw.mysql.r18.ru <> | 2004-01-31 10:04:16 +0400 |
commit | 6fab168a63ae63604318186885389e630bedfdbc (patch) | |
tree | 8ecd530e159e09b3b4589e988c143514e603d6df /sql/opt_range.cc | |
parent | d4d097689b9ba12f93f28a55158f6d6a14fd18ae (diff) | |
download | mariadb-git-6fab168a63ae63604318186885389e630bedfdbc.tar.gz |
fix for the bug #2419: order by ignores rows.
null_ref_key moved to TABLE_REF.
new null range created if necessary.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 21 |
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; |