Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3595bbb3
Commit
3595bbb3
authored
Jul 26, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
parents
07acfcf5
2c9eb163
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
504 additions
and
24 deletions
+504
-24
mysql-test/include/mix1.inc
mysql-test/include/mix1.inc
+85
-0
mysql-test/r/create.result
mysql-test/r/create.result
+13
-0
mysql-test/r/having.result
mysql-test/r/having.result
+19
-0
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+268
-0
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+24
-0
mysql-test/t/create.test
mysql-test/t/create.test
+10
-0
mysql-test/t/having.test
mysql-test/t/having.test
+26
-0
mysql-test/t/type_enum.test
mysql-test/t/type_enum.test
+20
-0
sql/field.cc
sql/field.cc
+5
-2
sql/sql_base.cc
sql/sql_base.cc
+0
-7
sql/sql_select.cc
sql/sql_select.cc
+29
-3
sql/table.cc
sql/table.cc
+5
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+0
-12
No files found.
mysql-test/include/mix1.inc
View file @
3595bbb3
...
...
@@ -814,6 +814,91 @@ create table t1 (a int) engine=innodb;
alter
table
t1
alter
a
set
default
1
;
drop
table
t1
;
#
# Bug #28591: MySQL need not sort the records in case of ORDER BY
# primary_key on InnoDB table
#
CREATE
TABLE
t1
(
a
int
,
b
int
,
PRIMARY
KEY
(
a
),
KEY
bkey
(
b
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
,
2
),(
3
,
2
),(
2
,
2
),(
4
,
2
),(
5
,
2
),(
6
,
2
),(
7
,
2
),(
8
,
2
);
INSERT
INTO
t1
SELECT
a
+
8
,
2
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
16
,
1
FROM
t1
;
query_vertical
EXPLAIN
SELECT
*
FROM
t1
WHERE
b
=
2
ORDER
BY
a
;
SELECT
*
FROM
t1
WHERE
b
=
2
ORDER
BY
a
;
query_vertical
EXPLAIN
SELECT
*
FROM
t1
WHERE
b
BETWEEN
1
AND
2
ORDER
BY
a
;
SELECT
*
FROM
t1
WHERE
b
BETWEEN
1
AND
2
ORDER
BY
a
;
query_vertical
EXPLAIN
SELECT
*
FROM
t1
WHERE
b
BETWEEN
1
AND
2
ORDER
BY
b
,
a
;
SELECT
*
FROM
t1
WHERE
b
BETWEEN
1
AND
2
ORDER
BY
b
,
a
;
CREATE
TABLE
t2
(
a
int
,
b
int
,
c
int
,
PRIMARY
KEY
(
a
),
KEY
bkey
(
b
,
c
))
ENGINE
=
InnoDB
;
INSERT
INTO
t2
VALUES
(
1
,
1
,
1
),(
3
,
1
,
1
),(
2
,
1
,
1
),(
4
,
1
,
1
);
INSERT
INTO
t2
SELECT
a
+
4
,
1
,
1
FROM
t2
;
INSERT
INTO
t2
SELECT
a
+
8
,
1
,
1
FROM
t2
;
query_vertical
EXPLAIN
SELECT
*
FROM
t2
WHERE
b
=
1
ORDER
BY
a
;
SELECT
*
FROM
t2
WHERE
b
=
1
ORDER
BY
a
;
query_vertical
EXPLAIN
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
a
;
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
a
;
query_vertical
EXPLAIN
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
b
,
c
,
a
;
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
b
,
c
,
a
;
query_vertical
EXPLAIN
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
c
,
a
;
SELECT
*
FROM
t2
WHERE
b
=
1
AND
c
=
1
ORDER
BY
c
,
a
;
DROP
TABLE
t1
,
t2
;
#
# Bug #29644: alter table hangs if records locked in share mode by long
# running transaction
#
CREATE
TABLE
t1
(
a
INT
,
PRIMARY
KEY
(
a
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
INSERT
INTO
t1
SELECT
a
+
8
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
16
FROM
t1
;
DELIMITER
|
;
CREATE
PROCEDURE
p1
()
BEGIN
DECLARE
i
INT
DEFAULT
50
;
DECLARE
cnt
INT
;
START
TRANSACTION
;
ALTER
TABLE
t1
ENGINE
=
InnoDB
;
COMMIT
;
START
TRANSACTION
;
WHILE
(
i
>
0
)
DO
SET
i
=
i
-
1
;
SELECT
COUNT
(
*
)
INTO
cnt
FROM
t1
LOCK
IN
SHARE
MODE
;
END
WHILE
;
COMMIT
;
END
;
|
DELIMITER
;
|
CONNECT
(
con1
,
localhost
,
root
,,);
CONNECT
(
con2
,
localhost
,
root
,,);
CONNECTION
con1
;
SEND
CALL
p1
();
CONNECTION
con2
;
SEND
CALL
p1
();
CONNECTION
default
;
CALL
p1
();
CONNECTION
con1
;
REAP
;
CONNECTION
con2
;
REAP
;
CONNECTION
default
;
DISCONNECT
con1
;
DISCONNECT
con2
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
...
...
mysql-test/r/create.result
View file @
3595bbb3
...
...
@@ -1516,6 +1516,19 @@ t1 CREATE TABLE `t1` (
`c17` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(f1 int,f2 int);
insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
flush status;
create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 7
drop table t1,t2;
End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
...
...
mysql-test/r/having.result
View file @
3595bbb3
...
...
@@ -158,6 +158,25 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
DROP table t1;
CREATE TABLE t1 (a int PRIMARY KEY);
CREATE TABLE t2 (b int PRIMARY KEY, a int);
CREATE TABLE t3 (b int, flag int);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
INSERT INTO t3(b,flag) VALUES (2, 1);
SELECT t1.a
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
a
SELECT DISTINCT t1.a, MAX(t3.flag)
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
a MAX(t3.flag)
SELECT DISTINCT t1.a
FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
a
DROP TABLE t1,t2,t3;
create table t1 (col1 int, col2 varchar(5), col_t1 int);
create table t2 (col1 int, col2 varchar(5), col_t2 int);
create table t3 (col1 int, col2 varchar(5), col_t3 int);
...
...
mysql-test/r/innodb_mysql.result
View file @
3595bbb3
...
...
@@ -814,6 +814,274 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1;
drop table t1;
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
INSERT INTO t1 SELECT a + 8, 2 FROM t1;
INSERT INTO t1 SELECT a + 16, 1 FROM t1;
EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
id 1
select_type SIMPLE
table t1
type ref
possible_keys bkey
key bkey
key_len 5
ref const
rows 16
Extra Using where; Using index
SELECT * FROM t1 WHERE b=2 ORDER BY a;
a b
1 2
2 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
10 2
11 2
12 2
13 2
14 2
15 2
16 2
EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
id 1
select_type SIMPLE
table t1
type range
possible_keys bkey
key bkey
key_len 5
ref NULL
rows 16
Extra Using where; Using index; Using filesort
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
a b
1 2
2 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
10 2
11 2
12 2
13 2
14 2
15 2
16 2
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
id 1
select_type SIMPLE
table t1
type range
possible_keys bkey
key bkey
key_len 5
ref NULL
rows 16
Extra Using where; Using index
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
a b
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
1 2
2 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
10 2
11 2
12 2
13 2
14 2
15 2
16 2
CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
id 1
select_type SIMPLE
table t2
type ref
possible_keys bkey
key bkey
key_len 5
ref const
rows 8
Extra Using where; Using index; Using filesort
SELECT * FROM t2 WHERE b=1 ORDER BY a;
a b c
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1
9 1 1
10 1 1
11 1 1
12 1 1
13 1 1
14 1 1
15 1 1
16 1 1
EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
id 1
select_type SIMPLE
table t2
type ref
possible_keys bkey
key bkey
key_len 10
ref const,const
rows 8
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
a b c
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1
9 1 1
10 1 1
11 1 1
12 1 1
13 1 1
14 1 1
15 1 1
16 1 1
EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
id 1
select_type SIMPLE
table t2
type ref
possible_keys bkey
key bkey
key_len 10
ref const,const
rows 8
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
a b c
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1
9 1 1
10 1 1
11 1 1
12 1 1
13 1 1
14 1 1
15 1 1
16 1 1
EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
id 1
select_type SIMPLE
table t2
type ref
possible_keys bkey
key bkey
key_len 10
ref const,const
rows 8
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
a b c
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 1 1
9 1 1
10 1 1
11 1 1
12 1 1
13 1 1
14 1 1
15 1 1
16 1 1
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t1 SELECT a + 8 FROM t1;
INSERT INTO t1 SELECT a + 16 FROM t1;
CREATE PROCEDURE p1 ()
BEGIN
DECLARE i INT DEFAULT 50;
DECLARE cnt INT;
START TRANSACTION;
ALTER TABLE t1 ENGINE=InnoDB;
COMMIT;
START TRANSACTION;
WHILE (i > 0) DO
SET i = i - 1;
SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
END WHILE;
COMMIT;
END;|
CALL p1();
CALL p1();
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
End of 5.0 tests
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
...
...
mysql-test/r/type_enum.result
View file @
3595bbb3
...
...
@@ -1829,4 +1829,28 @@ c1 + 0
0
2
DROP TABLE t1,t2;
CREATE TABLE t1(a enum('a','b','c','d'));
INSERT INTO t1 VALUES (4),(1),(0),(3);
Warnings:
Warning 1265 Data truncated for column 'a' at row 3
SELECT a FROM t1;
a
d
a
c
EXPLAIN SELECT a FROM t1 WHERE a=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
SELECT a FROM t1 WHERE a=0;
a
ALTER TABLE t1 ADD PRIMARY KEY (a);
EXPLAIN SELECT a FROM t1 WHERE a=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 1 const 1 Using index
SELECT a FROM t1 WHERE a=0;
a
DROP TABLE t1;
End of 5.1 tests
...
...
mysql-test/t/create.test
View file @
3595bbb3
...
...
@@ -1123,6 +1123,16 @@ show create table t1;
drop
table
t1
;
#
# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
#
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
value
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
2
,
1
),(
2
,
2
),(
2
,
3
);
flush
status
;
create
table
t2
select
sql_big_result
f1
,
count
(
f2
)
from
t1
group
by
f1
;
show
status
like
'handler_read%'
;
drop
table
t1
,
t2
;
--
echo
End
of
5.0
tests
#
...
...
mysql-test/t/having.test
View file @
3595bbb3
...
...
@@ -151,6 +151,32 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
DROP
table
t1
;
#
# Bug #29911: HAVING clause depending on constant table and evaluated to false
#
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
);
CREATE
TABLE
t2
(
b
int
PRIMARY
KEY
,
a
int
);
CREATE
TABLE
t3
(
b
int
,
flag
int
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
1
,
1
),
(
2
,
1
),
(
3
,
1
);
INSERT
INTO
t3
(
b
,
flag
)
VALUES
(
2
,
1
);
SELECT
t1
.
a
FROM
t1
INNER
JOIN
t2
ON
t1
.
a
=
t2
.
a
LEFT
JOIN
t3
ON
t2
.
b
=
t3
.
b
GROUP
BY
t1
.
a
,
t2
.
b
HAVING
MAX
(
t3
.
flag
)
=
0
;
SELECT
DISTINCT
t1
.
a
,
MAX
(
t3
.
flag
)
FROM
t1
INNER
JOIN
t2
ON
t1
.
a
=
t2
.
a
LEFT
JOIN
t3
ON
t2
.
b
=
t3
.
b
GROUP
BY
t1
.
a
,
t2
.
b
HAVING
MAX
(
t3
.
flag
)
=
0
;
SELECT
DISTINCT
t1
.
a
FROM
t1
INNER
JOIN
t2
ON
t1
.
a
=
t2
.
a
LEFT
JOIN
t3
ON
t2
.
b
=
t3
.
b
GROUP
BY
t1
.
a
,
t2
.
b
HAVING
MAX
(
t3
.
flag
)
=
0
;
DROP
TABLE
t1
,
t2
,
t3
;
# End of 4.1 tests
#
...
...
mysql-test/t/type_enum.test
View file @
3595bbb3
...
...
@@ -200,4 +200,24 @@ CREATE TABLE t2 SELECT * FROM t1;
SELECT c1 + 0 FROM t2;
DROP TABLE t1,t2;
#
# Bug#29661: Lookup by 0 for a primary index over a enum type
#
CREATE TABLE t1(a enum('
a
','
b
','
c
','
d
'
));
INSERT
INTO
t1
VALUES
(
4
),(
1
),(
0
),(
3
);
SELECT
a
FROM
t1
;
EXPLAIN
SELECT
a
FROM
t1
WHERE
a
=
0
;
SELECT
a
FROM
t1
WHERE
a
=
0
;
ALTER
TABLE
t1
ADD
PRIMARY
KEY
(
a
);
EXPLAIN
SELECT
a
FROM
t1
WHERE
a
=
0
;
SELECT
a
FROM
t1
WHERE
a
=
0
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
...
...
sql/field.cc
View file @
3595bbb3
...
...
@@ -7901,8 +7901,11 @@ int Field_enum::store(longlong nr, bool unsigned_val)
if
((
ulonglong
)
nr
>
typelib
->
count
||
nr
==
0
)
{
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
1
);
nr
=
0
;
error
=
1
;
if
(
nr
!=
0
||
table
->
in_use
->
count_cuted_fields
)
{
nr
=
0
;
error
=
1
;
}
}
store_type
((
ulonglong
)
(
uint
)
nr
);
return
error
;
...
...
sql/sql_base.cc
View file @
3595bbb3
...
...
@@ -3797,13 +3797,6 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
if
(
table
)
{
#if defined( __WIN__)
/* Win32 can't drop a file that is open */
if
(
lock_type
==
TL_WRITE_ALLOW_READ
)
{
lock_type
=
TL_WRITE
;
}
#endif
/* __WIN__ */
table_list
->
lock_type
=
lock_type
;
table_list
->
table
=
table
;
table
->
grant
=
table_list
->
grant
;
...
...
sql/sql_select.cc
View file @
3595bbb3
...
...
@@ -12289,6 +12289,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
key_part_end
=
key_part
+
table
->
key_info
[
idx
].
key_parts
;
key_part_map
const_key_parts
=
table
->
const_key_parts
[
idx
];
int
reverse
=
0
;
my_bool
on_primary_key
=
FALSE
;
DBUG_ENTER
(
"test_if_order_by_key"
);
for
(;
order
;
order
=
order
->
next
,
const_key_parts
>>=
1
)
...
...
@@ -12303,7 +12304,31 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
for
(;
const_key_parts
&
1
;
const_key_parts
>>=
1
)
key_part
++
;
if
(
key_part
==
key_part_end
||
key_part
->
field
!=
field
)
if
(
key_part
==
key_part_end
)
{
/*
We are at the end of the key. Check if the engine has the primary
key as a suffix to the secondary keys. If it has continue to check
the primary key as a suffix.
*/
if
(
!
on_primary_key
&&
(
table
->
file
->
table_flags
()
&
HA_PRIMARY_KEY_IN_READ_INDEX
)
&&
table
->
s
->
db_type
==
DB_TYPE_INNODB
&&
table
->
s
->
primary_key
!=
MAX_KEY
)
{
on_primary_key
=
TRUE
;
key_part
=
table
->
key_info
[
table
->
s
->
primary_key
].
key_part
;
key_part_end
=
key_part
+
table
->
key_info
[
table
->
s
->
primary_key
].
key_parts
;
const_key_parts
=
table
->
const_key_parts
[
table
->
s
->
primary_key
];
for
(;
const_key_parts
&
1
;
const_key_parts
>>=
1
)
key_part
++
;
}
else
DBUG_RETURN
(
0
);
}
if
(
key_part
->
field
!=
field
)
DBUG_RETURN
(
0
);
/* set flag to 1 if we can use read-next on key, else to -1 */
...
...
@@ -12314,7 +12339,8 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
reverse
=
flag
;
// Remember if reverse
key_part
++
;
}
*
used_key_parts
=
(
uint
)
(
key_part
-
table
->
key_info
[
idx
].
key_part
);
*
used_key_parts
=
on_primary_key
?
table
->
key_info
[
idx
].
key_parts
:
(
uint
)
(
key_part
-
table
->
key_info
[
idx
].
key_part
);
if
(
reverse
==
-
1
&&
!
(
table
->
file
->
index_flags
(
idx
,
*
used_key_parts
-
1
,
1
)
&
HA_READ_PREV
))
reverse
=
0
;
// Index can't be used
...
...
@@ -13030,7 +13056,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
field_count
++
;
}
if
(
!
field_count
&&
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
))
if
(
!
field_count
&&
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
)
&&
!
having
)
{
// only const items with no OPTION_FOUND_ROWS
join
->
unit
->
select_limit_cnt
=
1
;
// Only send first row
DBUG_RETURN
(
0
);
...
...
sql/table.cc
View file @
3595bbb3
...
...
@@ -1349,7 +1349,12 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
the primary key, then we can use any key to find this column
*/
if
(
ha_option
&
HA_PRIMARY_KEY_IN_READ_INDEX
)
{
field
->
part_of_key
=
share
->
keys_in_use
;
if
(
share
->
db_type
==
DB_TYPE_INNODB
&&
field
->
part_of_sortkey
.
is_set
(
key
))
field
->
part_of_sortkey
=
share
->
keys_in_use
;
}
}
if
(
field
->
key_length
()
!=
key_part
->
length
)
{
...
...
storage/innobase/handler/ha_innodb.cc
View file @
3595bbb3
...
...
@@ -7042,18 +7042,6 @@ ha_innobase::store_lock(
&&
!
thd_tablespace_op
(
thd
)
&&
sql_command
!=
SQLCOM_TRUNCATE
&&
sql_command
!=
SQLCOM_OPTIMIZE
#ifdef __WIN__
/* For alter table on win32 for successful
operation completion it is used TL_WRITE(=10) lock
instead of TL_WRITE_ALLOW_READ(=6), however here
in innodb handler TL_WRITE is lifted to
TL_WRITE_ALLOW_WRITE, which causes race condition
when several clients do alter table simultaneously
(bug #17264). This fix avoids the problem. */
&&
sql_command
!=
SQLCOM_ALTER_TABLE
#endif
&&
sql_command
!=
SQLCOM_CREATE_TABLE
)
{
lock_type
=
TL_WRITE_ALLOW_WRITE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment