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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7bf81b15
Commit
7bf81b15
authored
Nov 23, 2010
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.1-bugteam->5.5-bugteam merge
parents
2d1d7b13
cf0cc723
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
0 deletions
+96
-0
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+41
-0
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/innodb/t/innodb_mysql.test
+43
-0
sql/opt_range.h
sql/opt_range.h
+3
-0
sql/records.cc
sql/records.cc
+9
-0
No files found.
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
7bf81b15
...
...
@@ -2622,6 +2622,47 @@ SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
ERROR 22007: Incorrect datetime value: '' for column 'NOW()' at row 2
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
#
# Bug#56862 Execution of a query that uses index merge returns a wrong result
#
CREATE TABLE t1 (
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
a int,
b int,
INDEX idx(a))
ENGINE=INNODB;
INSERT INTO t1(a,b) VALUES
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1(a,b) SELECT a,b FROM t1;
INSERT INTO t1 VALUES (1000000, 0, 0);
SET SESSION sort_buffer_size = 1024*36;
EXPLAIN
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1536 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
1537
SET SESSION sort_buffer_size = DEFAULT;
DROP TABLE t1;
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
...
...
mysql-test/suite/innodb/t/innodb_mysql.test
View file @
7bf81b15
...
...
@@ -786,6 +786,49 @@ CREATE TABLE t2
DROP
TABLE
t1
;
SET
SQL_MODE
=
DEFAULT
;
--
echo
#
--
echo
# Bug#56862 Execution of a query that uses index merge returns a wrong result
--
echo
#
CREATE
TABLE
t1
(
pk
int
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
a
int
,
b
int
,
INDEX
idx
(
a
))
ENGINE
=
INNODB
;
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
11
,
1100
),
(
2
,
200
),
(
1
,
100
),
(
14
,
1400
),
(
5
,
500
),
(
3
,
300
),
(
17
,
1700
),
(
4
,
400
),
(
12
,
1200
),
(
8
,
800
),
(
6
,
600
),
(
18
,
1800
),
(
9
,
900
),
(
10
,
1000
),
(
7
,
700
),
(
13
,
1300
),
(
15
,
1500
),
(
19
,
1900
),
(
16
,
1600
),
(
20
,
2000
);
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
20
,
b
+
2000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
40
,
b
+
4000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
+
80
,
b
+
8000
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
(
a
,
b
)
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
t1
VALUES
(
1000000
,
0
,
0
);
SET
SESSION
sort_buffer_size
=
1024
*
36
;
EXPLAIN
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
FORCE
INDEX
(
idx
,
PRIMARY
)
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
SELECT
COUNT
(
*
)
FROM
(
SELECT
*
FROM
t1
FORCE
INDEX
(
idx
,
PRIMARY
)
WHERE
a
BETWEEN
2
AND
7
OR
pk
=
1000000
)
AS
t
;
SET
SESSION
sort_buffer_size
=
DEFAULT
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
...
...
sql/opt_range.h
View file @
7bf81b15
...
...
@@ -279,6 +279,7 @@ class QUICK_SELECT_I
virtual
bool
reverse_sorted
()
=
0
;
virtual
bool
unique_key_range
()
{
return
false
;
}
virtual
bool
clustered_pk_range
()
{
return
false
;
}
enum
{
QS_TYPE_RANGE
=
0
,
...
...
@@ -553,6 +554,8 @@ class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
THD
*
thd
;
int
read_keys_and_merge
();
bool
clustered_pk_range
()
{
return
test
(
pk_quick_select
);
}
/* used to get rows collected in Unique */
READ_RECORD
read_record
;
};
...
...
sql/records.cc
View file @
7bf81b15
...
...
@@ -206,6 +206,15 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
if
(
select
&&
my_b_inited
(
&
select
->
file
))
tempfile
=
&
select
->
file
;
else
if
(
select
&&
select
->
quick
&&
select
->
quick
->
clustered_pk_range
())
{
/*
In case of QUICK_INDEX_MERGE_SELECT with clustered pk range we have to
use its own access method(i.e QUICK_INDEX_MERGE_SELECT::get_next()) as
sort file does not contain rowids which satisfy clustered pk range.
*/
tempfile
=
0
;
}
else
tempfile
=
table
->
sort
.
io_cache
;
if
(
tempfile
&&
my_b_inited
(
tempfile
))
// Test if ref-records was used
...
...
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