diff options
author | holyfoot/hf@mysql.com/hfmain.(none) <> | 2007-11-14 22:20:31 +0400 |
---|---|---|
committer | holyfoot/hf@mysql.com/hfmain.(none) <> | 2007-11-14 22:20:31 +0400 |
commit | a2f08506e19eac754e75d755c203151a0a8f7fdb (patch) | |
tree | 9915b8eef2d14bebd9f577b361e1dd99b46f9d13 /mysql-test/t/partition.test | |
parent | 19c3bd89f8d50abc703d16325195ed915c2e58e3 (diff) | |
download | mariadb-git-a2f08506e19eac754e75d755c203151a0a8f7fdb.tar.gz |
Bug #31890 Partitions: ORDER BY DESC in InnoDB not working.
It's not InnoDB specific bug.
Error is in QUEUE code, about the way we handle queue->max_at_top.
It's either '0' or '-2' and we do '^' operation to get the proper
direction. Though queue->compare() function can return '-2' as
a result of comparison sometimes. So we'll get
queue->compare() ^ queue->max_at_top == 0 (when max_at_top is -2)
and _downheap() function code will go wrong way here:
...
if (next_index < elements &&
(queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
queue->root[next_index+1]+offset_to_key) ^
queue->max_at_top) > 0)
next_index++;
...
Fixed by changing max_at_top to be either 1 or -1, doing
'* max_at_top' to get proper direction.
Diffstat (limited to 'mysql-test/t/partition.test')
-rw-r--r-- | mysql-test/t/partition.test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 524862af135..358ca5eb2cf 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1549,4 +1549,31 @@ while ($cnt) --enable_query_log drop table t1; + +# +# Bug #31890 Partitions: ORDER BY DESC in InnoDB not working +# + +CREATE TABLE t1 +(int_column INT, char_column CHAR(5), +PRIMARY KEY(char_column,int_column)) +PARTITION BY KEY(char_column,int_column) +PARTITIONS 101; +INSERT INTO t1 (int_column, char_column) VALUES +( 39868 ,'zZZRW'), +( 545592 ,'zZzSD'), +( 4936 ,'zzzsT'), +( 9274 ,'ZzZSX'), +( 970185 ,'ZZzTN'), +( 786036 ,'zZzTO'), +( 37240 ,'zZzTv'), +( 313801 ,'zzzUM'), +( 782427 ,'ZZZva'), +( 907955 ,'zZZvP'), +( 453491 ,'zzZWV'), +( 756594 ,'ZZZXU'), +( 718061 ,'ZZzZH'); +SELECT * FROM t1 ORDER BY char_column DESC; +DROP TABLE t1; + --echo End of 5.1 tests |