diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-11-14 22:20:31 +0400 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-11-14 22:20:31 +0400 |
commit | c33c92d0f2d94e796aa403b80b29477e3400659b (patch) | |
tree | 9915b8eef2d14bebd9f577b361e1dd99b46f9d13 /mysql-test/r/partition.result | |
parent | d68b313dbc9af3f5924db977c12eff5e88f296be (diff) | |
download | mariadb-git-c33c92d0f2d94e796aa403b80b29477e3400659b.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.
include/queues.h:
Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
max_at_top policy changed
mysql-test/r/partition.result:
Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
test result
mysql-test/t/partition.test:
Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
test case
mysys/queues.c:
Bug #31890 Partitions: ORDER BY DESC in InnoDB not working.
queue->max_at_top policy changed - now it can either be '1' or '-1'.
We multiply comparison result on max_at_top to get the proper
direction.
Diffstat (limited to 'mysql-test/r/partition.result')
-rw-r--r-- | mysql-test/r/partition.result | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index b3a498ff0ab..589058c04a6 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1296,4 +1296,39 @@ create table t1 partition by key(s1) partitions 3; insert into t1 values (null,null); drop table t1; +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; +int_column char_column +718061 ZZzZH +756594 ZZZXU +453491 zzZWV +907955 zZZvP +782427 ZZZva +313801 zzzUM +37240 zZzTv +786036 zZzTO +970185 ZZzTN +9274 ZzZSX +4936 zzzsT +545592 zZzSD +39868 zZZRW +DROP TABLE t1; End of 5.1 tests |