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
a1108a0b
Commit
a1108a0b
authored
Nov 01, 2012
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.2 -> 5.3
parents
9b6fe965
8b5d345e
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
875 additions
and
84 deletions
+875
-84
mysql-test/r/heap_hash.result
mysql-test/r/heap_hash.result
+20
-0
mysql-test/r/partition.result
mysql-test/r/partition.result
+6
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+110
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+110
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+110
-0
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+110
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+110
-0
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+35
-3
mysql-test/t/heap_hash.test
mysql-test/t/heap_hash.test
+17
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+8
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+76
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+29
-0
sql/ha_partition.cc
sql/ha_partition.cc
+2
-2
sql/item_func.h
sql/item_func.h
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+84
-42
storage/heap/hp_rkey.c
storage/heap/hp_rkey.c
+1
-1
storage/maria/ha_maria.cc
storage/maria/ha_maria.cc
+4
-3
storage/maria/ma_test2.c
storage/maria/ma_test2.c
+33
-32
storage/pbxt/plug.in
storage/pbxt/plug.in
+1
-1
No files found.
mysql-test/r/heap_hash.result
View file @
a1108a0b
...
...
@@ -382,6 +382,26 @@ INSERT INTO t1 VALUES('A ', 'A ');
ERROR 23000: Duplicate entry 'A -A ' for key 'key1'
DROP TABLE t1;
End of 5.0 tests
#
# MDEV-568 (AKA LP BUG#1007981, AKA MySQL bug#44771)
# Wrong result for a hash index look-up if the index is unique and
# the key is NULL
#
CREATE TABLE t1 ( pk INT PRIMARY KEY, val INT, UNIQUE KEY USING HASH(val)) ENGINE=MEMORY;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (2, NULL);
INSERT INTO t1 VALUES (3, 1);
INSERT INTO t1 VALUES (4, NULL);
EXPLAIN SELECT * FROM t1 WHERE val IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref val val 5 const 1 Using where
SELECT * FROM t1 WHERE val IS NULL;
pk val
4 NULL
2 NULL
1 NULL
drop table t1;
End of 5.2 tests
# bit index in heap tables
create table t1 (a bit(63) not null) engine=heap;
insert into t1 values (869751),(736494),(226312),(802616),(728912);
...
...
mysql-test/r/partition.result
View file @
a1108a0b
...
...
@@ -2252,6 +2252,12 @@ HAVING b > geomfromtext("")
);
1
DROP TABLE t1;
MDEV-612 Valgrind error in ha_maria::check_if_incompatible_data
CREATE TABLE t1 (a INT, b INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
ALTER TABLE t1 ADD KEY (b);
drop table t1;
End of 5.1 tests
#
# BUG#598247: partition.test produces valgrind errors in 5.3-based branches
...
...
mysql-test/r/subselect.result
View file @
a1108a0b
...
...
@@ -5655,6 +5655,116 @@ WHERE (col_varchar_nokey, 'x') IN
col_int_nokey
1
DROP TABLE ot,it1,it2;
#
# MDEV-746
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
# HAS AN EMPTY RESULT
#
CREATE TABLE t1 (
pk int NOT NULL,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
CREATE TABLE t2 (
pk int NOT NULL AUTO_INCREMENT,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
SET @var2:=4, @var3:=8;
Testcase without inner subquery
EXPLAIN SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
Testcase with inner subquery; crashed WL#6095
SET @var3=8;
EXPLAIN SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
...
...
mysql-test/r/subselect_no_mat.result
View file @
a1108a0b
...
...
@@ -5654,6 +5654,116 @@ WHERE (col_varchar_nokey, 'x') IN
col_int_nokey
1
DROP TABLE ot,it1,it2;
#
# MDEV-746
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
# HAS AN EMPTY RESULT
#
CREATE TABLE t1 (
pk int NOT NULL,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
CREATE TABLE t2 (
pk int NOT NULL AUTO_INCREMENT,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
SET @var2:=4, @var3:=8;
Testcase without inner subquery
EXPLAIN SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
Testcase with inner subquery; crashed WL#6095
SET @var3=8;
EXPLAIN SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
...
...
mysql-test/r/subselect_no_opts.result
View file @
a1108a0b
...
...
@@ -5650,6 +5650,116 @@ WHERE (col_varchar_nokey, 'x') IN
col_int_nokey
1
DROP TABLE ot,it1,it2;
#
# MDEV-746
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
# HAS AN EMPTY RESULT
#
CREATE TABLE t1 (
pk int NOT NULL,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
CREATE TABLE t2 (
pk int NOT NULL AUTO_INCREMENT,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
SET @var2:=4, @var3:=8;
Testcase without inner subquery
EXPLAIN SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
Testcase with inner subquery; crashed WL#6095
SET @var3=8;
EXPLAIN SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
...
...
mysql-test/r/subselect_no_scache.result
View file @
a1108a0b
...
...
@@ -5661,6 +5661,116 @@ WHERE (col_varchar_nokey, 'x') IN
col_int_nokey
1
DROP TABLE ot,it1,it2;
#
# MDEV-746
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
# HAS AN EMPTY RESULT
#
CREATE TABLE t1 (
pk int NOT NULL,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
CREATE TABLE t2 (
pk int NOT NULL AUTO_INCREMENT,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
SET @var2:=4, @var3:=8;
Testcase without inner subquery
EXPLAIN SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
Testcase with inner subquery; crashed WL#6095
SET @var3=8;
EXPLAIN SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
a1108a0b
...
...
@@ -5650,6 +5650,116 @@ WHERE (col_varchar_nokey, 'x') IN
col_int_nokey
1
DROP TABLE ot,it1,it2;
#
# MDEV-746
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
# HAS AN EMPTY RESULT
#
CREATE TABLE t1 (
pk int NOT NULL,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
CREATE TABLE t2 (
pk int NOT NULL AUTO_INCREMENT,
col_int_nokey int NOT NULL,
col_int_key int NOT NULL,
col_time_key time NOT NULL,
col_varchar_key varchar(1) NOT NULL,
col_varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_time_key (col_time_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
SET @var2:=4, @var3:=8;
Testcase without inner subquery
EXPLAIN SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
SELECT @var3;
@var3
8
Testcase with inner subquery; crashed WL#6095
SET @var3=8;
EXPLAIN SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3));
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
SELECT * FROM ( SELECT sq4_alias1.*
FROM t1 AS sq4_alias1
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
NOT IN
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
FROM t2 AS c_sq1_alias1
WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
...
...
mysql-test/r/user_var.result
View file @
a1108a0b
...
...
@@ -348,9 +348,9 @@ select @a:=f3, count(f3) from t1 group by 1 desc;
1.5 4
select @a:=f4, count(f4) from t1 group by 1 desc;
@a:=f4 count(f4)
4
.6 1
3.6 2
2.6 1
1
.6 1
1.6 1
1.6 2
1.6 4
drop table t1;
create table t1 (f1 int);
...
...
@@ -464,3 +464,35 @@ GROUP BY @b:=(SELECT COUNT(*) > t2.a);
1
DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0);
SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
AS b FROM t1 GROUP BY a;
b
1
SELECT @a;
@a
1
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES (1);
SET @var=NULL;
SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
LIMIT 1;
@var:=(SELECT f2 FROM t2 WHERE @var)
NULL
SELECT @var;
@var
NULL
DROP TABLE t1, t2;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(1),(3);
SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
b
1
SELECT @a;
@a
1
DROP TABLE t1;
mysql-test/t/heap_hash.test
View file @
a1108a0b
...
...
@@ -285,6 +285,23 @@ DROP TABLE t1;
--
echo
End
of
5.0
tests
--
echo
#
--
echo
# MDEV-568 (AKA LP BUG#1007981, AKA MySQL bug#44771)
--
echo
# Wrong result for a hash index look-up if the index is unique and
--
echo
# the key is NULL
--
echo
#
CREATE
TABLE
t1
(
pk
INT
PRIMARY
KEY
,
val
INT
,
UNIQUE
KEY
USING
HASH
(
val
))
ENGINE
=
MEMORY
;
INSERT
INTO
t1
VALUES
(
1
,
NULL
);
INSERT
INTO
t1
VALUES
(
2
,
NULL
);
INSERT
INTO
t1
VALUES
(
3
,
1
);
INSERT
INTO
t1
VALUES
(
4
,
NULL
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
val
IS
NULL
;
SELECT
*
FROM
t1
WHERE
val
IS
NULL
;
drop
table
t1
;
--
echo
End
of
5.2
tests
--
echo
# bit index in heap tables
create
table
t1
(
a
bit
(
63
)
not
null
)
engine
=
heap
;
...
...
mysql-test/t/partition.test
View file @
a1108a0b
...
...
@@ -2267,6 +2267,14 @@ SELECT 1 FROM t1 WHERE b < SOME
DROP
TABLE
t1
;
--
echo
--
echo
MDEV
-
612
Valgrind
error
in
ha_maria
::
check_if_incompatible_data
--
echo
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
(
a
))
ENGINE
=
Aria
PARTITION
BY
KEY
(
a
)
PARTITIONS
2
;
ALTER
TABLE
t1
ADD
KEY
(
b
);
drop
table
t1
;
--
echo
End
of
5.1
tests
...
...
mysql-test/t/subselect.test
View file @
a1108a0b
...
...
@@ -4754,6 +4754,82 @@ SELECT col_int_nokey FROM ot
DROP
TABLE
ot
,
it1
,
it2
;
--
echo
#
--
echo
# MDEV-746
--
echo
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
--
echo
# HAS AN EMPTY RESULT
--
echo
#
CREATE
TABLE
t1
(
pk
int
NOT
NULL
,
col_int_nokey
int
NOT
NULL
,
col_int_key
int
NOT
NULL
,
col_time_key
time
NOT
NULL
,
col_varchar_key
varchar
(
1
)
NOT
NULL
,
col_varchar_nokey
varchar
(
1
)
NOT
NULL
,
PRIMARY
KEY
(
pk
),
KEY
col_int_key
(
col_int_key
),
KEY
col_time_key
(
col_time_key
),
KEY
col_varchar_key
(
col_varchar_key
,
col_int_key
)
)
ENGINE
=
MyISAM
;
CREATE
TABLE
t2
(
pk
int
NOT
NULL
AUTO_INCREMENT
,
col_int_nokey
int
NOT
NULL
,
col_int_key
int
NOT
NULL
,
col_time_key
time
NOT
NULL
,
col_varchar_key
varchar
(
1
)
NOT
NULL
,
col_varchar_nokey
varchar
(
1
)
NOT
NULL
,
PRIMARY
KEY
(
pk
),
KEY
col_int_key
(
col_int_key
),
KEY
col_time_key
(
col_time_key
),
KEY
col_varchar_key
(
col_varchar_key
,
col_int_key
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
1
,
4
,
4
,
'00:00:00'
,
'b'
,
'b'
);
SET
@
var2
:=
4
,
@
var3
:=
8
;
--
echo
--
echo
Testcase
without
inner
subquery
let
$subq
=
SELECT
@
var3
:=
12
,
sq4_alias1
.*
FROM
t1
AS
sq4_alias1
WHERE
(
sq4_alias1
.
col_varchar_key
+
NULL
)
IS
NULL
OR
sq4_alias1
.
col_varchar_key
=
@
var3
;
eval
EXPLAIN
$subq
;
eval
$subq
;
SELECT
@
var3
;
# Now as derived table:
eval
EXPLAIN
SELECT
*
FROM
(
$subq
)
AS
alias3
;
eval
SELECT
*
FROM
(
$subq
)
AS
alias3
;
SELECT
@
var3
;
--
echo
--
echo
Testcase
with
inner
subquery
;
crashed
WL
#6095
SET
@
var3
=
8
;
let
$subq
=
SELECT
sq4_alias1
.*
FROM
t1
AS
sq4_alias1
WHERE
(
sq4_alias1
.
col_varchar_key
,
sq4_alias1
.
col_varchar_nokey
)
NOT
IN
(
SELECT
c_sq1_alias1
.
col_varchar_key
AS
c_sq1_field1
,
c_sq1_alias1
.
col_varchar_nokey
AS
c_sq1_field2
FROM
t2
AS
c_sq1_alias1
WHERE
(
c_sq1_alias1
.
col_int_nokey
!=
@
var2
OR
c_sq1_alias1
.
pk
!=
@
var3
));
eval
EXPLAIN
$subq
;
eval
$subq
;
# Now as derived table:
eval
EXPLAIN
SELECT
*
FROM
(
$subq
)
AS
alias3
;
eval
SELECT
*
FROM
(
$subq
)
AS
alias3
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.2
tests
--
echo
#
...
...
mysql-test/t/user_var.test
View file @
a1108a0b
...
...
@@ -235,6 +235,7 @@ select @a:=f1, count(f1) from t1 group by 1 desc;
select
@
a
:=
f1
,
count
(
f1
)
from
t1
group
by
1
asc
;
select
@
a
:=
f2
,
count
(
f2
)
from
t1
group
by
1
desc
;
select
@
a
:=
f3
,
count
(
f3
)
from
t1
group
by
1
desc
;
--
sorted_result
select
@
a
:=
f4
,
count
(
f4
)
from
t1
group
by
1
desc
;
drop
table
t1
;
...
...
@@ -377,3 +378,31 @@ GROUP BY @b:=(SELECT COUNT(*) > t2.a);
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
#
# MDEV-616 LP BUG#1002126
# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE ||
# TABLE->FILE->INITED == HANDLER::
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
0
);
SELECT
DISTINCT
POW
(
COUNT
(
*
),
@
a
:=
(
SELECT
1
FROM
t1
LEFT
JOIN
t1
AS
t2
ON
@
a
))
AS
b
FROM
t1
GROUP
BY
a
;
SELECT
@
a
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
f1
INT
,
f2
INT
);
INSERT
INTO
t1
VALUES
(
1
,
2
),(
2
,
3
),(
3
,
1
);
CREATE
TABLE
t2
(
a
INT
);
INSERT
INTO
t2
VALUES
(
1
);
SET
@
var
=
NULL
;
SELECT
@
var
:=
(
SELECT
f2
FROM
t2
WHERE
@
var
)
FROM
t1
GROUP
BY
f1
ORDER
BY
f2
DESC
LIMIT
1
;
SELECT
@
var
;
DROP
TABLE
t1
,
t2
;
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
0
),(
1
),(
3
);
SELECT
DISTINCT
POW
(
COUNT
(
distinct
a
),
@
a
:=
(
SELECT
1
FROM
t1
LEFT
JOIN
t1
AS
t2
ON
@
a
limit
1
))
AS
b
FROM
t1
GROUP
BY
a
;
SELECT
@
a
;
DROP
TABLE
t1
;
sql/ha_partition.cc
View file @
a1108a0b
...
...
@@ -4350,8 +4350,8 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key)
DBUG_ENTER
(
"ha_partition::common_index_read"
);
LINT_INIT
(
key_len
);
/* used if have_start_key==TRUE */
DBUG_PRINT
(
"info"
,
(
"m_ordered
%u m_ordered_scan_ong %u have_start_key
%u"
,
m_ordered
,
m_ordered_scan_ongoing
,
have_start_key
));
DBUG_PRINT
(
"info"
,
(
"m_ordered
: %u have_start_key:
%u"
,
m_ordered
,
have_start_key
));
if
(
have_start_key
)
{
...
...
sql/item_func.h
View file @
a1108a0b
...
...
@@ -1482,6 +1482,15 @@ public:
:
Item_func
(
b
),
cached_result_type
(
INT_RESULT
),
entry
(
NULL
),
entry_thread_id
(
0
),
name
(
a
)
{}
Item_func_set_user_var
(
Item_func_set_user_var
*
item
)
:
Item_func
(
item
),
cached_result_type
(
item
->
cached_result_type
),
entry
(
item
->
entry
),
entry_thread_id
(
item
->
entry_thread_id
),
value
(
item
->
value
),
decimal_buff
(
item
->
decimal_buff
),
null_item
(
item
->
null_item
),
save_result
(
item
->
save_result
),
name
(
item
->
name
)
{
//fixed= 1;
}
enum
Functype
functype
()
const
{
return
SUSERVAR_FUNC
;
}
double
val_real
();
longlong
val_int
();
...
...
sql/sql_select.cc
View file @
a1108a0b
...
...
@@ -1185,11 +1185,9 @@ JOIN::optimize()
DBUG_RETURN
(
1
);
// error == -1
}
if
(
const_table_map
!=
found_const_table_map
&&
!
(
select_options
&
SELECT_DESCRIBE
)
&&
(
!
conds
||
!
(
conds
->
used_tables
()
&
RAND_TABLE_BIT
)
||
select_lex
->
master_unit
()
==
&
thd
->
lex
->
unit
))
// upper level SELECT
!
(
select_options
&
SELECT_DESCRIBE
))
{
// There is at least one empty const table
zero_result_cause
=
"no matching row in const table"
;
DBUG_PRINT
(
"error"
,(
"Error: %s"
,
zero_result_cause
));
error
=
0
;
...
...
@@ -16075,6 +16073,17 @@ int safe_index_read(JOIN_TAB *tab)
}
/**
Reads content of constant table
@param tab table
@param pos position of table in query plan
@retval 0 ok, one row was found or one NULL-complemented row was created
@retval -1 ok, no row was found and no NULL-complemented row was created
@retval 1 error
*/
static
int
join_read_const_table
(
JOIN_TAB
*
tab
,
POSITION
*
pos
)
{
...
...
@@ -16193,6 +16202,16 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
}
/**
Read a constant table when there is at most one matching row, using a table
scan.
@param tab Table to read
@retval 0 Row was found
@retval -1 Row was not found
@retval 1 Got an error (other than row not found) during read
*/
static
int
join_read_system
(
JOIN_TAB
*
tab
)
{
...
...
@@ -16225,12 +16244,9 @@ join_read_system(JOIN_TAB *tab)
@param tab Table to read
@retval
0 Row was found
@retval
-1 Row was not found
@retval
1 Got an error (other than row not found) during read
@retval 0 Row was found
@retval -1 Row was not found
@retval 1 Got an error (other than row not found) during read
*/
static
int
...
...
@@ -20325,40 +20341,66 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
res_selected_fields
.
empty
();
res_all_fields
.
empty
();
uint
i
,
border
=
all_fields
.
elements
-
elements
;
for
(
i
=
0
;
(
item
=
it
++
);
i
++
)
uint
border
=
all_fields
.
elements
-
elements
;
for
(
uint
i
=
0
;
(
item
=
it
++
);
i
++
)
{
Field
*
field
;
if
((
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
||
(
item
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
item
)
->
functype
()
==
Item_func
::
SUSERVAR_FUNC
))
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
item_field
=
item
;
else
else
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
item_field
=
item
->
get_tmp_table_item
(
thd
);
else
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
item
)
->
functype
()
==
Item_func
::
SUSERVAR_FUNC
)
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
field
=
item
->
get_tmp_table_field
();
if
(
field
!=
NULL
)
{
item_field
=
item
->
get_tmp_table_item
(
thd
);
/*
Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise,
we would re-evaluate <expression>, and if expression were
a subquery, this would access already-unlocked tables.
*/
Item_func_set_user_var
*
suv
=
new
Item_func_set_user_var
((
Item_func_set_user_var
*
)
item
);
Item_field
*
new_field
=
new
Item_field
(
field
);
if
(
!
suv
||
!
new_field
||
suv
->
fix_fields
(
thd
,
(
Item
**
)
&
suv
))
DBUG_RETURN
(
true
);
// Fatal error
((
Item
*
)
suv
)
->
name
=
item
->
name
;
/*
We are replacing the argument of Item_func_set_user_var after its
value has been read. The argument's null_value should be set by
now, so we must set it explicitly for the replacement argument
since the null_value may be read without any preceeding call to
val_*().
*/
new_field
->
update_null_value
();
List
<
Item
>
list
;
list
.
push_back
(
new_field
);
suv
->
set_arguments
(
list
);
item_field
=
suv
;
}
else
if
((
field
=
item
->
get_tmp_table_field
()))
else
item_field
=
item
;
}
else
if
((
field
=
item
->
get_tmp_table_field
()))
{
if
(
item
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
field
->
table
->
group
)
item_field
=
((
Item_sum
*
)
item
)
->
result_item
(
field
);
else
item_field
=
(
Item
*
)
new
Item_field
(
field
);
if
(
!
item_field
)
DBUG_RETURN
(
true
);
// Fatal error
if
(
item
->
real_item
()
->
type
()
!=
Item
::
FIELD_ITEM
)
field
->
orig_table
=
0
;
item_field
->
name
=
item
->
name
;
if
(
item
->
type
()
==
Item
::
REF_ITEM
)
{
if
(
item
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
field
->
table
->
group
)
item_field
=
((
Item_sum
*
)
item
)
->
result_item
(
field
);
else
item_field
=
(
Item
*
)
new
Item_field
(
field
);
if
(
!
item_field
)
DBUG_RETURN
(
TRUE
);
// Fatal error
if
(
item
->
real_item
()
->
type
()
!=
Item
::
FIELD_ITEM
)
field
->
orig_table
=
0
;
item_field
->
name
=
item
->
name
;
if
(
item
->
type
()
==
Item
::
REF_ITEM
)
{
Item_field
*
ifield
=
(
Item_field
*
)
item_field
;
Item_ref
*
iref
=
(
Item_ref
*
)
item
;
ifield
->
table_name
=
iref
->
table_name
;
ifield
->
db_name
=
iref
->
db_name
;
}
Item_field
*
ifield
=
(
Item_field
*
)
item_field
;
Item_ref
*
iref
=
(
Item_ref
*
)
item
;
ifield
->
table_name
=
iref
->
table_name
;
ifield
->
db_name
=
iref
->
db_name
;
}
#ifndef DBUG_OFF
if
(
!
item_field
->
name
)
{
...
...
@@ -20370,20 +20412,20 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
item_field
->
name
=
sql_strmake
(
str
.
ptr
(),
str
.
length
());
}
#endif
}
else
item_field
=
item
;
}
else
item_field
=
item
;
res_all_fields
.
push_back
(
item_field
);
ref_pointer_array
[((
i
<
border
)
?
all_fields
.
elements
-
i
-
1
:
i
-
border
)]
=
item_field
;
}
List_iterator_fast
<
Item
>
itr
(
res_all_fields
);
for
(
i
=
0
;
i
<
border
;
i
++
)
for
(
uint
i
=
0
;
i
<
border
;
i
++
)
itr
++
;
itr
.
sublist
(
res_selected_fields
,
elements
);
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
false
);
}
...
...
storage/heap/hp_rkey.c
View file @
a1108a0b
...
...
@@ -64,7 +64,7 @@ int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
info
->
update
=
HA_STATE_NO_KEY
;
DBUG_RETURN
(
my_errno
);
}
if
(
!
(
keyinfo
->
flag
&
HA_NOSAME
)
)
if
(
(
keyinfo
->
flag
&
(
HA_NOSAME
|
HA_NULL_PART_KEY
))
!=
HA_NOSAME
)
memcpy
(
info
->
lastkey
,
key
,
(
size_t
)
keyinfo
->
length
);
}
memcpy
(
record
,
pos
,
(
size_t
)
share
->
reclength
);
...
...
storage/maria/ha_maria.cc
View file @
a1108a0b
...
...
@@ -2528,9 +2528,10 @@ int ha_maria::info(uint flag, my_bool lock_table_share)
errkey
=
maria_info
.
errkey
;
my_store_ptr
(
dup_ref
,
ref_length
,
maria_info
.
dup_key_pos
);
}
/* Faster to always update, than to do it based on flag */
stats
.
update_time
=
maria_info
.
update_time
;
stats
.
auto_increment_value
=
maria_info
.
auto_increment
;
if
(
flag
&
HA_STATUS_TIME
)
stats
.
update_time
=
maria_info
.
update_time
;
if
(
flag
&
HA_STATUS_AUTO
)
stats
.
auto_increment_value
=
maria_info
.
auto_increment
;
return
0
;
}
...
...
storage/maria/ma_test2.c
View file @
a1108a0b
...
...
@@ -50,7 +50,7 @@ static ulong pagecache_size=8192*32;
static
enum
data_file_type
record_type
=
DYNAMIC_RECORD
;
static
uint
keys
=
MARIA_KEYS
,
recant
=
1000
;
static
uint16
key1
[
1001
],
key3
[
500
0
];
static
uint16
key1
[
1001
],
key3
[
500
1
];
static
uchar
record
[
300
],
record2
[
300
],
key
[
100
],
key2
[
100
];
static
uchar
read_record
[
300
],
read_record2
[
300
],
read_record3
[
300
];
static
HA_KEYSEG
glob_keyseg
[
MARIA_KEYS
][
MAX_PARTS
];
...
...
@@ -222,7 +222,7 @@ int main(int argc, char *argv[])
blob_buffer
=
0
;
for
(
i
=
1000
;
i
>
0
;
i
--
)
key1
[
i
]
=
0
;
for
(
i
=
4999
;
i
>
0
;
i
--
)
key3
[
i
]
=
0
;
for
(
i
=
5000
;
i
>
0
;
i
--
)
key3
[
i
]
=
0
;
if
(
!
silent
)
printf
(
"- Creating maria-file
\n
"
);
...
...
@@ -280,7 +280,7 @@ int main(int argc, char *argv[])
if
(
key3
[
n3
]
==
1
&&
first_key
<
3
&&
first_key
+
keys
>=
3
)
{
printf
(
"Error: Didn't get error when writing second key: '%8d'
\n
"
,
n3
);
goto
err
;
goto
err
2
;
}
write_count
++
;
key1
[
n1
]
++
;
key3
[
n3
]
=
1
;
}
...
...
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
key
,
keyinfo
[
0
].
seg
[
0
].
length
))
{
printf
(
"Found wrong record when searching for key:
\"
%s
\"\n
"
,
key
);
goto
err
;
goto
err
2
;
}
if
(
opt_delete
==
(
uint
)
remove_count
)
/* While testing */
goto
end
;
...
...
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
printf
(
"Found wrong record when searching for key:
\"
%s
\"
; Found
\"
%.*s
\"\n
"
,
key
,
keyinfo
[
0
].
seg
[
0
].
length
,
read_record
+
keyinfo
[
0
].
seg
[
0
].
start
);
goto
err
;
goto
err
2
;
}
if
(
use_blob
)
{
...
...
@@ -455,7 +455,7 @@ int main(int argc, char *argv[])
if
(
memcmp
(
read_record
,
read_record2
,
reclength
)
!=
0
)
{
printf
(
"maria_rsame didn't find same record
\n
"
);
goto
err
;
goto
err
2
;
}
info
.
recpos
=
maria_position
(
file
);
if
(
maria_rfirst
(
file
,
read_record2
,
0
)
||
...
...
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
memcmp
(
read_record
,
read_record2
,
reclength
)
!=
0
)
{
printf
(
"maria_rsame_with_pos didn't find same record
\n
"
);
goto
err
;
goto
err
2
;
}
{
int
skr
;
...
...
@@ -484,7 +484,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
)
{
printf
(
"next: Found: %d keys of %d
\n
"
,
ant
,
dupp_keys
);
goto
err
;
goto
err
2
;
}
ant
=
0
;
while
(
maria_rprev
(
file
,
read_record3
,
0
)
==
0
&&
...
...
@@ -492,7 +492,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
)
{
printf
(
"prev: Found: %d records of %d
\n
"
,
ant
,
dupp_keys
);
goto
err
;
goto
err
2
;
}
/* Check of maria_rnext_same */
...
...
@@ -504,7 +504,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
||
my_errno
!=
HA_ERR_END_OF_FILE
)
{
printf
(
"maria_rnext_same: Found: %d records of %d
\n
"
,
ant
,
dupp_keys
);
goto
err
;
goto
err
2
;
}
}
...
...
@@ -531,7 +531,7 @@ int main(int argc, char *argv[])
printf
(
"Can't find last record
\n
"
);
DBUG_DUMP
(
"record2"
,
read_record2
,
reclength
);
DBUG_DUMP
(
"record3"
,
read_record3
,
reclength
);
goto
err
;
goto
err
2
;
}
ant
=
1
;
while
(
maria_rprev
(
file
,
read_record3
,
0
)
==
0
&&
ant
<
write_count
+
10
)
...
...
@@ -539,12 +539,12 @@ int main(int argc, char *argv[])
if
(
ant
!=
write_count
-
opt_delete
)
{
printf
(
"prev: I found: %d records of %d
\n
"
,
ant
,
write_count
);
goto
err
;
goto
err
2
;
}
if
(
bcmp
(
read_record
,
read_record3
,
reclength
))
{
printf
(
"Can't find first record
\n
"
);
goto
err
;
goto
err
2
;
}
if
(
!
silent
)
...
...
@@ -585,7 +585,7 @@ int main(int argc, char *argv[])
if
(
bcmp
(
read_record
+
start
,
key
,(
uint
)
i
))
{
puts
(
"Didn't find right record"
);
goto
err
;
goto
err
2
;
}
}
#endif
...
...
@@ -605,7 +605,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
-
1
)
{
printf
(
"next: I can only find: %d keys of %d
\n
"
,
ant
,
dupp_keys
-
1
);
goto
err
;
goto
err
2
;
}
}
if
(
dupp_keys
>
4
)
...
...
@@ -623,7 +623,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
-
2
)
{
printf
(
"next: I can only find: %d keys of %d
\n
"
,
ant
,
dupp_keys
-
2
);
goto
err
;
goto
err
2
;
}
}
if
(
dupp_keys
>
6
)
...
...
@@ -643,7 +643,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
-
3
)
{
printf
(
"next: I can only find: %d keys of %d
\n
"
,
ant
,
dupp_keys
-
3
);
goto
err
;
goto
err
2
;
}
if
(
!
silent
)
...
...
@@ -658,7 +658,7 @@ int main(int argc, char *argv[])
if
(
ant
!=
dupp_keys
-
4
)
{
printf
(
"next: I can only find: %d keys of %d
\n
"
,
ant
,
dupp_keys
-
4
);
goto
err
;
goto
err
2
;
}
}
...
...
@@ -687,7 +687,7 @@ int main(int argc, char *argv[])
if
(
i
!=
write_count
&&
i
!=
write_count
-
opt_delete
)
{
printf
(
"Found wrong number of rows while scanning table
\n
"
);
goto
err
;
goto
err
2
;
}
if
(
maria_rsame_with_pos
(
file
,
read_record
,
0
,
info
.
recpos
))
...
...
@@ -695,7 +695,7 @@ int main(int argc, char *argv[])
if
(
bcmp
(
read_record
,
read_record2
,
reclength
)
!=
0
)
{
printf
(
"maria_rsame_with_pos didn't find same record
\n
"
);
goto
err
;
goto
err
2
;
}
for
(
i
=
min
(
2
,
keys
)
;
i
--
>
0
;)
...
...
@@ -704,7 +704,7 @@ int main(int argc, char *argv[])
if
(
bcmp
(
read_record
,
read_record2
,
reclength
)
!=
0
)
{
printf
(
"maria_rsame didn't find same record
\n
"
);
goto
err
;
goto
err
2
;
}
}
if
(
!
silent
)
...
...
@@ -731,7 +731,7 @@ int main(int argc, char *argv[])
{
printf
(
"maria_records_range returned %ld; Should be about %ld
\n
"
,
(
long
)
range_records
,(
long
)
info
.
records
);
goto
err
;
goto
err
2
;
}
if
(
verbose
)
{
...
...
@@ -768,7 +768,7 @@ int main(int argc, char *argv[])
{
printf
(
"maria_records_range for key: %d returned %lu; Should be about %lu
\n
"
,
i
,
(
ulong
)
range_records
,
(
ulong
)
records
);
goto
err
;
goto
err
2
;
}
if
(
verbose
&&
records
)
{
...
...
@@ -783,13 +783,13 @@ int main(int argc, char *argv[])
if
(
!
silent
)
printf
(
"- maria_info
\n
"
);
maria_status
(
file
,
&
info
,
HA_STATUS_VARIABLE
|
HA_STATUS_CONST
);
if
(
info
.
records
!=
write_count
-
opt_delete
||
info
.
deleted
>
opt_delete
+
update
||
info
.
keys
!=
keys
)
if
(
info
.
records
!=
write_count
-
opt_delete
||
info
.
deleted
>
opt_delete
+
update
||
info
.
keys
!=
keys
)
{
puts
(
"Wrong info from maria_info"
);
printf
(
"Got: records: %lu delete: %lu i_keys: %d
\n
"
,
(
ulong
)
info
.
records
,
(
ulong
)
info
.
deleted
,
info
.
keys
);
goto
err
;
goto
err
2
;
}
if
(
verbose
)
{
...
...
@@ -828,7 +828,7 @@ int main(int argc, char *argv[])
printf
(
"scan with cache: I can only find: %d records of %d
\n
"
,
ant
,
write_count
-
opt_delete
);
maria_scan_end
(
file
);
goto
err
;
goto
err
2
;
}
if
(
maria_extra
(
file
,
HA_EXTRA_NO_CACHE
,
0
))
{
...
...
@@ -848,7 +848,7 @@ int main(int argc, char *argv[])
printf
(
"scan with cache: I can only find: %d records of %d
\n
"
,
ant
,
write_count
-
opt_delete
);
maria_scan_end
(
file
);
goto
err
;
goto
err
2
;
}
maria_scan_end
(
file
);
...
...
@@ -872,7 +872,7 @@ int main(int argc, char *argv[])
{
printf
(
"maria_rrnd didn't advance filepointer; old: %ld, new: %ld
\n
"
,
(
long
)
lastpos
,
(
long
)
info
.
recpos
);
goto
err
;
goto
err
2
;
}
lastpos
=
info
.
recpos
;
if
(
error
==
0
)
...
...
@@ -897,7 +897,7 @@ int main(int argc, char *argv[])
printf
(
"Found blob with wrong info at %ld
\n
"
,(
long
)
lastpos
);
maria_scan_end
(
file
);
my_errno
=
0
;
goto
err
;
goto
err
2
;
}
}
}
...
...
@@ -920,7 +920,7 @@ int main(int argc, char *argv[])
printf
(
"Deleted only %d of %d records (%d parts)
\n
"
,
opt_delete
,
write_count
,
found_parts
);
maria_scan_end
(
file
);
goto
err
;
goto
err
2
;
}
if
(
testflag
==
6
)
goto
end
;
...
...
@@ -1021,10 +1021,11 @@ reads: %10lu\n",
return
(
0
);
err:
printf
(
"got error: %d when using MARIA-database
\n
"
,
my_errno
);
err2:
if
(
file
)
{
if
(
maria_commit
(
file
))
goto
err
;
printf
(
"got error: %d when using MARIA-database
\n
"
,
my_errno
)
;
VOID
(
maria_close
(
file
));
}
maria_end
();
...
...
storage/pbxt/plug.in
View file @
a1108a0b
MYSQL_STORAGE_ENGINE(pbxt,no, [PBXT Storage Engine],
[MVCC-based transactional engine], [
max,max-no-ndb
])
[MVCC-based transactional engine], [])
MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt_s.la], [src/libpbxt_s_embedded.la])
MYSQL_PLUGIN_ACTIONS(pbxt, [
# AC_CONFIG_FILES(storage/pbxt/src/Makefile)
...
...
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