1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB

and auto_increment keys

Problems: 
  1. ALTER TABLE ... ORDER BY... doesn't make sence if there's a 
     user-defined clustered index in the table.
  2. using a secondary index is slower than using a clustered one 
     for a table scan.

Fixes:
  1. raise a warning.
  2. use the clustered index.


mysql-test/include/mix1.inc:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - test case.
mysql-test/r/innodb.result:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - results adjusted.
mysql-test/r/innodb_mysql.result:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - results adjusted.
mysql-test/r/join_outer_innodb.result:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - results adjusted.
sql/sql_select.cc:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - use the clustered index for a table scan (if any) as it's faster than
      using a secondary index.
sql/sql_table.cc:
  Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB 
  and auto_increment keys
    - ALTER TABLE ... ORDER BY doesn't make sence if there's a 
      user-defined clustered index in the table. Ignore it in such cases
      and raise a warning.
This commit is contained in:
unknown
2007-11-07 19:59:58 +04:00
parent 3acf386878
commit 9d2b259e23
6 changed files with 75 additions and 42 deletions

View File

@ -1189,4 +1189,12 @@ if ($test_foreign_keys)
DROP TABLE t1;
}
#
# Bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB and
# auto_increment keys
#
create table t1 (a int auto_increment primary key) engine=innodb;
alter table t1 order by a;
drop table t1;
--echo End of 5.1 tests