mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
This only happend when using an ORDER BY on a primary key part, where all other key parts where constant. Remove of duplicated expressions in ORDER BY (as the old code did this in some strange cases) mysql-test/r/group_by.result: Fixed results to take into account that duplicate order by parts are now deleted mysql-test/r/group_by_innodb.result: Ensure extended keys are on mysql-test/r/innodb_ext_key.result: More tests mysql-test/r/order_by.result: More tests mysql-test/t/group_by.test: Fixed results to take into account that duplicate order by parts are now deleted mysql-test/t/group_by_innodb.test: Ensure extended keys are on mysql-test/t/innodb_ext_key.test: More tests mysql-test/t/order_by.test: More tests sql/sql_select.cc: Fixed bug where we looked at extended key parts when we shouldn't Remove of duplicated expressions in ORDER BY sql/table.cc: Indentation fixes
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
set @save_ext_key_optimizer_switch=@@optimizer_switch;
|
|
#
|
|
# MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
|
|
# on GROUP BY with indexes on InnoDB table
|
|
#
|
|
CREATE TABLE t1 (
|
|
pk INT PRIMARY KEY,
|
|
a VARCHAR(1) NOT NULL,
|
|
KEY (pk)
|
|
) ENGINE=InnoDB;
|
|
set optimizer_switch='extended_keys=on';
|
|
INSERT INTO t1 VALUES (1,'a'),(2,'b');
|
|
EXPLAIN
|
|
SELECT COUNT(*), pk field1, pk AS field2
|
|
FROM t1 WHERE a = 'r' OR pk = 183
|
|
GROUP BY field1, field2;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where
|
|
SELECT COUNT(*), pk field1, pk AS field2
|
|
FROM t1 WHERE a = 'r' OR pk = 183
|
|
GROUP BY field1, field2;
|
|
COUNT(*) field1 field2
|
|
EXPLAIN
|
|
SELECT COUNT(*), pk field1 FROM t1
|
|
WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where
|
|
SELECT COUNT(*), pk field1 FROM t1
|
|
WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
|
|
COUNT(*) field1
|
|
drop table t1;
|
|
End of 5.5 tests
|
|
set optimizer_switch=@save_ext_key_optimizer_switch;
|