mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Merge 10.3 into 10.4
This commit is contained in:
commit
dde2ca4aa1
189 changed files with 3274 additions and 1042 deletions
|
@ -22,7 +22,7 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
|
|||
exclude_modules;
|
||||
if which ccache ; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
ccache --max-size=1200M
|
||||
ccache --max-size=2200M
|
||||
fi
|
||||
if [[ "${CXX}" == 'clang++' ]]; then
|
||||
export CXX CC=${CXX/++/}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 17d0e5317604718fc059ee1ad4bd2ea36494226b
|
||||
Subproject commit 334964f0711c3fd027f634a239eee57bc912f7ff
|
|
@ -510,3 +510,14 @@ DROP TABLE t1;
|
|||
SELECT 100 BETWEEN 1 AND 9223372036854775808;
|
||||
100 BETWEEN 1 AND 9223372036854775808
|
||||
1
|
||||
#
|
||||
# MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
|
||||
#
|
||||
CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
|
||||
INSERT INTO t1 VALUES (0),(101),(255);
|
||||
SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
101
|
||||
255
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -416,3 +416,12 @@ DROP TABLE t1;
|
|||
--echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
|
||||
--echo #
|
||||
SELECT 100 BETWEEN 1 AND 9223372036854775808;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
|
||||
INSERT INTO t1 VALUES (0),(101),(255);
|
||||
SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -10403,6 +10403,99 @@ f
|
|||
3
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17574: pushdown into derived from mergeable view
|
||||
# used in multi-table UPDATE
|
||||
# pushdown into materialized derived from mergeable view
|
||||
# used in SELECT
|
||||
#
|
||||
CREATE TABLE t1 (f1 text, f2 int);
|
||||
INSERT INTO t1 VALUES ('x',1), ('y',2);
|
||||
CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
|
||||
UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
|
||||
EXPLAIN FORMAT=JSON UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived3>",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t.f2 < 2",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t1.f2 < 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t1.f2 = t.f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
SELECT * FROM t1;
|
||||
f1 f2
|
||||
z 1
|
||||
y 2
|
||||
CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
|
||||
SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
|
||||
f2 f1 f2
|
||||
1 z 1
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived3>",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t.f2 < 2",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t1.f2 < 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"buffer_size": "256Kb",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "t1.f2 = t.f2"
|
||||
}
|
||||
}
|
||||
}
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# MDEV-14579: pushdown conditions into materialized views/derived tables
|
||||
|
|
|
@ -2075,6 +2075,33 @@ SELECT * FROM t1;
|
|||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17574: pushdown into derived from mergeable view
|
||||
--echo # used in multi-table UPDATE
|
||||
--echo # pushdown into materialized derived from mergeable view
|
||||
--echo # used in SELECT
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f1 text, f2 int);
|
||||
INSERT INTO t1 VALUES ('x',1), ('y',2);
|
||||
|
||||
CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
|
||||
let $q1 =
|
||||
UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
|
||||
eval $q1;
|
||||
eval EXPLAIN FORMAT=JSON $q1;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
|
||||
let $q2 =
|
||||
SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
|
||||
eval $q2;
|
||||
eval EXPLAIN FORMAT=JSON $q2;
|
||||
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1049,4 +1049,24 @@ b1+'0' b2+'0' b3+'0' b4+'0' b5+'0' b6 +'0'
|
|||
1 0 0 1 0 1
|
||||
0 1 0 0 1 0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
|
||||
# or Invalid write in JOIN::make_aggr_tables_info
|
||||
#
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
explain
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
|
||||
UNION
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
|
||||
2 UNCACHEABLE UNION t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
|
||||
UNION
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
End of 5.5 tests
|
||||
|
|
|
@ -798,4 +798,22 @@ CREATE TABLE t1 (b1 BIT, b2 BIT, b3 BIT, b4 BIT , b5 BIT, b6 BIT);
|
|||
INSERT INTO t1 VALUES (1,0,0,1,0,1),(0,1,0,0,1,0);
|
||||
SELECT DISTINCT b1+'0', b2+'0', b3+'0', b4+'0', b5+'0', b6 +'0' FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
|
||||
--echo # or Invalid write in JOIN::make_aggr_tables_info
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
explain
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
|
||||
UNION
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
|
||||
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
|
||||
UNION
|
||||
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
|
|
@ -8,13 +8,21 @@ explain extended select default(str), default(strnull), default(intg), default(r
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default(0) AS `default(intg)`,default(0) AS `default(rel)` from dual
|
||||
Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from dual
|
||||
select * from t1 where str <> default(str);
|
||||
str strnull intg rel
|
||||
0 0
|
||||
explain select * from t1 where str <> default(str);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||
create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
|
||||
select * from v1;
|
||||
default(str) default(strnull) default(intg) default(rel)
|
||||
def NULL 10 3.14
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select default(`t1`.`str`) AS `default(str)`,default(`t1`.`strnull`) AS `default(strnull)`,default(`t1`.`intg`) AS `default(intg)`,default(`t1`.`rel`) AS `default(rel)` from `t1` latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int(11), s varchar(20));
|
||||
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
|
||||
|
|
|
@ -11,6 +11,11 @@ explain extended select default(str), default(strnull), default(intg), default(r
|
|||
select * from t1 where str <> default(str);
|
||||
explain select * from t1 where str <> default(str);
|
||||
|
||||
create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
|
||||
select * from v1;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
|
||||
#TODO: uncomment when bug will be fixed
|
||||
#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1;
|
||||
#show create table from t1;
|
||||
|
|
|
@ -811,6 +811,26 @@ SELECT JSON_MERGE('[1]', '[]');
|
|||
JSON_MERGE('[1]', '[]')
|
||||
[1]
|
||||
#
|
||||
# MDEV-16174 Assertion `0' failed in Type_handler_string_result::
|
||||
# make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
|
||||
#
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (fld varchar(16) NOT NULL);
|
||||
CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1, t2;
|
||||
SET sql_mode=default;
|
||||
#
|
||||
# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
|
||||
#
|
||||
select JSON_VALID( '{"a":1]' );
|
||||
JSON_VALID( '{"a":1]' )
|
||||
0
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
|
|
|
@ -466,6 +466,24 @@ SET @`json` := NULL, @`value` := NULL;
|
|||
|
||||
SELECT JSON_MERGE('[1]', '[]');
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16174 Assertion `0' failed in Type_handler_string_result::
|
||||
--echo # make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
|
||||
--echo #
|
||||
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (fld varchar(16) NOT NULL);
|
||||
CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
DROP TABLE t1, t2;
|
||||
SET sql_mode=default;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
|
||||
--echo #
|
||||
|
||||
select JSON_VALID( '{"a":1]' );
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
|
|
@ -3428,7 +3428,61 @@ DROP TABLE t1,t2;
|
|||
# End of 10.1 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
# MDEV-16217: Assertion `!table || (!table->read_set ||
|
||||
# bitmap_is_set(table->read_set, field_index))'
|
||||
# failed in Field_num::get_date
|
||||
#
|
||||
CREATE TABLE t1 (pk int default 0, a1 date);
|
||||
INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
|
||||
SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;
|
||||
a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk))
|
||||
0
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;
|
||||
a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk))
|
||||
0
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '18446744073709551615'
|
||||
CREATE TABLE t2 (pk int default 1, a1 date);
|
||||
INSERT INTO t2 VALUES (4,NULL);
|
||||
CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2;
|
||||
select * from v2;
|
||||
default(t1.pk) default(t2.pk) pk
|
||||
0 1 1
|
||||
0 1 2
|
||||
0 1 3
|
||||
0 1 4
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select default(`t1`.`pk`) AS `default(t1.pk)`,default(`t2`.`pk`) AS `default(t2.pk)`,`t1`.`pk` AS `pk` from (`t1` join `t2`) latin1 latin1_swedish_ci
|
||||
CREATE view v3 as SELECT default(pk) from t2;
|
||||
select * from v3;
|
||||
default(pk)
|
||||
1
|
||||
explain extended select * from v3;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
|
||||
explain extended select default(pk) from t2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
|
||||
show create view v3;
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select default(`t2`.`pk`) AS `default(pk)` from `t2` latin1 latin1_swedish_ci
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field
|
||||
|
@ -3749,8 +3803,10 @@ CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
|
|||
CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
|
||||
c1 c2 c3
|
||||
2018-08-31 00:00:00 00:00:00
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-14032 SEC_TO_TIME executes side effect two times
|
||||
#
|
||||
SET @a=10000000;
|
||||
|
|
|
@ -1914,9 +1914,36 @@ DROP TABLE t1,t2;
|
|||
--echo # End of 10.1 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16217: Assertion `!table || (!table->read_set ||
|
||||
--echo # bitmap_is_set(table->read_set, field_index))'
|
||||
--echo # failed in Field_num::get_date
|
||||
--echo #
|
||||
CREATE TABLE t1 (pk int default 0, a1 date);
|
||||
INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
|
||||
|
||||
SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;
|
||||
SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;
|
||||
|
||||
CREATE TABLE t2 (pk int default 1, a1 date);
|
||||
INSERT INTO t2 VALUES (4,NULL);
|
||||
CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2;
|
||||
select * from v2;
|
||||
show create view v2;
|
||||
CREATE view v3 as SELECT default(pk) from t2;
|
||||
select * from v3;
|
||||
explain extended select * from v3;
|
||||
explain extended select default(pk) from t2;
|
||||
show create view v3;
|
||||
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
|
@ -2217,7 +2244,9 @@ SELECT
|
|||
CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
|
||||
CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-14032 SEC_TO_TIME executes side effect two times
|
||||
|
|
|
@ -2832,6 +2832,16 @@ select distinct 1 from t1 group by a,b with rollup limit 1;
|
|||
1
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1));
|
||||
explain
|
||||
SELECT 1 FROM t1
|
||||
GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
SELECT 1 FROM t1
|
||||
GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-16170
|
||||
# Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
|
||||
|
|
|
@ -1948,6 +1948,19 @@ insert into t1 values(-126,7),(1,1),(0,0),(-1,1),(351,65534);
|
|||
select distinct 1 from t1 group by a,b with rollup limit 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
|
||||
# or Invalid write in JOIN::make_aggr_tables_info
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1));
|
||||
explain
|
||||
SELECT 1 FROM t1
|
||||
GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
|
||||
SELECT 1 FROM t1
|
||||
GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16170
|
||||
--echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP
|
||||
|
|
|
@ -1704,4 +1704,69 @@ SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
|
|||
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
|
||||
(SELECT
|
||||
1
|
||||
#
|
||||
# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
|
||||
#
|
||||
CREATE TABLE names (names INT);
|
||||
SELECT names FROM names AS names;
|
||||
names
|
||||
DROP TABLE names;
|
||||
CREATE TABLE password (password INT);
|
||||
SELECT password FROM password AS password;
|
||||
password
|
||||
DROP TABLE password;
|
||||
CREATE TABLE role (role INT);
|
||||
SELECT role FROM role AS role;
|
||||
role
|
||||
DROP TABLE role;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE names VARCHAR(32) DEFAULT '[names]';
|
||||
DECLARE password VARCHAR(32) DEFAULT '[password]';
|
||||
DECLARE role VARCHAR(32) DEFAULT '[role]';
|
||||
names:
|
||||
LOOP
|
||||
SELECT names;
|
||||
LEAVE names;
|
||||
END LOOP;
|
||||
password:
|
||||
LOOP
|
||||
SELECT password;
|
||||
LEAVE password;
|
||||
END LOOP;
|
||||
role:
|
||||
LOOP
|
||||
SELECT role;
|
||||
LEAVE role;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
names
|
||||
[names]
|
||||
password
|
||||
[password]
|
||||
role
|
||||
[role]
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE names VARCHAR(32);
|
||||
SET names='[names]';
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE password VARCHAR(32);
|
||||
SET password='[password]';
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE role VARCHAR(32);
|
||||
SET role='[role]';
|
||||
END;
|
||||
$$
|
||||
SELECT @@GLOBAL.names;
|
||||
ERROR HY000: Unknown system variable 'names'
|
||||
SELECT @@GLOBAL.password;
|
||||
ERROR HY000: Unknown system variable 'password'
|
||||
SELECT @@GLOBAL.role;
|
||||
ERROR HY000: Unknown system variable 'role'
|
||||
End of 10.3 tests
|
||||
|
|
|
@ -1462,4 +1462,78 @@ DROP PROCEDURE p1;
|
|||
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
|
||||
1
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
|
||||
--echo #
|
||||
|
||||
CREATE TABLE names (names INT);
|
||||
SELECT names FROM names AS names;
|
||||
DROP TABLE names;
|
||||
|
||||
CREATE TABLE password (password INT);
|
||||
SELECT password FROM password AS password;
|
||||
DROP TABLE password;
|
||||
|
||||
CREATE TABLE role (role INT);
|
||||
SELECT role FROM role AS role;
|
||||
DROP TABLE role;
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE names VARCHAR(32) DEFAULT '[names]';
|
||||
DECLARE password VARCHAR(32) DEFAULT '[password]';
|
||||
DECLARE role VARCHAR(32) DEFAULT '[role]';
|
||||
names:
|
||||
LOOP
|
||||
SELECT names;
|
||||
LEAVE names;
|
||||
END LOOP;
|
||||
password:
|
||||
LOOP
|
||||
SELECT password;
|
||||
LEAVE password;
|
||||
END LOOP;
|
||||
role:
|
||||
LOOP
|
||||
SELECT role;
|
||||
LEAVE role;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE names VARCHAR(32);
|
||||
SET names='[names]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE password VARCHAR(32);
|
||||
SET password='[password]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE role VARCHAR(32);
|
||||
SET role='[role]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.names;
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.password;
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.role;
|
||||
|
||||
--echo End of 10.3 tests
|
||||
|
|
|
@ -899,6 +899,35 @@ ERROR HY000: Table definition has changed, please retry transaction
|
|||
disconnect con1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-11167: InnoDB: Warning: using a partial-field key prefix
|
||||
# in search, results in assertion failure or "Can't find record" error
|
||||
#
|
||||
set @save_sql_mode = @@sql_mode;
|
||||
set sql_mode="";
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2;
|
||||
CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4);
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'three' for column 'b' at row 2
|
||||
UPDATE v SET a = NULL;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
|
||||
DROP view v;
|
||||
DROP TABLE t1, t2;
|
||||
SET @save_isp=@@innodb_stats_persistent;
|
||||
SET GLOBAL innodb_stats_persistent= ON;
|
||||
CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2;
|
||||
INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66);
|
||||
CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION;
|
||||
UPDATE v SET f2 = NULL;
|
||||
ERROR 44000: CHECK OPTION failed `test`.`v`
|
||||
SET GLOBAL innodb_stats_persistent= @save_isp;
|
||||
DROP view v;
|
||||
DROP TABLE t;
|
||||
set sql_mode= @save_sql_mode;
|
||||
#
|
||||
# Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
|
||||
# MYSQL.INNODB_TABLE_STATS
|
||||
#
|
||||
|
@ -925,3 +954,14 @@ test_jfg test_jfg11
|
|||
test_jfg test_jfg12#P#p1000
|
||||
test_jfg test_jfg12#P#pmax
|
||||
DROP DATABASE test_jfg;
|
||||
#
|
||||
# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
|
||||
#
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z))
|
||||
WITH SYSTEM VERSIONING
|
||||
PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
|
||||
INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
|
||||
SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
|
||||
COUNT(*)
|
||||
2
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -988,6 +988,38 @@ SELECT b FROM t1 WHERE b = 0;
|
|||
--disconnect con1
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11167: InnoDB: Warning: using a partial-field key prefix
|
||||
--echo # in search, results in assertion failure or "Can't find record" error
|
||||
--echo #
|
||||
|
||||
set @save_sql_mode = @@sql_mode;
|
||||
set sql_mode="";
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2;
|
||||
CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION;
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4);
|
||||
UPDATE v SET a = NULL;
|
||||
|
||||
DROP view v;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
SET @save_isp=@@innodb_stats_persistent;
|
||||
SET GLOBAL innodb_stats_persistent= ON;
|
||||
|
||||
CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2;
|
||||
INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66);
|
||||
CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION;
|
||||
--error ER_VIEW_CHECK_FAILED
|
||||
UPDATE v SET f2 = NULL;
|
||||
|
||||
SET GLOBAL innodb_stats_persistent= @save_isp;
|
||||
DROP view v;
|
||||
DROP TABLE t;
|
||||
set sql_mode= @save_sql_mode;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
|
||||
--echo # MYSQL.INNODB_TABLE_STATS
|
||||
|
@ -1015,3 +1047,13 @@ SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
|
|||
database_name = 'test_jfg';
|
||||
|
||||
DROP DATABASE test_jfg;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
|
||||
--echo #
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z))
|
||||
WITH SYSTEM VERSIONING
|
||||
PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
|
||||
INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
|
||||
SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
# MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
|
||||
#
|
||||
SET gtid_seq_no=1000;
|
||||
-- Tracker : SESSION_TRACK_SCHEMA
|
||||
-- test
|
||||
|
||||
SET @@session.session_track_system_variables='last_gtid';
|
||||
-- Tracker : SESSION_TRACK_SCHEMA
|
||||
-- test
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
|
|
|
@ -1020,8 +1020,8 @@ i
|
|||
SHOW PROCEDURE CODE p1;
|
||||
Pos Instruction
|
||||
0 set i@0 1
|
||||
1 set [upper_bound]@1 3
|
||||
2 jump_if_not 6(6) i@0 <= [upper_bound]@1
|
||||
1 set [target_bound]@1 3
|
||||
2 jump_if_not 6(6) i@0 <= [target_bound]@1
|
||||
3 stmt 0 "SELECT i"
|
||||
4 set i@0 i@0 + 1
|
||||
5 jump 2
|
||||
|
@ -1058,11 +1058,11 @@ i j
|
|||
SHOW PROCEDURE CODE p1;
|
||||
Pos Instruction
|
||||
0 set i@0 1
|
||||
1 set [upper_bound]@1 3
|
||||
2 jump_if_not 17(17) i@0 <= [upper_bound]@1
|
||||
1 set [target_bound]@1 3
|
||||
2 jump_if_not 17(17) i@0 <= [target_bound]@1
|
||||
3 set j@2 1
|
||||
4 set [upper_bound]@3 3
|
||||
5 jump_if_not 13(13) j@2 <= [upper_bound]@3
|
||||
4 set [target_bound]@3 3
|
||||
5 jump_if_not 13(13) j@2 <= [target_bound]@3
|
||||
6 jump_if_not 8(8) i@0 = 3
|
||||
7 jump 17
|
||||
8 jump_if_not 10(10) j@2 = 3
|
||||
|
|
|
@ -713,3 +713,27 @@ END;
|
|||
$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
|
||||
#
|
||||
CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
|
||||
INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
FOR rec IN (SELECT en1 FROM t1)
|
||||
DO
|
||||
SELECT rec.en1;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
rec.en1
|
||||
aaa
|
||||
rec.en1
|
||||
a
|
||||
rec.en1
|
||||
b
|
||||
rec.en1
|
||||
c
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -723,3 +723,24 @@ $$
|
|||
DELIMITER ;$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
|
||||
INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
FOR rec IN (SELECT en1 FROM t1)
|
||||
DO
|
||||
SELECT rec.en1;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -80,7 +80,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
|
|||
BEGIN
|
||||
DECLARE total INT DEFAULT 0;
|
||||
fori:
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
DO
|
||||
SET total= total + i;
|
||||
IF i = b THEN
|
||||
|
|
|
@ -86,7 +86,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
|
|||
BEGIN
|
||||
DECLARE total INT DEFAULT 0;
|
||||
fori:
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
DO
|
||||
SET total= total + i;
|
||||
IF i = b THEN
|
||||
|
|
|
@ -3362,6 +3362,102 @@ Kaolin Tuning 88 68.7500
|
|||
Tatiana Tuning 83 68.7500
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
|
||||
# or Invalid write in JOIN::make_aggr_tables_info
|
||||
#
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) order by 1+2;
|
||||
BIT_OR(100) OVER ()
|
||||
100
|
||||
CREATE TABLE t1 (i INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER(), i, sum(i)
|
||||
FROM t1
|
||||
WHERE 1=0
|
||||
limit 0
|
||||
) AS sq;
|
||||
ROW_NUMBER() OVER() i sum(i)
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER(), i, sum(i)
|
||||
FROM t1
|
||||
WHERE 1=0
|
||||
GROUP BY i
|
||||
) AS sq;
|
||||
ROW_NUMBER() OVER() i sum(i)
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
explain
|
||||
select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
|
||||
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 distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
|
||||
1 row_number() over (order by 1)
|
||||
drop table t1;
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
|
||||
HAVING @A := 'qwerty';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
|
||||
HAVING @A := 'qwerty';
|
||||
BIT_OR(100) OVER ()
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100)
|
||||
HAVING @A := 'qwerty';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100)
|
||||
HAVING @A := 'qwerty';
|
||||
BIT_OR(100) OVER ()
|
||||
create table t1 (a int);
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM t1
|
||||
GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-13170: Database service (MySQL) stops after update with trigger
|
||||
#
|
||||
CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ;
|
||||
INSERT INTO t1 VALUES (1,1,8884),(2,1,8885);
|
||||
CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int);
|
||||
CREATE TABLE t3 (id1 int, id2 int, d1 int);
|
||||
CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin
|
||||
CREATE OR REPLACE TEMPORARY TABLE trg_u AS
|
||||
WITH l AS
|
||||
(SELECT a.*,
|
||||
Max(t2.col_id) over (PARTITION BY a.d1),
|
||||
Max(t2.new_val) over (PARTITION BY a.d1)
|
||||
FROM
|
||||
(SELECT d1 , id1, id2 FROM t3) a
|
||||
JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr))
|
||||
SELECT 1;
|
||||
END;//
|
||||
update t1 set ml_id=8884 where point_id=1;
|
||||
ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u'
|
||||
update t1 set ml_id=8884 where point_id=1;
|
||||
ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u'
|
||||
drop table t1, t2,t3;
|
||||
CREATE TABLE t1 (i INT, a char);
|
||||
INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
|
||||
create view v1 as select * from t1;
|
||||
PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1";
|
||||
execute stmt;
|
||||
i row_number() over (partition by i order by i)
|
||||
1 1
|
||||
2 1
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
|
|
|
@ -2120,6 +2120,103 @@ FROM t1
|
|||
ORDER BY test, name;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
|
||||
--echo # or Invalid write in JOIN::make_aggr_tables_info
|
||||
--echo #
|
||||
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) order by 1+2;
|
||||
|
||||
CREATE TABLE t1 (i INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER(), i, sum(i)
|
||||
FROM t1
|
||||
WHERE 1=0
|
||||
limit 0
|
||||
) AS sq;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER(), i, sum(i)
|
||||
FROM t1
|
||||
WHERE 1=0
|
||||
GROUP BY i
|
||||
) AS sq;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int);
|
||||
explain
|
||||
select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
|
||||
select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup;
|
||||
drop table t1;
|
||||
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
|
||||
HAVING @A := 'qwerty';
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP
|
||||
HAVING @A := 'qwerty';
|
||||
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100)
|
||||
HAVING @A := 'qwerty';
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM dual
|
||||
GROUP BY LEFT('2018-08-24', 100)
|
||||
HAVING @A := 'qwerty';
|
||||
|
||||
create table t1 (a int);
|
||||
explain
|
||||
SELECT DISTINCT BIT_OR(100) OVER () FROM t1
|
||||
GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13170: Database service (MySQL) stops after update with trigger
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ;
|
||||
INSERT INTO t1 VALUES (1,1,8884),(2,1,8885);
|
||||
|
||||
CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int);
|
||||
CREATE TABLE t3 (id1 int, id2 int, d1 int);
|
||||
|
||||
delimiter //;
|
||||
|
||||
CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin
|
||||
CREATE OR REPLACE TEMPORARY TABLE trg_u AS
|
||||
WITH l AS
|
||||
(SELECT a.*,
|
||||
Max(t2.col_id) over (PARTITION BY a.d1),
|
||||
Max(t2.new_val) over (PARTITION BY a.d1)
|
||||
FROM
|
||||
(SELECT d1 , id1, id2 FROM t3) a
|
||||
JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr))
|
||||
SELECT 1;
|
||||
|
||||
END;//
|
||||
|
||||
delimiter ;//
|
||||
--error 1062
|
||||
update t1 set ml_id=8884 where point_id=1;
|
||||
--error 1062
|
||||
update t1 set ml_id=8884 where point_id=1;
|
||||
drop table t1, t2,t3;
|
||||
|
||||
CREATE TABLE t1 (i INT, a char);
|
||||
INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
|
||||
create view v1 as select * from t1;
|
||||
PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1";
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
|
|
@ -499,3 +499,113 @@ test.comment()
|
|||
Warnings:
|
||||
Note 1585 This function 'comment' has the same name as a native function
|
||||
DROP FUNCTION comment;
|
||||
#
|
||||
# MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without
|
||||
#
|
||||
BEGIN
|
||||
<<date_format>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<decode>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<history>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<system>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<versioning>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<without>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
#
|
||||
# MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
|
||||
#
|
||||
DECLARE
|
||||
ELSEIF INT;
|
||||
BEGIN
|
||||
ELSEIF:=1;
|
||||
END;
|
||||
/
|
||||
BEGIN
|
||||
<<ELSEIF>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
#
|
||||
# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
|
||||
#
|
||||
CREATE TABLE names (names INT);
|
||||
SELECT names FROM names AS names;
|
||||
names
|
||||
DROP TABLE names;
|
||||
CREATE TABLE password (password INT);
|
||||
SELECT password FROM password AS password;
|
||||
password
|
||||
DROP TABLE password;
|
||||
CREATE TABLE role (role INT);
|
||||
SELECT role FROM role AS role;
|
||||
role
|
||||
DROP TABLE role;
|
||||
DECLARE
|
||||
names VARCHAR(32) DEFAULT '[names]';
|
||||
password VARCHAR(32) DEFAULT '[password]';
|
||||
role VARCHAR(32) DEFAULT '[role]';
|
||||
BEGIN
|
||||
<<names>>
|
||||
SELECT names;
|
||||
<<password>>
|
||||
SELECT password;
|
||||
<<role>>
|
||||
SELECT role;
|
||||
END;
|
||||
$$
|
||||
names
|
||||
[names]
|
||||
password
|
||||
[password]
|
||||
role
|
||||
[role]
|
||||
DECLARE
|
||||
names VARCHAR(32);
|
||||
BEGIN
|
||||
SET names='[names]';
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
|
||||
DECLARE
|
||||
password VARCHAR(32);
|
||||
BEGIN
|
||||
SET password='[password]';
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
|
||||
DECLARE
|
||||
role VARCHAR(32);
|
||||
BEGIN
|
||||
SET role='[role]';
|
||||
END;
|
||||
$$
|
||||
SELECT @@GLOBAL.names;
|
||||
ERROR HY000: Unknown system variable 'names'
|
||||
SELECT @@GLOBAL.password;
|
||||
ERROR HY000: Unknown system variable 'password'
|
||||
SELECT @@GLOBAL.role;
|
||||
ERROR HY000: Unknown system variable 'role'
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
|
|
@ -579,8 +579,8 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@2 0
|
||||
1 set i@3 1
|
||||
2 set [upper_bound]@4 a@0
|
||||
3 jump_if_not 9(9) i@3 <= [upper_bound]@4
|
||||
2 set [target_bound]@4 a@0
|
||||
3 jump_if_not 9(9) i@3 <= [target_bound]@4
|
||||
4 set total@2 total@2 + i@3
|
||||
5 jump_if_not 7(7) i@3 = b@1
|
||||
6 jump 9
|
||||
|
@ -598,7 +598,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
|
|||
AS
|
||||
total INT := 0;
|
||||
BEGIN
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
LOOP
|
||||
total:= total + i;
|
||||
IF i = b THEN
|
||||
|
@ -612,8 +612,8 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@2 0
|
||||
1 set i@3 a@0
|
||||
2 set [upper_bound]@4 1
|
||||
3 jump_if_not 9(9) i@3 >= [upper_bound]@4
|
||||
2 set [target_bound]@4 1
|
||||
3 jump_if_not 9(9) i@3 >= [target_bound]@4
|
||||
4 set total@2 total@2 + i@3
|
||||
5 jump_if_not 7(7) i@3 = b@1
|
||||
6 jump 9
|
||||
|
@ -651,12 +651,12 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@4 0
|
||||
1 set ia@5 1
|
||||
2 set [upper_bound]@6 a@0
|
||||
3 jump_if_not 17(17) ia@5 <= [upper_bound]@6
|
||||
2 set [target_bound]@6 a@0
|
||||
3 jump_if_not 17(17) ia@5 <= [target_bound]@6
|
||||
4 set total@4 total@4 + 1000
|
||||
5 set ib@7 1
|
||||
6 set [upper_bound]@8 b@2
|
||||
7 jump_if_not 15(15) ib@7 <= [upper_bound]@8
|
||||
6 set [target_bound]@8 b@2
|
||||
7 jump_if_not 15(15) ib@7 <= [target_bound]@8
|
||||
8 set total@4 total@4 + 1
|
||||
9 jump_if_not 11(0) ib@7 = limitb@3
|
||||
10 jump 15
|
||||
|
@ -698,8 +698,8 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@1 0
|
||||
1 set i@2 1
|
||||
2 set [upper_bound]@3 a@0
|
||||
3 jump_if_not 11(11) i@2 <= [upper_bound]@3
|
||||
2 set [target_bound]@3 a@0
|
||||
3 jump_if_not 11(11) i@2 <= [target_bound]@3
|
||||
4 set total@1 total@1 + 1000
|
||||
5 jump_if_not 8(8) i@2 = 5
|
||||
6 set i@2 i@2 + 1
|
||||
|
@ -735,11 +735,11 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@1 0
|
||||
1 set i@2 1
|
||||
2 set [upper_bound]@3 a@0
|
||||
3 jump_if_not 16(16) i@2 <= [upper_bound]@3
|
||||
2 set [target_bound]@3 a@0
|
||||
3 jump_if_not 16(16) i@2 <= [target_bound]@3
|
||||
4 set j@4 1
|
||||
5 set [upper_bound]@5 2
|
||||
6 jump_if_not 14(14) j@4 <= [upper_bound]@5
|
||||
5 set [target_bound]@5 2
|
||||
6 jump_if_not 14(14) j@4 <= [target_bound]@5
|
||||
7 set total@1 total@1 + 1000
|
||||
8 jump_if_not 11(11) i@2 = 5
|
||||
9 set i@2 i@2 + 1
|
||||
|
@ -778,11 +778,11 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@1 0
|
||||
1 set j@2 1
|
||||
2 set [upper_bound]@3 2
|
||||
3 jump_if_not 16(16) j@2 <= [upper_bound]@3
|
||||
2 set [target_bound]@3 2
|
||||
3 jump_if_not 16(16) j@2 <= [target_bound]@3
|
||||
4 set i@4 1
|
||||
5 set [upper_bound]@5 a@0
|
||||
6 jump_if_not 14(14) i@4 <= [upper_bound]@5
|
||||
5 set [target_bound]@5 a@0
|
||||
6 jump_if_not 14(14) i@4 <= [target_bound]@5
|
||||
7 set total@1 total@1 + 1000
|
||||
8 jump_if_not 11(11) i@4 = 5
|
||||
9 set i@4 i@4 + 1
|
||||
|
@ -814,8 +814,8 @@ SHOW FUNCTION CODE f1;
|
|||
Pos Instruction
|
||||
0 set total@1 0
|
||||
1 set i@2 1
|
||||
2 set [upper_bound]@3 a@0
|
||||
3 jump_if_not 10(10) i@2 <= [upper_bound]@3
|
||||
2 set [target_bound]@3 a@0
|
||||
3 jump_if_not 10(10) i@2 <= [target_bound]@3
|
||||
4 jump_if_not 7(0) i@2 = 5
|
||||
5 set i@2 i@2 + 1
|
||||
6 jump 3
|
||||
|
|
|
@ -1479,3 +1479,28 @@ f1()
|
|||
1
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
|
||||
#
|
||||
CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
|
||||
INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
|
||||
CREATE PROCEDURE p1()
|
||||
AS
|
||||
BEGIN
|
||||
FOR rec IN (SELECT en1 FROM t1)
|
||||
LOOP
|
||||
SELECT rec.en1;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
rec.en1
|
||||
aaa
|
||||
rec.en1
|
||||
a
|
||||
rec.en1
|
||||
b
|
||||
rec.en1
|
||||
c
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -949,3 +949,31 @@ def c%FOUND 3 1 0 Y 32896 0 63
|
|||
def c%ROWCOUNT 8 21 1 Y 32896 0 63
|
||||
c%ISOPEN c%NOTFOUND c%FOUND c%ROWCOUNT
|
||||
1 NULL NULL 0
|
||||
#
|
||||
# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
JOBN varchar(18) NOT NULL,
|
||||
pk int(11) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY (JOBN)
|
||||
);
|
||||
CREATE PROCEDURE p1
|
||||
AS
|
||||
lS NUMBER(10) :=0;
|
||||
CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x';
|
||||
BEGIN
|
||||
FOR lbpd IN cBPD LOOP
|
||||
lS:=lS+1;
|
||||
END LOOP;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
BEGIN
|
||||
SELECT SQLERRM;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -2878,3 +2878,51 @@ msg
|
|||
This is p01
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
CTR varchar(2) NOT NULL,
|
||||
COR varchar(3) NOT NULL,
|
||||
DATE datetime NOT NULL,
|
||||
CHAN varchar(4) NOT NULL,
|
||||
CNO varchar(20) NOT NULL,
|
||||
JOBN varchar(18) NOT NULL,
|
||||
C1 varchar(30) DEFAULT NULL,
|
||||
C2 varchar(30) DEFAULT NULL,
|
||||
TIME datetime DEFAULT NULL,
|
||||
AMT decimal(12,2) DEFAULT NULL,
|
||||
DT datetime NOT NULL,
|
||||
pk int(11) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY Indx1 (JOBN)
|
||||
);
|
||||
CREATE PACKAGE xyz IS
|
||||
PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2);
|
||||
END;
|
||||
$$
|
||||
CREATE OR REPLACE PACKAGE BODY xyz IS
|
||||
PROCEDURE xyz123(
|
||||
ctr IN VARCHAR2,
|
||||
Jn IN VARCHAR2,
|
||||
R OUT VARCHAR2)
|
||||
AS
|
||||
lS NUMBER(10) :=0;
|
||||
CURSOR cBPD IS
|
||||
SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT
|
||||
FROM t1 WHERE JOBN=Jn;
|
||||
BEGIN
|
||||
FOR lbpd IN cBPD
|
||||
LOOP
|
||||
lS:=lS+1;
|
||||
END LOOP;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
BEGIN
|
||||
SELECT SQLERRM;
|
||||
END;
|
||||
END;
|
||||
END $$
|
||||
CALL xyz.xyz123(17,18,@R);
|
||||
DROP PACKAGE xyz;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -843,7 +843,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
|
|||
AS
|
||||
total INT := 0;
|
||||
BEGIN
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
LOOP
|
||||
total:= total + i;
|
||||
IF i = b THEN
|
||||
|
@ -2494,3 +2494,61 @@ BEGIN
|
|||
SELECT 'a' IN ('b',v);
|
||||
END $$
|
||||
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'
|
||||
#
|
||||
# MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly
|
||||
#
|
||||
DECLARE
|
||||
totalprice DECIMAL(12,2):=NULL;
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE loop_start..10 LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
idx
|
||||
10
|
||||
idx
|
||||
9
|
||||
idx
|
||||
8
|
||||
idx
|
||||
7
|
||||
idx
|
||||
6
|
||||
idx
|
||||
5
|
||||
idx
|
||||
4
|
||||
idx
|
||||
3
|
||||
idx
|
||||
2
|
||||
idx
|
||||
1
|
||||
CREATE PROCEDURE p1 AS
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE 3..loop_start LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
CREATE PROCEDURE p1 AS
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE loop_start..3 LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
idx
|
||||
3
|
||||
idx
|
||||
2
|
||||
idx
|
||||
1
|
||||
DROP PROCEDURE p1;
|
||||
|
|
|
@ -258,3 +258,157 @@ enable_prepare_warnings;
|
|||
SELECT test.comment() FROM DUAL;
|
||||
disable_prepare_warnings;
|
||||
DROP FUNCTION comment;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without
|
||||
--echo #
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<date_format>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<decode>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<history>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<system>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<versioning>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<without>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
|
||||
--echo #
|
||||
|
||||
DELIMITER /;
|
||||
DECLARE
|
||||
ELSEIF INT;
|
||||
BEGIN
|
||||
ELSEIF:=1;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN
|
||||
<<ELSEIF>>
|
||||
NULL;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
|
||||
--echo #
|
||||
|
||||
CREATE TABLE names (names INT);
|
||||
SELECT names FROM names AS names;
|
||||
DROP TABLE names;
|
||||
|
||||
CREATE TABLE password (password INT);
|
||||
SELECT password FROM password AS password;
|
||||
DROP TABLE password;
|
||||
|
||||
CREATE TABLE role (role INT);
|
||||
SELECT role FROM role AS role;
|
||||
DROP TABLE role;
|
||||
|
||||
DELIMITER $$;
|
||||
DECLARE
|
||||
names VARCHAR(32) DEFAULT '[names]';
|
||||
password VARCHAR(32) DEFAULT '[password]';
|
||||
role VARCHAR(32) DEFAULT '[role]';
|
||||
BEGIN
|
||||
<<names>>
|
||||
SELECT names;
|
||||
<<password>>
|
||||
SELECT password;
|
||||
<<role>>
|
||||
SELECT role;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
DECLARE
|
||||
names VARCHAR(32);
|
||||
BEGIN
|
||||
SET names='[names]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_BAD_VAR_SHADOW
|
||||
DECLARE
|
||||
password VARCHAR(32);
|
||||
BEGIN
|
||||
SET password='[password]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
DECLARE
|
||||
role VARCHAR(32);
|
||||
BEGIN
|
||||
SET role='[role]';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.names;
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.password;
|
||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||
SELECT @@GLOBAL.role;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
|
|
@ -470,7 +470,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
|
|||
AS
|
||||
total INT := 0;
|
||||
BEGIN
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
LOOP
|
||||
total:= total + i;
|
||||
IF i = b THEN
|
||||
|
|
|
@ -1572,3 +1572,26 @@ DELIMITER ;$$
|
|||
SELECT f1();
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c'));
|
||||
INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c');
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1()
|
||||
AS
|
||||
BEGIN
|
||||
FOR rec IN (SELECT en1 FROM t1)
|
||||
LOOP
|
||||
SELECT rec.en1;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -952,3 +952,38 @@ $$
|
|||
DELIMITER ;$$
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1
|
||||
(
|
||||
JOBN varchar(18) NOT NULL,
|
||||
pk int(11) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY (JOBN)
|
||||
);
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1
|
||||
AS
|
||||
lS NUMBER(10) :=0;
|
||||
CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x';
|
||||
BEGIN
|
||||
FOR lbpd IN cBPD LOOP
|
||||
lS:=lS+1;
|
||||
END LOOP;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
BEGIN
|
||||
SELECT SQLERRM;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -2624,3 +2624,60 @@ DELIMITER ;$$
|
|||
CALL pkg1.p00;
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
CTR varchar(2) NOT NULL,
|
||||
COR varchar(3) NOT NULL,
|
||||
DATE datetime NOT NULL,
|
||||
CHAN varchar(4) NOT NULL,
|
||||
CNO varchar(20) NOT NULL,
|
||||
JOBN varchar(18) NOT NULL,
|
||||
C1 varchar(30) DEFAULT NULL,
|
||||
C2 varchar(30) DEFAULT NULL,
|
||||
TIME datetime DEFAULT NULL,
|
||||
AMT decimal(12,2) DEFAULT NULL,
|
||||
DT datetime NOT NULL,
|
||||
pk int(11) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY Indx1 (JOBN)
|
||||
);
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE PACKAGE xyz IS
|
||||
PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2);
|
||||
END;
|
||||
$$
|
||||
|
||||
CREATE OR REPLACE PACKAGE BODY xyz IS
|
||||
PROCEDURE xyz123(
|
||||
ctr IN VARCHAR2,
|
||||
Jn IN VARCHAR2,
|
||||
R OUT VARCHAR2)
|
||||
AS
|
||||
lS NUMBER(10) :=0;
|
||||
CURSOR cBPD IS
|
||||
SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT
|
||||
FROM t1 WHERE JOBN=Jn;
|
||||
BEGIN
|
||||
FOR lbpd IN cBPD
|
||||
LOOP
|
||||
lS:=lS+1;
|
||||
END LOOP;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
BEGIN
|
||||
SELECT SQLERRM;
|
||||
END;
|
||||
END;
|
||||
END $$
|
||||
DELIMITER ;$$
|
||||
|
||||
CALL xyz.xyz123(17,18,@R);
|
||||
DROP PACKAGE xyz;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -918,7 +918,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
|
|||
AS
|
||||
total INT := 0;
|
||||
BEGIN
|
||||
FOR i IN REVERSE a..1
|
||||
FOR i IN REVERSE 1..a
|
||||
LOOP
|
||||
total:= total + i;
|
||||
IF i = b THEN
|
||||
|
@ -2344,3 +2344,46 @@ BEGIN
|
|||
END $$
|
||||
DELIMITER ;$$
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
DECLARE
|
||||
totalprice DECIMAL(12,2):=NULL;
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE loop_start..10 LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1 AS
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE 3..loop_start LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1 AS
|
||||
loop_start INTEGER := 1;
|
||||
BEGIN
|
||||
FOR idx IN REVERSE loop_start..3 LOOP
|
||||
SELECT idx;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
|
|
|
@ -31586,8 +31586,33 @@ c1 c2 c3 c4 c5 c6 c7
|
|||
0 -9223372036854775808 1 2 3 4 5
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
0 0 17 18 19 20 21
|
||||
0 124 22 23 24 25 26
|
||||
0 124 27 28 29 30 31
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
0 0 32 32 34 35 36
|
||||
101 0 37 38 39 40 41
|
||||
101 -102 103 104 105 106 107
|
||||
102 -109 110 111 112 113 114
|
||||
103 -109 110 111 112 113 114
|
||||
105 NULL 102 103 104 105 106
|
||||
108 -109 110 111 112 101 114
|
||||
108 -109 110 111 112 102 114
|
||||
108 -109 110 111 112 113 114
|
||||
115 -116 117 118 119 120 121
|
||||
122 -123 124 125 126 127 128
|
||||
255 -2147483648 6 7 8 9 10
|
||||
65535 -8388608 11 12 13 14 15
|
||||
16777215 -32768 16 17 18 19 20
|
||||
4294967295 -128 21 22 23 24 25
|
||||
18446744073709551615 9223372036854775807 26 27 28 29 30
|
||||
18446744073709551615 9223372036854775807 36 37 38 39 40
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
|
@ -31747,8 +31772,33 @@ c1 c2 c3 c4 c5 c6 c7
|
|||
0 -9223372036854775808 31 32 33 34 35
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
0 124 27 28 29 30 31
|
||||
0 124 22 23 24 25 26
|
||||
0 0 17 18 19 20 21
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
101 -102 103 104 105 106 107
|
||||
101 0 37 38 39 40 41
|
||||
102 -109 110 111 112 113 114
|
||||
103 -109 110 111 112 113 114
|
||||
105 NULL 102 103 104 105 106
|
||||
108 -109 110 111 112 113 114
|
||||
108 -109 110 111 112 102 114
|
||||
108 -109 110 111 112 101 114
|
||||
115 -116 117 118 119 120 121
|
||||
122 -123 124 125 126 127 128
|
||||
255 -2147483648 6 7 8 9 10
|
||||
65535 -8388608 11 12 13 14 15
|
||||
16777215 -32768 16 17 18 19 20
|
||||
4294967295 -128 21 22 23 24 25
|
||||
18446744073709551615 9223372036854775807 36 37 38 39 40
|
||||
18446744073709551615 9223372036854775807 26 27 28 29 30
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
|
@ -32014,8 +32064,33 @@ c1 c2 c3 c4 c5 c6 c7
|
|||
18446744073709551615 9223372036854775807 36 37 38 39 40
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
0 0 17 18 19 20 21
|
||||
0 124 22 23 24 25 26
|
||||
0 124 27 28 29 30 31
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
0 0 32 32 34 35 36
|
||||
101 0 37 38 39 40 41
|
||||
101 -102 103 104 105 106 107
|
||||
102 -109 110 111 112 113 114
|
||||
103 -109 110 111 112 113 114
|
||||
105 NULL 102 103 104 105 106
|
||||
108 -109 110 111 112 101 114
|
||||
108 -109 110 111 112 102 114
|
||||
108 -109 110 111 112 113 114
|
||||
115 -116 117 118 119 120 121
|
||||
122 -123 124 125 126 127 128
|
||||
255 -2147483648 6 7 8 9 10
|
||||
65535 -8388608 11 12 13 14 15
|
||||
16777215 -32768 16 17 18 19 20
|
||||
4294967295 -128 21 22 23 24 25
|
||||
18446744073709551615 9223372036854775807 26 27 28 29 30
|
||||
18446744073709551615 9223372036854775807 36 37 38 39 40
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
|
@ -32175,8 +32250,33 @@ c1 c2 c3 c4 c5 c6 c7
|
|||
18446744073709551615 9223372036854775807 26 27 28 29 30
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
0 124 27 28 29 30 31
|
||||
0 124 22 23 24 25 26
|
||||
0 0 17 18 19 20 21
|
||||
0 -9223372036854775808 1 2 3 4 5
|
||||
0 NULL 5 6 NULL 0 NULL
|
||||
101 -102 103 104 105 106 107
|
||||
101 0 37 38 39 40 41
|
||||
102 -109 110 111 112 113 114
|
||||
103 -109 110 111 112 113 114
|
||||
105 NULL 102 103 104 105 106
|
||||
108 -109 110 111 112 113 114
|
||||
108 -109 110 111 112 102 114
|
||||
108 -109 110 111 112 101 114
|
||||
115 -116 117 118 119 120 121
|
||||
122 -123 124 125 126 127 128
|
||||
255 -2147483648 6 7 8 9 10
|
||||
65535 -8388608 11 12 13 14 15
|
||||
16777215 -32768 16 17 18 19 20
|
||||
4294967295 -128 21 22 23 24 25
|
||||
18446744073709551615 9223372036854775807 36 37 38 39 40
|
||||
18446744073709551615 9223372036854775807 26 27 28 29 30
|
||||
SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
0 -9223372036854775808 31 32 33 34 35
|
||||
SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC;
|
||||
c1 c2 c3 c4 c5 c6 c7
|
||||
0 0 32 32 34 35 36
|
||||
|
|
|
@ -3767,8 +3767,25 @@ c1 c2 c3
|
|||
-12 18446744073709551615 12
|
||||
SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1;
|
||||
c1 c2 c3
|
||||
-4 4 4
|
||||
-9 9 9
|
||||
0 255 13
|
||||
-9223372036854775808 18446744073709551615 12
|
||||
-12 18446744073709551615 12
|
||||
-11 18446744073709551615 11
|
||||
-8 18446744073709551615 8
|
||||
-7 18446744073709551615 7
|
||||
-6 18446744073709551615 6
|
||||
-5 18446744073709551615 5
|
||||
-3 18446744073709551615 3
|
||||
-2 18446744073709551615 2
|
||||
-1 18446744073709551615 1
|
||||
50 18446744073709551615 10
|
||||
9223372036854775807 18446744073709551615 14
|
||||
SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1 DESC LIMIT 2;
|
||||
c1 c2 c3
|
||||
-4 4 4
|
||||
-9 9 9
|
||||
SELECT * FROM t2 WHERE c2 IN(0,18446744073709551615) ORDER BY c2,c1 DESC;
|
||||
c1 c2 c3
|
||||
9223372036854775807 18446744073709551615 14
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 INT NOT NULL,
|
||||
f3 INT AS (f2 * f2) VIRTUAL)engine=innodb;
|
||||
|
||||
INSERT INTO t1(f1, f2) VALUES(1, 1);
|
||||
|
||||
--echo #
|
||||
--echo # ALGORITHM=$algorithm_type
|
||||
--echo #
|
||||
|
||||
--enable_info
|
||||
--echo # Add column at the end of the table
|
||||
--error $error_code
|
||||
--eval ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL", ALGORITHM=$algorithm_type
|
||||
|
||||
--echo # Change virtual column expression
|
||||
--error $error_code
|
||||
--eval ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=$algorithm_type
|
||||
|
||||
--echo # Add virtual column
|
||||
--error $error_code
|
||||
--eval ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=$algorithm_type
|
||||
|
||||
--echo # Rename Column
|
||||
--error $error_code
|
||||
--eval ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=$algorithm_type
|
||||
|
||||
--echo # Rename table
|
||||
--error $error_code
|
||||
--eval ALTER TABLE t1 RENAME t2, algorithm=$algorithm_type
|
||||
|
||||
DROP TABLE t2;
|
||||
--disable_info
|
|
@ -1115,6 +1115,11 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|||
--move_file $MYSQLD_DATADIR/test/t0.ibd $MYSQLD_DATADIR/test/t1.ibd
|
||||
|
||||
--source include/start_mysqld.inc
|
||||
if ($have_debug) {
|
||||
# Initiate shutdown in order to issue a redo log checkpoint and to discard
|
||||
# the redo log record that was emitted due to '+d,fil_names_write_bogus'.
|
||||
--source include/restart_mysqld.inc
|
||||
}
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
|
|
@ -44,5 +44,7 @@ SELECT * FROM t1;
|
|||
|
||||
--let $restart_parameters=
|
||||
--source include/restart_mysqld.inc
|
||||
# Initiate shutdown in order to issue a redo log checkpoint and to discard
|
||||
# the redo log record that was emitted due to '+d,fil_names_write_bogus'.
|
||||
--source include/restart_mysqld.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
|
|
|
@ -11,6 +11,4 @@ INSERT INTO t VALUES('foobar1');
|
|||
SELECT * from t;
|
||||
c
|
||||
foobar1
|
||||
Warnings:
|
||||
Note 1105 AWS KMS plugin: loaded key 1, version 1, key length 128 bit
|
||||
DROP TABLE t;
|
||||
|
|
|
@ -28,4 +28,4 @@ extcode=$?
|
|||
|
||||
systemctl set-environment _WSREP_NEW_CLUSTER=''
|
||||
|
||||
return $extcode
|
||||
exit $extcode
|
||||
|
|
|
@ -490,9 +490,11 @@ IF(WIN32)
|
|||
|
||||
ADD_LIBRARY(winservice STATIC winservice.c)
|
||||
TARGET_LINK_LIBRARIES(winservice shell32)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
|
||||
mysql_upgrade_service.cc
|
||||
COMPONENT Server)
|
||||
upgrade_conf_file.cc
|
||||
COMPONENT Server)
|
||||
TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
|
116
sql/field.cc
116
sql/field.cc
|
@ -62,12 +62,20 @@ const char field_separator=',';
|
|||
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
|
||||
((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1))
|
||||
|
||||
#define ASSERT_COLUMN_MARKED_FOR_READ \
|
||||
DBUG_ASSERT(!table || !table->read_set || \
|
||||
bitmap_is_set(table->read_set, field_index))
|
||||
#define ASSERT_COLUMN_MARKED_FOR_WRITE \
|
||||
DBUG_ASSERT(is_stat_field || !table || !table->write_set || \
|
||||
bitmap_is_set(table->write_set, field_index))
|
||||
// Column marked for read or the field set to read out or record[0] or [1]
|
||||
#define ASSERT_COLUMN_MARKED_FOR_READ \
|
||||
DBUG_ASSERT(!table || \
|
||||
(!table->read_set || \
|
||||
bitmap_is_set(table->read_set, field_index) || \
|
||||
(!(ptr >= table->record[0] && \
|
||||
ptr < table->record[0] + table->s->reclength))))
|
||||
|
||||
#define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED \
|
||||
DBUG_ASSERT(is_stat_field || !table || \
|
||||
(!table->write_set || \
|
||||
bitmap_is_set(table->write_set, field_index) || \
|
||||
(!(ptr >= table->record[0] && \
|
||||
ptr < table->record[0] + table->s->reclength))))
|
||||
|
||||
#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "")
|
||||
|
||||
|
@ -2034,7 +2042,7 @@ longlong Field::convert_decimal2longlong(const my_decimal *val,
|
|||
|
||||
int Field_int::store_decimal(const my_decimal *val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int err= 0;
|
||||
longlong i= convert_decimal2longlong(val, unsigned_flag, &err);
|
||||
return MY_TEST(err | store(i, unsigned_flag));
|
||||
|
@ -2201,7 +2209,7 @@ void Field_num::make_send_field(Send_field *field)
|
|||
|
||||
int Field_str::store_decimal(const my_decimal *d)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
double val;
|
||||
/* TODO: use decimal2string? */
|
||||
int err= warn_if_overflow(my_decimal2double(E_DEC_FATAL_ERROR &
|
||||
|
@ -2271,7 +2279,7 @@ bool Field::get_date(MYSQL_TIME *to, date_mode_t mode)
|
|||
|
||||
int Field::store_time_dec(const MYSQL_TIME *ltime, uint dec)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
uint length= (uint) my_TIME_to_str(ltime, buff, dec);
|
||||
/* Avoid conversion when field character set is ASCII compatible */
|
||||
|
@ -2528,7 +2536,7 @@ void Field_decimal::overflow(bool negative)
|
|||
|
||||
int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp(buff,sizeof(buff), &my_charset_bin);
|
||||
const uchar *from= (uchar*) from_arg;
|
||||
|
@ -2894,7 +2902,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
|
|||
|
||||
int Field_decimal::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
if (unsigned_flag && nr < 0)
|
||||
{
|
||||
overflow(1);
|
||||
|
@ -2932,7 +2940,7 @@ int Field_decimal::store(double nr)
|
|||
|
||||
int Field_decimal::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char buff[22];
|
||||
uint length, int_part;
|
||||
char fyllchar;
|
||||
|
@ -3175,7 +3183,7 @@ void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value,
|
|||
bool Field_new_decimal::store_value(const my_decimal *decimal_value,
|
||||
int *native_error)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
DBUG_ENTER("Field_new_decimal::store_value");
|
||||
#ifndef DBUG_OFF
|
||||
|
@ -3233,7 +3241,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
|
|||
int Field_new_decimal::store(const char *from, size_t length,
|
||||
CHARSET_INFO *charset_arg)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
my_decimal decimal_value;
|
||||
THD *thd= get_thd();
|
||||
DBUG_ENTER("Field_new_decimal::store(char*)");
|
||||
|
@ -3317,7 +3325,7 @@ int Field_new_decimal::store(const char *from, size_t length,
|
|||
|
||||
int Field_new_decimal::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
my_decimal decimal_value;
|
||||
int err;
|
||||
THD *thd= get_thd();
|
||||
|
@ -3342,7 +3350,7 @@ int Field_new_decimal::store(double nr)
|
|||
|
||||
int Field_new_decimal::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
my_decimal decimal_value;
|
||||
int err;
|
||||
|
||||
|
@ -3364,7 +3372,7 @@ int Field_new_decimal::store(longlong nr, bool unsigned_val)
|
|||
|
||||
int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
return store_value(decimal_value);
|
||||
}
|
||||
|
||||
|
@ -3581,7 +3589,7 @@ int Field_int::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
|
|||
|
||||
int Field_tiny::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error;
|
||||
longlong rnd;
|
||||
|
||||
|
@ -3593,7 +3601,7 @@ int Field_tiny::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_tiny::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
nr=rint(nr);
|
||||
if (unsigned_flag)
|
||||
|
@ -3636,7 +3644,7 @@ int Field_tiny::store(double nr)
|
|||
|
||||
int Field_tiny::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
|
||||
if (unsigned_flag)
|
||||
|
@ -3741,7 +3749,7 @@ void Field_tiny::sql_type(String &res) const
|
|||
|
||||
int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int store_tmp;
|
||||
int error;
|
||||
longlong rnd;
|
||||
|
@ -3755,7 +3763,7 @@ int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_short::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
int16 res;
|
||||
nr=rint(nr);
|
||||
|
@ -3800,7 +3808,7 @@ int Field_short::store(double nr)
|
|||
|
||||
int Field_short::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
int16 res;
|
||||
|
||||
|
@ -3915,7 +3923,7 @@ void Field_short::sql_type(String &res) const
|
|||
|
||||
int Field_medium::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int store_tmp;
|
||||
int error;
|
||||
longlong rnd;
|
||||
|
@ -3929,7 +3937,7 @@ int Field_medium::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_medium::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
nr=rint(nr);
|
||||
if (unsigned_flag)
|
||||
|
@ -3975,7 +3983,7 @@ int Field_medium::store(double nr)
|
|||
|
||||
int Field_medium::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
|
||||
if (unsigned_flag)
|
||||
|
@ -4113,7 +4121,7 @@ void Field_medium::sql_type(String &res) const
|
|||
|
||||
int Field_long::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
long store_tmp;
|
||||
int error;
|
||||
longlong rnd;
|
||||
|
@ -4127,7 +4135,7 @@ int Field_long::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_long::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
int32 res;
|
||||
nr=rint(nr);
|
||||
|
@ -4172,7 +4180,7 @@ int Field_long::store(double nr)
|
|||
|
||||
int Field_long::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
int32 res;
|
||||
|
||||
|
@ -4286,7 +4294,7 @@ void Field_long::sql_type(String &res) const
|
|||
|
||||
int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
char *end;
|
||||
ulonglong tmp;
|
||||
|
@ -4309,7 +4317,7 @@ int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_longlong::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
Converter_double_to_longlong conv(nr, unsigned_flag);
|
||||
|
||||
if (unlikely(conv.error()))
|
||||
|
@ -4322,7 +4330,7 @@ int Field_longlong::store(double nr)
|
|||
|
||||
int Field_longlong::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
|
||||
if (unlikely(nr < 0)) // Only possible error
|
||||
|
@ -4433,7 +4441,7 @@ void Field_longlong::sql_type(String &res) const
|
|||
|
||||
void Field_longlong::set_max()
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
set_notnull();
|
||||
int8store(ptr, unsigned_flag ? ULONGLONG_MAX : LONGLONG_MAX);
|
||||
}
|
||||
|
@ -4470,7 +4478,7 @@ int Field_float::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_float::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= truncate_double(&nr, field_length,
|
||||
not_fixed ? NOT_FIXED_DEC : dec,
|
||||
unsigned_flag, FLT_MAX);
|
||||
|
@ -4649,7 +4657,7 @@ int Field_double::store(const char *from,size_t len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_double::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= truncate_double(&nr, field_length,
|
||||
not_fixed ? NOT_FIXED_DEC : dec,
|
||||
unsigned_flag, DBL_MAX);
|
||||
|
@ -5026,7 +5034,7 @@ my_time_t Field_timestamp::get_timestamp(const uchar *pos,
|
|||
int Field_timestamp::store_TIME_with_warning(THD *thd, const Datetime *dt,
|
||||
const ErrConv *str, int was_cut)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
static const timeval zero= {0, (uint) 0 };
|
||||
|
||||
// Handle totally bad values
|
||||
|
@ -5471,7 +5479,7 @@ void Field_timestampf::store_TIMEVAL(const timeval &tm)
|
|||
void Field_timestampf::set_max()
|
||||
{
|
||||
DBUG_ENTER("Field_timestampf::set_max");
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
DBUG_ASSERT(dec == TIME_SECOND_PART_DIGITS);
|
||||
|
||||
set_notnull();
|
||||
|
@ -5543,7 +5551,7 @@ int Field_datetime::store_TIME_with_warning(const Datetime *dt,
|
|||
const ErrConv *str,
|
||||
int was_cut)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
// Handle totally bad values
|
||||
if (!dt->is_valid_datetime())
|
||||
return store_invalid_with_warning(str, was_cut, MYSQL_TIMESTAMP_DATETIME);
|
||||
|
@ -5684,7 +5692,7 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
|
|||
int Field_time::store_TIME_with_warning(const Time *t,
|
||||
const ErrConv *str, int warn)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
// Handle totally bad values
|
||||
if (!t->is_valid_time())
|
||||
return store_invalid_with_warning(str, warn, MYSQL_TIMESTAMP_TIME);
|
||||
|
@ -6096,7 +6104,7 @@ bool Field_timef::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
|||
|
||||
int Field_year::store(const char *from, size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char *end;
|
||||
int error;
|
||||
longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
|
@ -6144,7 +6152,7 @@ int Field_year::store(double nr)
|
|||
|
||||
int Field_year::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
|
||||
{
|
||||
*ptr= 0;
|
||||
|
@ -6238,7 +6246,7 @@ int Field_date_common::store_TIME_with_warning(const Datetime *dt,
|
|||
const ErrConv *str,
|
||||
int was_cut)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
// Handle totally bad values
|
||||
if (!dt->is_valid_datetime())
|
||||
return store_invalid_with_warning(str, was_cut, MYSQL_TIMESTAMP_DATE);
|
||||
|
@ -6876,7 +6884,7 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
|
|||
|
||||
int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint copy_length;
|
||||
int rc;
|
||||
|
||||
|
@ -6922,7 +6930,7 @@ int Field_str::store(longlong nr, bool unsigned_val)
|
|||
|
||||
int Field_str::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
uint local_char_length= MY_MIN(sizeof(buff),
|
||||
field_length / field_charset->mbmaxlen);
|
||||
|
@ -7419,7 +7427,7 @@ int Field_varstring::save_field_metadata(uchar *metadata_ptr)
|
|||
|
||||
int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint copy_length;
|
||||
int rc;
|
||||
|
||||
|
@ -7956,7 +7964,7 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
|
|||
int Field_varstring_compressed::store(const char *from, size_t length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint compressed_length;
|
||||
int rc= compress((char*) get_data(), field_length, from, (uint) length,
|
||||
Field_varstring_compressed::max_display_length(),
|
||||
|
@ -8088,7 +8096,7 @@ int Field_blob::copy_value(Field_blob *from)
|
|||
|
||||
int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
size_t copy_length, new_length;
|
||||
uint copy_len;
|
||||
char *tmp;
|
||||
|
@ -8576,7 +8584,7 @@ uint Field_blob::is_equal(Create_field *new_field)
|
|||
int Field_blob_compressed::store(const char *from, size_t length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint compressed_length;
|
||||
uint max_length= max_data_length();
|
||||
uint to_length= (uint) MY_MIN(max_length,
|
||||
|
@ -8919,7 +8927,7 @@ void Field_enum::store_type(ulonglong value)
|
|||
|
||||
int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int err= 0;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||
|
@ -8971,7 +8979,7 @@ int Field_enum::store(double nr)
|
|||
|
||||
int Field_enum::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
if ((ulonglong) nr > typelib->count || nr == 0)
|
||||
{
|
||||
|
@ -9102,7 +9110,7 @@ Field *Field_enum::make_new_field(MEM_ROOT *root, TABLE *new_table,
|
|||
|
||||
int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
bool got_warning= 0;
|
||||
int err= 0;
|
||||
char *not_used;
|
||||
|
@ -9142,7 +9150,7 @@ int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
|
|||
|
||||
int Field_set::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
ulonglong max_nr;
|
||||
|
||||
|
@ -9521,7 +9529,7 @@ uint Field_bit::is_equal(Create_field *new_field)
|
|||
|
||||
int Field_bit::store(const char *from, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int delta;
|
||||
|
||||
for (; length && !*from; from++, length--) // skip left 0's
|
||||
|
@ -9957,7 +9965,7 @@ Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
|
|||
|
||||
int Field_bit_as_char::store(const char *from, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int delta;
|
||||
uchar bits= (uchar) (field_length & 7);
|
||||
|
||||
|
|
|
@ -541,6 +541,7 @@ public:
|
|||
bool utf8; /* Already in utf8 */
|
||||
Item *expr;
|
||||
LEX_CSTRING name; /* Name of constraint */
|
||||
/* see VCOL_* (VCOL_FIELD_REF, ...) */
|
||||
uint flags;
|
||||
|
||||
Virtual_column_info()
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
from bison.
|
||||
See also YYMAXUTOK.
|
||||
*/
|
||||
#define MY_MAX_TOKEN 1000
|
||||
#define MY_MAX_TOKEN 1100
|
||||
/** Generated token. */
|
||||
struct gen_lex_token_string
|
||||
{
|
||||
|
@ -255,9 +255,11 @@ void compute_tokens()
|
|||
set_start_expr_token(STARTS_SYM);
|
||||
set_start_expr_token(ENDS_SYM);
|
||||
set_start_expr_token(DEFAULT);
|
||||
set_start_expr_token(RETURN_SYM);
|
||||
set_start_expr_token(RETURN_MARIADB_SYM);
|
||||
set_start_expr_token(RETURN_ORACLE_SYM);
|
||||
set_start_expr_token(IF_SYM);
|
||||
set_start_expr_token(ELSEIF_SYM);
|
||||
set_start_expr_token(ELSEIF_MARIADB_SYM);
|
||||
set_start_expr_token(ELSEIF_ORACLE_SYM);
|
||||
set_start_expr_token(CASE_SYM);
|
||||
set_start_expr_token(WHEN_SYM);
|
||||
set_start_expr_token(WHILE_SYM);
|
||||
|
|
|
@ -3516,7 +3516,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
if (init_partition_bitmaps())
|
||||
goto err_alloc;
|
||||
|
||||
if (unlikely((error=
|
||||
if (!MY_TEST(m_is_clone_of) &&
|
||||
unlikely((error=
|
||||
m_part_info->set_partition_bitmaps(m_partitions_to_open))))
|
||||
goto err_alloc;
|
||||
|
||||
|
|
57
sql/item.cc
57
sql/item.cc
|
@ -7375,13 +7375,21 @@ Item *Item_field::derived_field_transformer_for_having(THD *thd, uchar *arg)
|
|||
return this;
|
||||
if (!item_equal && used_tables() != tab_map)
|
||||
return this;
|
||||
return get_field_item_for_having(thd, this, sel);
|
||||
Item *item= get_field_item_for_having(thd, this, sel);
|
||||
if (item)
|
||||
item->marker|= SUBSTITUTION_FL;
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
Item *Item_direct_view_ref::derived_field_transformer_for_having(THD *thd,
|
||||
uchar *arg)
|
||||
{
|
||||
if ((*ref)->marker & SUBSTITUTION_FL)
|
||||
{
|
||||
this->marker|= SUBSTITUTION_FL;
|
||||
return this;
|
||||
}
|
||||
st_select_lex *sel= (st_select_lex *)arg;
|
||||
table_map tab_map= sel->master_unit()->derived->table->map;
|
||||
if ((item_equal && !(item_equal->used_tables() & tab_map)) ||
|
||||
|
@ -7432,13 +7440,20 @@ Item *Item_field::derived_field_transformer_for_where(THD *thd, uchar *arg)
|
|||
st_select_lex *sel= (st_select_lex *)arg;
|
||||
Item *producing_item= find_producing_item(this, sel);
|
||||
if (producing_item)
|
||||
return producing_item->build_clone(thd);
|
||||
{
|
||||
Item *producing_clone= producing_item->build_clone(thd);
|
||||
if (producing_clone)
|
||||
producing_clone->marker|= SUBSTITUTION_FL;
|
||||
return producing_clone;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Item *Item_direct_view_ref::derived_field_transformer_for_where(THD *thd,
|
||||
uchar *arg)
|
||||
{
|
||||
if ((*ref)->marker & SUBSTITUTION_FL)
|
||||
return (*ref);
|
||||
if (item_equal)
|
||||
{
|
||||
st_select_lex *sel= (st_select_lex *)arg;
|
||||
|
@ -7489,7 +7504,13 @@ Item *Item_field::grouping_field_transformer_for_where(THD *thd, uchar *arg)
|
|||
st_select_lex *sel= (st_select_lex *)arg;
|
||||
Field_pair *gr_field= find_matching_grouping_field(this, sel);
|
||||
if (gr_field)
|
||||
return gr_field->corresponding_item->build_clone(thd);
|
||||
{
|
||||
Item *producing_clone=
|
||||
gr_field->corresponding_item->build_clone(thd);
|
||||
if (producing_clone)
|
||||
producing_clone->marker|= SUBSTITUTION_FL;
|
||||
return producing_clone;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -7498,6 +7519,11 @@ Item *
|
|||
Item_direct_view_ref::grouping_field_transformer_for_where(THD *thd,
|
||||
uchar *arg)
|
||||
{
|
||||
if ((*ref)->marker & SUBSTITUTION_FL)
|
||||
{
|
||||
this->marker|= SUBSTITUTION_FL;
|
||||
return this;
|
||||
}
|
||||
if (!item_equal)
|
||||
return this;
|
||||
st_select_lex *sel= (st_select_lex *)arg;
|
||||
|
@ -9021,8 +9047,19 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
|
|||
fixed= 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
DEFAULT() do not need table field so should not ask handler to bring
|
||||
field value (mark column for read)
|
||||
*/
|
||||
enum_column_usage save_column_usage= thd->column_usage;
|
||||
thd->column_usage= COLUMNS_READ;
|
||||
if (arg->fix_fields_if_needed(thd, &arg))
|
||||
{
|
||||
thd->column_usage= save_column_usage;
|
||||
goto error;
|
||||
}
|
||||
thd->column_usage= save_column_usage;
|
||||
|
||||
real_arg= arg->real_item();
|
||||
if (real_arg->type() != FIELD_ITEM)
|
||||
|
@ -9042,15 +9079,19 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
|
|||
goto error;
|
||||
memcpy((void *)def_field, (void *)field_arg->field,
|
||||
field_arg->field->size_of());
|
||||
IF_DBUG_ASSERT(def_field->is_stat_field=1,); // a hack to fool ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED
|
||||
// If non-constant default value expression
|
||||
if (def_field->default_value && def_field->default_value->flags)
|
||||
{
|
||||
uchar *newptr= (uchar*) thd->alloc(1+def_field->pack_length());
|
||||
if (!newptr)
|
||||
goto error;
|
||||
/*
|
||||
Even if DEFAULT() do not read tables fields, the default value
|
||||
expression can do it.
|
||||
*/
|
||||
fix_session_vcol_expr_for_read(thd, def_field, def_field->default_value);
|
||||
if (should_mark_column(thd->column_usage))
|
||||
def_field->default_value->expr->walk(&Item::register_field_in_read_map, 1, 0);
|
||||
def_field->default_value->expr->update_used_tables();
|
||||
def_field->move_field(newptr+1, def_field->maybe_null() ? newptr : 0, 1);
|
||||
}
|
||||
else
|
||||
|
@ -9074,6 +9115,12 @@ void Item_default_value::print(String *str, enum_query_type query_type)
|
|||
return;
|
||||
}
|
||||
str->append(STRING_WITH_LEN("default("));
|
||||
/*
|
||||
We take DEFAULT from a field so do not need it value in case of const
|
||||
tables but its name so we set QT_NO_DATA_EXPANSION (as we print for
|
||||
table definition, also we do not need table and database name)
|
||||
*/
|
||||
query_type= (enum_query_type) (query_type | QT_NO_DATA_EXPANSION);
|
||||
arg->print(str, query_type);
|
||||
str->append(')');
|
||||
}
|
||||
|
|
10
sql/item.h
10
sql/item.h
|
@ -151,6 +151,7 @@ bool mark_unsupported_function(const char *w1, const char *w2,
|
|||
|
||||
#define NO_EXTRACTION_FL (1 << 6)
|
||||
#define FULL_EXTRACTION_FL (1 << 7)
|
||||
#define SUBSTITUTION_FL (1 << 8)
|
||||
#define EXTRACTION_MASK (NO_EXTRACTION_FL | FULL_EXTRACTION_FL)
|
||||
|
||||
extern const char *item_empty_name;
|
||||
|
@ -1183,6 +1184,10 @@ public:
|
|||
If value is not null null_value flag will be reset to FALSE.
|
||||
*/
|
||||
virtual longlong val_int()=0;
|
||||
Longlong_hybrid to_longlong_hybrid()
|
||||
{
|
||||
return Longlong_hybrid(val_int(), unsigned_flag);
|
||||
}
|
||||
Longlong_null to_longlong_null()
|
||||
{
|
||||
longlong nr= val_int();
|
||||
|
@ -6020,6 +6025,11 @@ public:
|
|||
return false;
|
||||
}
|
||||
table_map used_tables() const;
|
||||
virtual void update_used_tables()
|
||||
{
|
||||
if (field && field->default_value)
|
||||
field->default_value->expr->update_used_tables();
|
||||
}
|
||||
Field *get_tmp_table_field() { return 0; }
|
||||
Item *get_tmp_table_item(THD *thd) { return this; }
|
||||
Item_field *field_for_view_update() { return 0; }
|
||||
|
|
|
@ -2044,7 +2044,7 @@ bool Item_func_between::fix_length_and_dec()
|
|||
if (!args[0] || !args[1] || !args[2])
|
||||
return TRUE;
|
||||
if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(),
|
||||
args, 3, true))
|
||||
args, 3, false))
|
||||
{
|
||||
DBUG_ASSERT(current_thd->is_error());
|
||||
return TRUE;
|
||||
|
@ -2152,12 +2152,20 @@ longlong Item_func_between::val_int_cmp_string()
|
|||
|
||||
longlong Item_func_between::val_int_cmp_int()
|
||||
{
|
||||
longlong value= args[0]->val_int(), a, b;
|
||||
Longlong_hybrid value= args[0]->to_longlong_hybrid();
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
a= args[1]->val_int();
|
||||
b= args[2]->val_int();
|
||||
return val_int_cmp_int_finalize(value, a, b);
|
||||
Longlong_hybrid a= args[1]->to_longlong_hybrid();
|
||||
Longlong_hybrid b= args[2]->to_longlong_hybrid();
|
||||
if (!args[1]->null_value && !args[2]->null_value)
|
||||
return (longlong) ((value.cmp(a) >= 0 && value.cmp(b) <= 0) != negated);
|
||||
if (args[1]->null_value && args[2]->null_value)
|
||||
null_value= true;
|
||||
else if (args[1]->null_value)
|
||||
null_value= value.cmp(b) <= 0; // not null if false range.
|
||||
else
|
||||
null_value= value.cmp(a) >= 0;
|
||||
return (longlong) (!null_value && negated);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1563,6 +1563,7 @@ bool Item_func_json_array_append::fix_length_and_dec()
|
|||
}
|
||||
|
||||
fix_char_length_ulonglong(char_length);
|
||||
maybe_null= 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
40
sql/lex.h
40
sql/lex.h
|
@ -82,15 +82,15 @@ static SYMBOL symbols[] = {
|
|||
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)},
|
||||
{ "BACKUP", SYM(BACKUP_SYM)},
|
||||
{ "BEFORE", SYM(BEFORE_SYM)},
|
||||
{ "BEGIN", SYM(BEGIN_SYM)},
|
||||
{ "BEGIN", SYM(BEGIN_MARIADB_SYM)},
|
||||
{ "BETWEEN", SYM(BETWEEN_SYM)},
|
||||
{ "BIGINT", SYM(BIGINT)},
|
||||
{ "BINARY", SYM(BINARY)},
|
||||
{ "BINLOG", SYM(BINLOG_SYM)},
|
||||
{ "BIT", SYM(BIT_SYM)},
|
||||
{ "BLOB", SYM(BLOB_SYM)},
|
||||
{ "BLOB", SYM(BLOB_MARIADB_SYM)},
|
||||
{ "BLOCK", SYM(BLOCK_SYM)},
|
||||
{ "BODY", SYM(BODY_SYM)},
|
||||
{ "BODY", SYM(BODY_MARIADB_SYM)},
|
||||
{ "BOOL", SYM(BOOL_SYM)},
|
||||
{ "BOOLEAN", SYM(BOOLEAN_SYM)},
|
||||
{ "BOTH", SYM(BOTH)},
|
||||
|
@ -115,7 +115,7 @@ static SYMBOL symbols[] = {
|
|||
{ "CIPHER", SYM(CIPHER_SYM)},
|
||||
{ "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)},
|
||||
{ "CLIENT", SYM(CLIENT_SYM)},
|
||||
{ "CLOB", SYM(CLOB)},
|
||||
{ "CLOB", SYM(CLOB_MARIADB_SYM)},
|
||||
{ "CLOSE", SYM(CLOSE_SYM)},
|
||||
{ "COALESCE", SYM(COALESCE)},
|
||||
{ "CODE", SYM(CODE_SYM)},
|
||||
|
@ -145,7 +145,7 @@ static SYMBOL symbols[] = {
|
|||
{ "CONSTRAINT_SCHEMA", SYM(CONSTRAINT_SCHEMA_SYM)},
|
||||
{ "CONTAINS", SYM(CONTAINS_SYM)},
|
||||
{ "CONTEXT", SYM(CONTEXT_SYM)},
|
||||
{ "CONTINUE", SYM(CONTINUE_SYM)},
|
||||
{ "CONTINUE", SYM(CONTINUE_MARIADB_SYM)},
|
||||
{ "CONTRIBUTORS", SYM(CONTRIBUTORS_SYM)},
|
||||
{ "CONVERT", SYM(CONVERT_SYM)},
|
||||
{ "CPU", SYM(CPU_SYM)},
|
||||
|
@ -176,7 +176,7 @@ static SYMBOL symbols[] = {
|
|||
{ "DEALLOCATE", SYM(DEALLOCATE_SYM)},
|
||||
{ "DEC", SYM(DECIMAL_SYM)},
|
||||
{ "DECIMAL", SYM(DECIMAL_SYM)},
|
||||
{ "DECLARE", SYM(DECLARE_SYM)},
|
||||
{ "DECLARE", SYM(DECLARE_MARIADB_SYM)},
|
||||
{ "DEFAULT", SYM(DEFAULT)},
|
||||
{ "DEFINER", SYM(DEFINER_SYM)},
|
||||
{ "DELAYED", SYM(DELAYED_SYM)},
|
||||
|
@ -205,8 +205,8 @@ static SYMBOL symbols[] = {
|
|||
{ "DYNAMIC", SYM(DYNAMIC_SYM)},
|
||||
{ "EACH", SYM(EACH_SYM)},
|
||||
{ "ELSE", SYM(ELSE)},
|
||||
{ "ELSEIF", SYM(ELSEIF_SYM)},
|
||||
{ "ELSIF", SYM(ELSIF_SYM)},
|
||||
{ "ELSEIF", SYM(ELSEIF_MARIADB_SYM)},
|
||||
{ "ELSIF", SYM(ELSIF_MARIADB_SYM)},
|
||||
{ "ENABLE", SYM(ENABLE_SYM)},
|
||||
{ "ENCLOSED", SYM(ENCLOSED)},
|
||||
{ "END", SYM(END)},
|
||||
|
@ -226,9 +226,9 @@ static SYMBOL symbols[] = {
|
|||
{ "EXCHANGE", SYM(EXCHANGE_SYM)},
|
||||
{ "EXCLUDE", SYM(EXCLUDE_SYM)},
|
||||
{ "EXECUTE", SYM(EXECUTE_SYM)},
|
||||
{ "EXCEPTION", SYM(EXCEPTION_SYM)},
|
||||
{ "EXCEPTION", SYM(EXCEPTION_MARIADB_SYM)},
|
||||
{ "EXISTS", SYM(EXISTS)},
|
||||
{ "EXIT", SYM(EXIT_SYM)},
|
||||
{ "EXIT", SYM(EXIT_MARIADB_SYM)},
|
||||
{ "EXPANSION", SYM(EXPANSION_SYM)},
|
||||
{ "EXPORT", SYM(EXPORT_SYM)},
|
||||
{ "EXPLAIN", SYM(DESCRIBE)},
|
||||
|
@ -264,7 +264,7 @@ static SYMBOL symbols[] = {
|
|||
{ "GET_FORMAT", SYM(GET_FORMAT)},
|
||||
{ "GET", SYM(GET_SYM)},
|
||||
{ "GLOBAL", SYM(GLOBAL_SYM)},
|
||||
{ "GOTO", SYM(GOTO_SYM)},
|
||||
{ "GOTO", SYM(GOTO_MARIADB_SYM)},
|
||||
{ "GRANT", SYM(GRANT)},
|
||||
{ "GRANTS", SYM(GRANTS)},
|
||||
{ "GROUP", SYM(GROUP_SYM)},
|
||||
|
@ -434,7 +434,7 @@ static SYMBOL symbols[] = {
|
|||
{ "NOTFOUND", SYM(NOTFOUND_SYM)},
|
||||
{ "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG)},
|
||||
{ "NULL", SYM(NULL_SYM)},
|
||||
{ "NUMBER", SYM(NUMBER_SYM)},
|
||||
{ "NUMBER", SYM(NUMBER_MARIADB_SYM)},
|
||||
{ "NUMERIC", SYM(NUMERIC_SYM)},
|
||||
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
|
||||
{ "OF", SYM(OF_SYM)},
|
||||
|
@ -451,13 +451,13 @@ static SYMBOL symbols[] = {
|
|||
{ "OPTIONALLY", SYM(OPTIONALLY)},
|
||||
{ "OR", SYM(OR_SYM)},
|
||||
{ "ORDER", SYM(ORDER_SYM)},
|
||||
{ "OTHERS", SYM(OTHERS_SYM)},
|
||||
{ "OTHERS", SYM(OTHERS_MARIADB_SYM)},
|
||||
{ "OUT", SYM(OUT_SYM)},
|
||||
{ "OUTER", SYM(OUTER)},
|
||||
{ "OUTFILE", SYM(OUTFILE)},
|
||||
{ "OVER", SYM(OVER_SYM)},
|
||||
{ "OWNER", SYM(OWNER_SYM)},
|
||||
{ "PACKAGE", SYM(PACKAGE_SYM)},
|
||||
{ "PACKAGE", SYM(PACKAGE_MARIADB_SYM)},
|
||||
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
|
||||
{ "PAGE", SYM(PAGE_SYM)},
|
||||
{ "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)},
|
||||
|
@ -495,9 +495,9 @@ static SYMBOL symbols[] = {
|
|||
{ "QUARTER", SYM(QUARTER_SYM)},
|
||||
{ "QUERY", SYM(QUERY_SYM)},
|
||||
{ "QUICK", SYM(QUICK)},
|
||||
{ "RAISE", SYM(RAISE_SYM)},
|
||||
{ "RAISE", SYM(RAISE_MARIADB_SYM)},
|
||||
{ "RANGE", SYM(RANGE_SYM)},
|
||||
{ "RAW", SYM(RAW)},
|
||||
{ "RAW", SYM(RAW_MARIADB_SYM)},
|
||||
{ "READ", SYM(READ_SYM)},
|
||||
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
|
||||
{ "READ_WRITE", SYM(READ_WRITE_SYM)},
|
||||
|
@ -534,7 +534,7 @@ static SYMBOL symbols[] = {
|
|||
{ "RESTRICT", SYM(RESTRICT)},
|
||||
{ "RESUME", SYM(RESUME_SYM)},
|
||||
{ "RETURNED_SQLSTATE",SYM(RETURNED_SQLSTATE_SYM)},
|
||||
{ "RETURN", SYM(RETURN_SYM)},
|
||||
{ "RETURN", SYM(RETURN_MARIADB_SYM)},
|
||||
{ "RETURNING", SYM(RETURNING_SYM)},
|
||||
{ "RETURNS", SYM(RETURNS_SYM)},
|
||||
{ "REUSE", SYM(REUSE_SYM)},
|
||||
|
@ -549,7 +549,7 @@ static SYMBOL symbols[] = {
|
|||
{ "ROW", SYM(ROW_SYM)},
|
||||
{ "ROWCOUNT", SYM(ROWCOUNT_SYM)}, /* Oracle-N */
|
||||
{ "ROWS", SYM(ROWS_SYM)},
|
||||
{ "ROWTYPE", SYM(ROWTYPE_SYM)},
|
||||
{ "ROWTYPE", SYM(ROWTYPE_MARIADB_SYM)},
|
||||
{ "ROW_COUNT", SYM(ROW_COUNT_SYM)},
|
||||
{ "ROW_FORMAT", SYM(ROW_FORMAT_SYM)},
|
||||
{ "RTREE", SYM(RTREE_SYM)},
|
||||
|
@ -694,7 +694,7 @@ static SYMBOL symbols[] = {
|
|||
{ "VARBINARY", SYM(VARBINARY)},
|
||||
{ "VARCHAR", SYM(VARCHAR)},
|
||||
{ "VARCHARACTER", SYM(VARCHAR)},
|
||||
{ "VARCHAR2", SYM(VARCHAR2)},
|
||||
{ "VARCHAR2", SYM(VARCHAR2_MARIADB_SYM)},
|
||||
{ "VARIABLES", SYM(VARIABLES)},
|
||||
{ "VARYING", SYM(VARYING)},
|
||||
{ "VIA", SYM(VIA_SYM)},
|
||||
|
@ -739,7 +739,7 @@ static SYMBOL sql_functions[] = {
|
|||
{ "DATE_ADD", SYM(DATE_ADD_INTERVAL)},
|
||||
{ "DATE_SUB", SYM(DATE_SUB_INTERVAL)},
|
||||
{ "DATE_FORMAT", SYM(DATE_FORMAT_SYM)},
|
||||
{ "DECODE", SYM(DECODE_SYM)},
|
||||
{ "DECODE", SYM(DECODE_MARIADB_SYM)},
|
||||
{ "DENSE_RANK", SYM(DENSE_RANK_SYM)},
|
||||
{ "EXTRACT", SYM(EXTRACT_SYM)},
|
||||
{ "FIRST_VALUE", SYM(FIRST_VALUE_SYM)},
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include <winservice.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
|
||||
extern int upgrade_config_file(const char *myini_path);
|
||||
|
||||
/* We're using version APIs */
|
||||
#pragma comment(lib, "version")
|
||||
|
@ -47,6 +50,8 @@ static char mysqlupgrade_path[MAX_PATH];
|
|||
|
||||
static char defaults_file_param[MAX_PATH + 16]; /*--defaults-file=<path> */
|
||||
static char logfile_path[MAX_PATH];
|
||||
char my_ini_bck[MAX_PATH];
|
||||
mysqld_service_properties service_properties;
|
||||
static char *opt_service;
|
||||
static SC_HANDLE service;
|
||||
static SC_HANDLE scm;
|
||||
|
@ -59,7 +64,7 @@ HANDLE logfile_handle;
|
|||
Maybe,they can be made parameters
|
||||
*/
|
||||
static unsigned int startup_timeout= 60;
|
||||
static unsigned int shutdown_timeout= 60;
|
||||
static unsigned int shutdown_timeout= 60*60;
|
||||
|
||||
static struct my_option my_long_options[]=
|
||||
{
|
||||
|
@ -112,6 +117,7 @@ static void die(const char *fmt, ...)
|
|||
|
||||
fprintf(stderr, "FATAL ERROR: ");
|
||||
vfprintf(stderr, fmt, args);
|
||||
fputc('\n', stderr);
|
||||
if (logfile_path[0])
|
||||
{
|
||||
fprintf(stderr, "Additional information can be found in the log file %s",
|
||||
|
@ -122,6 +128,11 @@ static void die(const char *fmt, ...)
|
|||
fflush(stdout);
|
||||
/* Cleanup */
|
||||
|
||||
if (my_ini_bck[0])
|
||||
{
|
||||
MoveFileEx(my_ini_bck, service_properties.inifile,MOVEFILE_REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
/*
|
||||
Stop service that we started, if it was not initally running at
|
||||
program start.
|
||||
|
@ -309,77 +320,76 @@ void initiate_mysqld_shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
static void get_service_config()
|
||||
{
|
||||
scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if (!scm)
|
||||
die("OpenSCManager failed with %u", GetLastError());
|
||||
service = OpenService(scm, opt_service, SERVICE_ALL_ACCESS);
|
||||
if (!service)
|
||||
die("OpenService failed with %u", GetLastError());
|
||||
|
||||
BYTE config_buffer[8 * 1024];
|
||||
LPQUERY_SERVICE_CONFIGW config = (LPQUERY_SERVICE_CONFIGW)config_buffer;
|
||||
DWORD size = sizeof(config_buffer);
|
||||
DWORD needed;
|
||||
if (!QueryServiceConfigW(service, config, size, &needed))
|
||||
die("QueryServiceConfig failed with %u", GetLastError());
|
||||
|
||||
if (get_mysql_service_properties(config->lpBinaryPathName, &service_properties))
|
||||
{
|
||||
die("Not a valid MySQL service");
|
||||
}
|
||||
|
||||
int my_major = MYSQL_VERSION_ID / 10000;
|
||||
int my_minor = (MYSQL_VERSION_ID % 10000) / 100;
|
||||
int my_patch = MYSQL_VERSION_ID % 100;
|
||||
|
||||
if (my_major < service_properties.version_major ||
|
||||
(my_major == service_properties.version_major && my_minor < service_properties.version_minor))
|
||||
{
|
||||
die("Can not downgrade, the service is currently running as version %d.%d.%d"
|
||||
", my version is %d.%d.%d", service_properties.version_major, service_properties.version_minor,
|
||||
service_properties.version_patch, my_major, my_minor, my_patch);
|
||||
}
|
||||
if (service_properties.inifile[0] == 0)
|
||||
{
|
||||
/*
|
||||
Weird case, no --defaults-file in service definition, need to create one.
|
||||
*/
|
||||
sprintf_s(service_properties.inifile, MAX_PATH, "%s\\my.ini", service_properties.datadir);
|
||||
}
|
||||
sprintf(defaults_file_param, "--defaults-file=%s", service_properties.inifile);
|
||||
}
|
||||
/*
|
||||
Change service configuration (binPath) to point to mysqld from
|
||||
this installation.
|
||||
*/
|
||||
static void change_service_config()
|
||||
{
|
||||
|
||||
char defaults_file[MAX_PATH];
|
||||
char default_character_set[64];
|
||||
char buf[MAX_PATH];
|
||||
char commandline[3*MAX_PATH + 19];
|
||||
char commandline[3 * MAX_PATH + 19];
|
||||
int i;
|
||||
|
||||
scm= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if(!scm)
|
||||
die("OpenSCManager failed with %u", GetLastError());
|
||||
service= OpenService(scm, opt_service, SERVICE_ALL_ACCESS);
|
||||
if (!service)
|
||||
die("OpenService failed with %u", GetLastError());
|
||||
|
||||
BYTE config_buffer[8*1024];
|
||||
LPQUERY_SERVICE_CONFIGW config= (LPQUERY_SERVICE_CONFIGW)config_buffer;
|
||||
DWORD size= sizeof(config_buffer);
|
||||
DWORD needed;
|
||||
if (!QueryServiceConfigW(service, config, size, &needed))
|
||||
die("QueryServiceConfig failed with %u", GetLastError());
|
||||
|
||||
mysqld_service_properties props;
|
||||
if (get_mysql_service_properties(config->lpBinaryPathName, &props))
|
||||
{
|
||||
die("Not a valid MySQL service");
|
||||
}
|
||||
|
||||
int my_major= MYSQL_VERSION_ID/10000;
|
||||
int my_minor= (MYSQL_VERSION_ID %10000)/100;
|
||||
int my_patch= MYSQL_VERSION_ID%100;
|
||||
|
||||
if(my_major < props.version_major ||
|
||||
(my_major == props.version_major && my_minor < props.version_minor))
|
||||
{
|
||||
die("Can not downgrade, the service is currently running as version %d.%d.%d"
|
||||
", my version is %d.%d.%d", props.version_major, props.version_minor,
|
||||
props.version_patch, my_major, my_minor, my_patch);
|
||||
}
|
||||
|
||||
if(props.inifile[0] == 0)
|
||||
{
|
||||
/*
|
||||
Weird case, no --defaults-file in service definition, need to create one.
|
||||
*/
|
||||
sprintf_s(props.inifile, MAX_PATH, "%s\\my.ini", props.datadir);
|
||||
}
|
||||
|
||||
/*
|
||||
Write datadir to my.ini, after converting backslashes to
|
||||
unix style slashes.
|
||||
*/
|
||||
strcpy_s(buf, MAX_PATH, props.datadir);
|
||||
strcpy_s(buf, MAX_PATH, service_properties.datadir);
|
||||
for(i= 0; buf[i]; i++)
|
||||
{
|
||||
if (buf[i] == '\\')
|
||||
buf[i]= '/';
|
||||
}
|
||||
WritePrivateProfileString("mysqld", "datadir",buf, props.inifile);
|
||||
WritePrivateProfileString("mysqld", "datadir",buf, service_properties.inifile);
|
||||
|
||||
/*
|
||||
Remove basedir from defaults file, otherwise the service wont come up in
|
||||
the new version, and will complain about mismatched message file.
|
||||
*/
|
||||
WritePrivateProfileString("mysqld", "basedir",NULL, props.inifile);
|
||||
WritePrivateProfileString("mysqld", "basedir",NULL, service_properties.inifile);
|
||||
|
||||
/*
|
||||
Replace default-character-set with character-set-server, to avoid
|
||||
|
@ -397,7 +407,7 @@ static void change_service_config()
|
|||
default_character_set, defaults_file);
|
||||
}
|
||||
|
||||
sprintf(defaults_file_param,"--defaults-file=%s", props.inifile);
|
||||
sprintf(defaults_file_param,"--defaults-file=%s", service_properties.inifile);
|
||||
sprintf_s(commandline, "\"%s\" \"%s\" \"%s\"", mysqld_path,
|
||||
defaults_file_param, opt_service);
|
||||
if (!ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
|
||||
|
@ -449,23 +459,97 @@ int main(int argc, char **argv)
|
|||
reads them from pipe and uses as progress indicator.
|
||||
*/
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
int phase = 0;
|
||||
int max_phases=10;
|
||||
get_service_config();
|
||||
|
||||
log("Phase 1/8: Changing service configuration");
|
||||
change_service_config();
|
||||
bool my_ini_exists;
|
||||
bool old_mysqld_exe_exists;
|
||||
|
||||
log("Phase 2/8: Stopping service");
|
||||
log("Phase %d/%d: Stopping service", ++phase,max_phases);
|
||||
stop_mysqld_service();
|
||||
|
||||
my_ini_exists = (GetFileAttributes(service_properties.inifile) != INVALID_FILE_ATTRIBUTES);
|
||||
if (!my_ini_exists)
|
||||
{
|
||||
HANDLE h = CreateFile(service_properties.inifile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
0, CREATE_NEW, 0 ,0);
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(h);
|
||||
}
|
||||
else if (GetLastError() != ERROR_FILE_EXISTS)
|
||||
{
|
||||
die("Can't create ini file %s, last error %u", service_properties.inifile, GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
old_mysqld_exe_exists = (GetFileAttributes(service_properties.mysqld_exe) != INVALID_FILE_ATTRIBUTES);
|
||||
log("Phase %d/%d: Fixing server config file%s", ++phase, max_phases, my_ini_exists ? "" : "(skipped)");
|
||||
|
||||
snprintf(my_ini_bck, sizeof(my_ini_bck), "%s.BCK", service_properties.inifile);
|
||||
CopyFile(service_properties.inifile, my_ini_bck, FALSE);
|
||||
upgrade_config_file(service_properties.inifile);
|
||||
|
||||
log("Phase %d/%d: Ensuring innodb slow shutdown%s", ++phase, max_phases,
|
||||
old_mysqld_exe_exists?",this can take some time":"(skipped)");
|
||||
|
||||
char socket_param[FN_REFLEN];
|
||||
sprintf_s(socket_param, "--socket=mysql_upgrade_service_%d",
|
||||
GetCurrentProcessId());
|
||||
|
||||
DWORD start_duration_ms = 0;
|
||||
|
||||
if (old_mysqld_exe_exists)
|
||||
{
|
||||
/* Start/stop server with --loose-innodb-fast-shutdown=0 */
|
||||
mysqld_process = (HANDLE)run_tool(P_NOWAIT, service_properties.mysqld_exe,
|
||||
defaults_file_param, "--loose-innodb-fast-shutdown=0", "--skip-networking",
|
||||
"--enable-named-pipe", socket_param, "--skip-slave-start", NULL);
|
||||
|
||||
if (mysqld_process == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
die("Cannot start mysqld.exe process, last error =%u", GetLastError());
|
||||
}
|
||||
char pipe_name[64];
|
||||
snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\mysql_upgrade_service_%u",
|
||||
GetCurrentProcessId());
|
||||
for (;;)
|
||||
{
|
||||
if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
|
||||
die("mysqld.exe did not start");
|
||||
|
||||
if (WaitNamedPipe(pipe_name, 0))
|
||||
{
|
||||
// Server started, shut it down.
|
||||
initiate_mysqld_shutdown();
|
||||
if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0)
|
||||
{
|
||||
die("Could not shutdown server started with '--innodb-fast-shutdown=0'");
|
||||
}
|
||||
DWORD exit_code;
|
||||
if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code))
|
||||
{
|
||||
die("Could not get mysqld's exit code");
|
||||
}
|
||||
if (exit_code)
|
||||
{
|
||||
die("Could not get successfully shutdown mysqld");
|
||||
}
|
||||
CloseHandle(mysqld_process);
|
||||
break;
|
||||
}
|
||||
Sleep(500);
|
||||
start_duration_ms += 500;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Start mysqld.exe as non-service skipping privileges (so we do not
|
||||
care about the password). But disable networking and enable pipe
|
||||
for communication, for security reasons.
|
||||
*/
|
||||
char socket_param[FN_REFLEN];
|
||||
sprintf_s(socket_param,"--socket=mysql_upgrade_service_%d",
|
||||
GetCurrentProcessId());
|
||||
|
||||
log("Phase 3/8: Starting mysqld for upgrade");
|
||||
log("Phase %d/%d: Starting mysqld for upgrade",++phase,max_phases);
|
||||
mysqld_process= (HANDLE)run_tool(P_NOWAIT, mysqld_path,
|
||||
defaults_file_param, "--skip-networking", "--skip-grant-tables",
|
||||
"--enable-named-pipe", socket_param,"--skip-slave-start", NULL);
|
||||
|
@ -475,8 +559,8 @@ int main(int argc, char **argv)
|
|||
die("Cannot start mysqld.exe process, errno=%d", errno);
|
||||
}
|
||||
|
||||
log("Phase 4/8: Waiting for startup to complete");
|
||||
DWORD start_duration_ms= 0;
|
||||
log("Phase %d/%d: Waiting for startup to complete",++phase,max_phases);
|
||||
start_duration_ms= 0;
|
||||
for(;;)
|
||||
{
|
||||
if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT)
|
||||
|
@ -493,7 +577,7 @@ int main(int argc, char **argv)
|
|||
start_duration_ms+= 500;
|
||||
}
|
||||
|
||||
log("Phase 5/8: Running mysql_upgrade");
|
||||
log("Phase %d/%d: Running mysql_upgrade",++phase,max_phases);
|
||||
int upgrade_err= (int) run_tool(P_WAIT, mysqlupgrade_path,
|
||||
"--protocol=pipe", "--force", socket_param,
|
||||
NULL);
|
||||
|
@ -501,10 +585,13 @@ int main(int argc, char **argv)
|
|||
if (upgrade_err)
|
||||
die("mysql_upgrade failed with error code %d\n", upgrade_err);
|
||||
|
||||
log("Phase 6/8: Initiating server shutdown");
|
||||
log("Phase %d/%d: Changing service configuration", ++phase, max_phases);
|
||||
change_service_config();
|
||||
|
||||
log("Phase %d/%d: Initiating server shutdown",++phase, max_phases);
|
||||
initiate_mysqld_shutdown();
|
||||
|
||||
log("Phase 7/8: Waiting for shutdown to complete");
|
||||
log("Phase %d/%d: Waiting for shutdown to complete",++phase, max_phases);
|
||||
if (WaitForSingleObject(mysqld_process, shutdown_timeout*1000)
|
||||
!= WAIT_OBJECT_0)
|
||||
{
|
||||
|
@ -514,7 +601,7 @@ int main(int argc, char **argv)
|
|||
CloseHandle(mysqld_process);
|
||||
mysqld_process= NULL;
|
||||
|
||||
log("Phase 8/8: Starting service%s",
|
||||
log("Phase %d/%d: Starting service%s",++phase,max_phases,
|
||||
(initial_service_state == SERVICE_RUNNING)?"":" (skipped)");
|
||||
if (initial_service_state == SERVICE_RUNNING)
|
||||
{
|
||||
|
@ -527,6 +614,10 @@ int main(int argc, char **argv)
|
|||
CloseServiceHandle(scm);
|
||||
if (logfile_handle)
|
||||
CloseHandle(logfile_handle);
|
||||
if(my_ini_bck[0])
|
||||
{
|
||||
DeleteFile(my_ini_bck);
|
||||
}
|
||||
my_end(0);
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -173,25 +173,6 @@ inline void Ack_receiver::wait_for_slave_connection()
|
|||
mysql_cond_wait(&m_cond, &m_mutex);
|
||||
}
|
||||
|
||||
my_socket Ack_receiver::get_slave_sockets(fd_set *fds, uint *count)
|
||||
{
|
||||
my_socket max_fd= INVALID_SOCKET;
|
||||
Slave *slave;
|
||||
I_List_iterator<Slave> it(m_slaves);
|
||||
|
||||
*count= 0;
|
||||
FD_ZERO(fds);
|
||||
while ((slave= it++))
|
||||
{
|
||||
(*count)++;
|
||||
my_socket fd= slave->sock_fd();
|
||||
max_fd= (fd > max_fd ? fd : max_fd);
|
||||
FD_SET(fd, fds);
|
||||
}
|
||||
|
||||
return max_fd;
|
||||
}
|
||||
|
||||
/* Auxilary function to initialize a NET object with given net buffer. */
|
||||
static void init_net(NET *net, unsigned char *buff, unsigned int buff_len)
|
||||
{
|
||||
|
@ -208,14 +189,17 @@ void Ack_receiver::run()
|
|||
THD *thd= new THD(next_thread_id(), false, true);
|
||||
NET net;
|
||||
unsigned char net_buff[REPLY_MESSAGE_MAX_LENGTH];
|
||||
fd_set read_fds;
|
||||
my_socket max_fd= INVALID_SOCKET;
|
||||
Slave *slave;
|
||||
|
||||
my_thread_init();
|
||||
|
||||
DBUG_ENTER("Ack_receiver::run");
|
||||
|
||||
#ifdef HAVE_POLL
|
||||
Poll_socket_listener listener(m_slaves);
|
||||
#else
|
||||
Select_socket_listener listener(m_slaves);
|
||||
#endif //HAVE_POLL
|
||||
|
||||
sql_print_information("Starting ack receiver thread");
|
||||
thd->system_thread= SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND;
|
||||
thd->thread_stack= (char*) &thd;
|
||||
|
@ -231,9 +215,9 @@ void Ack_receiver::run()
|
|||
|
||||
while (1)
|
||||
{
|
||||
fd_set fds;
|
||||
int ret;
|
||||
uint slave_count;
|
||||
uint slave_count __attribute__((unused))= 0;
|
||||
Slave *slave;
|
||||
|
||||
mysql_mutex_lock(&m_mutex);
|
||||
if (unlikely(m_status == ST_STOPPING))
|
||||
|
@ -249,23 +233,26 @@ void Ack_receiver::run()
|
|||
continue;
|
||||
}
|
||||
|
||||
max_fd= get_slave_sockets(&read_fds, &slave_count);
|
||||
if ((slave_count= listener.init_slave_sockets()) == 0)
|
||||
goto end;
|
||||
m_slaves_changed= false;
|
||||
DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count,(int) max_fd));
|
||||
#ifdef HAVE_POLL
|
||||
DBUG_PRINT("info", ("fd count %u", slave_count));
|
||||
#else
|
||||
DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count,
|
||||
(int) listener.get_max_fd()));
|
||||
#endif
|
||||
}
|
||||
|
||||
struct timeval tv= {1, 0};
|
||||
fds= read_fds;
|
||||
/* select requires max fd + 1 for the first argument */
|
||||
ret= select((int)(max_fd+1), &fds, NULL, NULL, &tv);
|
||||
ret= listener.listen_on_sockets();
|
||||
if (ret <= 0)
|
||||
{
|
||||
mysql_mutex_unlock(&m_mutex);
|
||||
|
||||
ret= DBUG_EVALUATE_IF("rpl_semisync_simulate_select_error", -1, ret);
|
||||
|
||||
if (ret == -1)
|
||||
sql_print_information("Failed to select() on semi-sync dump sockets, "
|
||||
if (ret == -1 && errno != EINTR)
|
||||
sql_print_information("Failed to wait on semi-sync sockets, "
|
||||
"error: errno=%d", socket_errno);
|
||||
/* Sleep 1us, so other threads can catch the m_mutex easily. */
|
||||
my_sleep(1);
|
||||
|
@ -273,11 +260,10 @@ void Ack_receiver::run()
|
|||
}
|
||||
|
||||
set_stage_info(stage_reading_semi_sync_ack);
|
||||
I_List_iterator<Slave> it(m_slaves);
|
||||
|
||||
Slave_ilist_iterator it(m_slaves);
|
||||
while ((slave= it++))
|
||||
{
|
||||
if (FD_ISSET(slave->sock_fd(), &fds))
|
||||
if (listener.is_socket_active(slave))
|
||||
{
|
||||
ulong len;
|
||||
|
||||
|
@ -289,7 +275,7 @@ void Ack_receiver::run()
|
|||
repl_semisync_master.report_reply_packet(slave->server_id(),
|
||||
net.read_pos, len);
|
||||
else if (net.last_errno == ER_NET_READ_ERROR)
|
||||
FD_CLR(slave->sock_fd(), &read_fds);
|
||||
listener.clear_socket_info(slave);
|
||||
}
|
||||
}
|
||||
mysql_mutex_unlock(&m_mutex);
|
||||
|
|
|
@ -20,6 +20,22 @@
|
|||
#include "my_pthread.h"
|
||||
#include "sql_class.h"
|
||||
#include "semisync.h"
|
||||
#include <vector>
|
||||
|
||||
struct Slave :public ilink
|
||||
{
|
||||
THD *thd;
|
||||
Vio vio;
|
||||
#ifdef HAVE_POLL
|
||||
uint m_fds_index;
|
||||
#endif
|
||||
my_socket sock_fd() const { return vio.mysql_socket.fd; }
|
||||
uint server_id() const { return thd->variables.server_id; }
|
||||
};
|
||||
|
||||
typedef I_List<Slave> Slave_ilist;
|
||||
typedef I_List_iterator<Slave> Slave_ilist_iterator;
|
||||
|
||||
/**
|
||||
Ack_receiver is responsible to control ack receive thread and maintain
|
||||
slave information used by ack receive thread.
|
||||
|
@ -92,18 +108,7 @@ private:
|
|||
/* If slave list is updated(add or remove). */
|
||||
bool m_slaves_changed;
|
||||
|
||||
class Slave :public ilink
|
||||
{
|
||||
public:
|
||||
THD *thd;
|
||||
Vio vio;
|
||||
|
||||
my_socket sock_fd() { return vio.mysql_socket.fd; }
|
||||
uint server_id() { return thd->variables.server_id; }
|
||||
};
|
||||
|
||||
I_List<Slave> m_slaves;
|
||||
|
||||
Slave_ilist m_slaves;
|
||||
pthread_t m_pid;
|
||||
|
||||
/* Declare them private, so no one can copy the object. */
|
||||
|
@ -112,8 +117,124 @@ public:
|
|||
|
||||
void set_stage_info(const PSI_stage_info &stage);
|
||||
void wait_for_slave_connection();
|
||||
my_socket get_slave_sockets(fd_set *fds, uint *count);
|
||||
};
|
||||
|
||||
|
||||
#ifdef HAVE_POLL
|
||||
#include <sys/poll.h>
|
||||
#include <vector>
|
||||
|
||||
class Poll_socket_listener
|
||||
{
|
||||
public:
|
||||
Poll_socket_listener(const Slave_ilist &slaves)
|
||||
:m_slaves(slaves)
|
||||
{
|
||||
}
|
||||
|
||||
bool listen_on_sockets()
|
||||
{
|
||||
return poll(m_fds.data(), m_fds.size(), 1000 /*1 Second timeout*/);
|
||||
}
|
||||
|
||||
bool is_socket_active(const Slave *slave)
|
||||
{
|
||||
return m_fds[slave->m_fds_index].revents & POLLIN;
|
||||
}
|
||||
|
||||
void clear_socket_info(const Slave *slave)
|
||||
{
|
||||
m_fds[slave->m_fds_index].fd= -1;
|
||||
m_fds[slave->m_fds_index].events= 0;
|
||||
}
|
||||
|
||||
uint init_slave_sockets()
|
||||
{
|
||||
Slave_ilist_iterator it(const_cast<Slave_ilist&>(m_slaves));
|
||||
Slave *slave;
|
||||
uint fds_index= 0;
|
||||
|
||||
m_fds.clear();
|
||||
while ((slave= it++))
|
||||
{
|
||||
pollfd poll_fd;
|
||||
poll_fd.fd= slave->sock_fd();
|
||||
poll_fd.events= POLLIN;
|
||||
m_fds.push_back(poll_fd);
|
||||
slave->m_fds_index= fds_index++;
|
||||
}
|
||||
return fds_index;
|
||||
}
|
||||
|
||||
private:
|
||||
const Slave_ilist &m_slaves;
|
||||
std::vector<pollfd> m_fds;
|
||||
};
|
||||
|
||||
#else //NO POLL
|
||||
|
||||
class Select_socket_listener
|
||||
{
|
||||
public:
|
||||
Select_socket_listener(const Slave_ilist &slaves)
|
||||
:m_slaves(slaves), m_max_fd(INVALID_SOCKET)
|
||||
{
|
||||
}
|
||||
|
||||
bool listen_on_sockets()
|
||||
{
|
||||
/* Reinitialze the fds with active fds before calling select */
|
||||
m_fds= m_init_fds;
|
||||
struct timeval tv= {1,0};
|
||||
/* select requires max fd + 1 for the first argument */
|
||||
return select((int) m_max_fd+1, &m_fds, NULL, NULL, &tv);
|
||||
}
|
||||
|
||||
bool is_socket_active(const Slave *slave)
|
||||
{
|
||||
return FD_ISSET(slave->sock_fd(), &m_fds);
|
||||
}
|
||||
|
||||
void clear_socket_info(const Slave *slave)
|
||||
{
|
||||
FD_CLR(slave->sock_fd(), &m_init_fds);
|
||||
}
|
||||
|
||||
uint init_slave_sockets()
|
||||
{
|
||||
Slave_ilist_iterator it(const_cast<Slave_ilist&>(m_slaves));
|
||||
Slave *slave;
|
||||
uint fds_index= 0;
|
||||
|
||||
FD_ZERO(&m_init_fds);
|
||||
while ((slave= it++))
|
||||
{
|
||||
my_socket socket_id= slave->sock_fd();
|
||||
m_max_fd= (socket_id > m_max_fd ? socket_id : m_max_fd);
|
||||
#ifndef WINDOWS
|
||||
if (socket_id > FD_SETSIZE)
|
||||
{
|
||||
sql_print_error("Semisync slave socket fd is %u. "
|
||||
"select() cannot handle if the socket fd is "
|
||||
"greater than %u (FD_SETSIZE).", socket_id, FD_SETSIZE);
|
||||
return 0;
|
||||
}
|
||||
#endif //WINDOWS
|
||||
FD_SET(socket_id, &m_init_fds);
|
||||
fds_index++;
|
||||
}
|
||||
return fds_index;
|
||||
}
|
||||
my_socket get_max_fd() { return m_max_fd; }
|
||||
|
||||
private:
|
||||
const Slave_ilist &m_slaves;
|
||||
my_socket m_max_fd;
|
||||
fd_set m_init_fds;
|
||||
fd_set m_fds;
|
||||
};
|
||||
|
||||
#endif //HAVE_POLL
|
||||
|
||||
extern Ack_receiver ack_receiver;
|
||||
#endif
|
||||
|
|
|
@ -4444,24 +4444,26 @@ sp_instr_cursor_copy_struct::exec_core(THD *thd, uint *nextp)
|
|||
*/
|
||||
if (!row->arguments())
|
||||
{
|
||||
sp_cursor tmp(thd, &m_lex_keeper);
|
||||
sp_cursor tmp(thd, &m_lex_keeper, true);
|
||||
// Open the cursor without copying data
|
||||
if (!(ret= tmp.open_view_structure_only(thd)))
|
||||
if (!(ret= tmp.open(thd)))
|
||||
{
|
||||
Row_definition_list defs;
|
||||
/*
|
||||
Create row elements on the caller arena.
|
||||
It's the same arena that was used during sp_rcontext::create().
|
||||
This puts cursor%ROWTYPE elements on the same mem_root
|
||||
where explicit ROW elements and table%ROWTYPE reside:
|
||||
- tmp.export_structure() allocates new Spvar_definition instances
|
||||
and their components (such as TYPELIBs).
|
||||
- row->row_create_items() creates new Item_field instances.
|
||||
They all are created on the same mem_root.
|
||||
*/
|
||||
Query_arena current_arena;
|
||||
thd->set_n_backup_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
if (!(ret= tmp.export_structure(thd, &defs)))
|
||||
{
|
||||
/*
|
||||
Create row elements on the caller arena.
|
||||
It's the same arena that was used during sp_rcontext::create().
|
||||
This puts cursor%ROWTYPE elements on the same mem_root
|
||||
where explicit ROW elements and table%ROWTYPE reside.
|
||||
*/
|
||||
Query_arena current_arena;
|
||||
thd->set_n_backup_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
row->row_create_items(thd, &defs);
|
||||
thd->restore_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
}
|
||||
thd->restore_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
tmp.close(thd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,6 +409,19 @@ sp_condition_value *sp_pcontext::find_condition(const LEX_CSTRING *name,
|
|||
NULL;
|
||||
}
|
||||
|
||||
sp_condition_value *
|
||||
sp_pcontext::find_declared_or_predefined_condition(THD *thd,
|
||||
const LEX_CSTRING *name)
|
||||
const
|
||||
{
|
||||
sp_condition_value *p= find_condition(name, false);
|
||||
if (p)
|
||||
return p;
|
||||
if (thd->variables.sql_mode & MODE_ORACLE)
|
||||
return find_predefined_condition(name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static sp_condition_value
|
||||
// Warnings
|
||||
|
|
|
@ -592,13 +592,7 @@ public:
|
|||
bool current_scope_only) const;
|
||||
|
||||
sp_condition_value *
|
||||
find_declared_or_predefined_condition(const LEX_CSTRING *name) const
|
||||
{
|
||||
sp_condition_value *p= find_condition(name, false);
|
||||
if (p)
|
||||
return p;
|
||||
return find_predefined_condition(name);
|
||||
}
|
||||
find_declared_or_predefined_condition(THD *thd, const LEX_CSTRING *name) const;
|
||||
|
||||
bool declare_condition(THD *thd, const LEX_CSTRING *name,
|
||||
sp_condition_value *val)
|
||||
|
|
|
@ -750,33 +750,6 @@ int sp_cursor::open(THD *thd)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Open the cursor, but do not copy data.
|
||||
This method is used to fetch the cursor structure
|
||||
to cursor%ROWTYPE routine variables.
|
||||
Data copying is suppressed by setting thd->lex->limit_rows_examined to 0.
|
||||
*/
|
||||
int sp_cursor::open_view_structure_only(THD *thd)
|
||||
{
|
||||
int res;
|
||||
int thd_no_errors_save= thd->no_errors;
|
||||
Item *limit_rows_examined= thd->lex->limit_rows_examined; // No data copying
|
||||
if (!(thd->lex->limit_rows_examined= new (thd->mem_root) Item_uint(thd, 0)))
|
||||
return -1;
|
||||
thd->no_errors= true; // Suppress ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT
|
||||
DBUG_ASSERT(!thd->killed);
|
||||
res= open(thd);
|
||||
/*
|
||||
The query possibly exited on LIMIT ROWS EXAMINED and set thd->killed.
|
||||
Reset it now.
|
||||
*/
|
||||
thd->reset_killed();
|
||||
thd->no_errors= thd_no_errors_save;
|
||||
thd->lex->limit_rows_examined= limit_rows_examined;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int sp_cursor::close(THD *thd)
|
||||
{
|
||||
if (! server_side_cursor)
|
||||
|
|
|
@ -5108,6 +5108,14 @@ public:
|
|||
Currently all intercepting classes derive from select_result_interceptor.
|
||||
*/
|
||||
virtual bool is_result_interceptor()=0;
|
||||
|
||||
/*
|
||||
This method is used to distinguish an normal SELECT from the cursor
|
||||
structure discovery for cursor%ROWTYPE routine variables.
|
||||
If this method returns "true", then a SELECT execution performs only
|
||||
all preparation stages, but does not fetch any rows.
|
||||
*/
|
||||
virtual bool view_structure_only() const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -5227,9 +5235,13 @@ private:
|
|||
{
|
||||
List<sp_variable> *spvar_list;
|
||||
uint field_count;
|
||||
bool m_view_structure_only;
|
||||
bool send_data_to_variable_list(List<sp_variable> &vars, List<Item> &items);
|
||||
public:
|
||||
Select_fetch_into_spvars(THD *thd_arg): select_result_interceptor(thd_arg) {}
|
||||
Select_fetch_into_spvars(THD *thd_arg, bool view_structure_only)
|
||||
:select_result_interceptor(thd_arg),
|
||||
m_view_structure_only(view_structure_only)
|
||||
{}
|
||||
void reset(THD *thd_arg)
|
||||
{
|
||||
select_result_interceptor::reset(thd_arg);
|
||||
|
@ -5242,16 +5254,17 @@ private:
|
|||
virtual bool send_eof() { return FALSE; }
|
||||
virtual int send_data(List<Item> &items);
|
||||
virtual int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||
virtual bool view_structure_only() const { return m_view_structure_only; }
|
||||
};
|
||||
|
||||
public:
|
||||
sp_cursor()
|
||||
:result(NULL),
|
||||
:result(NULL, false),
|
||||
m_lex_keeper(NULL),
|
||||
server_side_cursor(NULL)
|
||||
{ }
|
||||
sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper)
|
||||
:result(thd_arg),
|
||||
sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, bool view_structure_only)
|
||||
:result(thd_arg, view_structure_only),
|
||||
m_lex_keeper(lex_keeper),
|
||||
server_side_cursor(NULL)
|
||||
{}
|
||||
|
@ -5263,8 +5276,6 @@ public:
|
|||
|
||||
int open(THD *thd);
|
||||
|
||||
int open_view_structure_only(THD *thd);
|
||||
|
||||
int close(THD *thd);
|
||||
|
||||
my_bool is_open()
|
||||
|
|
|
@ -92,6 +92,11 @@ public:
|
|||
if (materialized_cursor)
|
||||
materialized_cursor->on_table_fill_finished();
|
||||
}
|
||||
|
||||
bool view_structure_only() const
|
||||
{
|
||||
return result->view_structure_only();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -856,6 +856,32 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
|
|||
DBUG_ASSERT(tok >= get_buf());
|
||||
DBUG_ASSERT(tok < get_end_of_query());
|
||||
|
||||
if (m_thd->variables.sql_mode & MODE_ORACLE)
|
||||
{
|
||||
switch (symbol->tok) {
|
||||
case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM;
|
||||
case BLOB_MARIADB_SYM: return BLOB_ORACLE_SYM;
|
||||
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
|
||||
case CLOB_MARIADB_SYM: return CLOB_ORACLE_SYM;
|
||||
case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM;
|
||||
case DECLARE_MARIADB_SYM: return DECLARE_ORACLE_SYM;
|
||||
case DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM;
|
||||
case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM;
|
||||
case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM;
|
||||
case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM;
|
||||
case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM;
|
||||
case GOTO_MARIADB_SYM: return GOTO_ORACLE_SYM;
|
||||
case NUMBER_MARIADB_SYM: return NUMBER_ORACLE_SYM;
|
||||
case OTHERS_MARIADB_SYM: return OTHERS_ORACLE_SYM;
|
||||
case PACKAGE_MARIADB_SYM: return PACKAGE_ORACLE_SYM;
|
||||
case RAISE_MARIADB_SYM: return RAISE_ORACLE_SYM;
|
||||
case RAW_MARIADB_SYM: return RAW_ORACLE_SYM;
|
||||
case RETURN_MARIADB_SYM: return RETURN_ORACLE_SYM;
|
||||
case ROWTYPE_MARIADB_SYM: return ROWTYPE_ORACLE_SYM;
|
||||
case VARCHAR2_MARIADB_SYM: return VARCHAR2_ORACLE_SYM;
|
||||
}
|
||||
}
|
||||
|
||||
if ((symbol->tok == NOT_SYM) &&
|
||||
(m_thd->variables.sql_mode & MODE_HIGH_NOT_PRECEDENCE))
|
||||
return NOT2_SYM;
|
||||
|
@ -1470,6 +1496,12 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
}
|
||||
/* Fall through */
|
||||
case MY_LEX_CHAR: // Unknown or single char token
|
||||
if (c == '%' && (m_thd->variables.sql_mode & MODE_ORACLE))
|
||||
{
|
||||
next_state= MY_LEX_START;
|
||||
return PERCENT_ORACLE_SYM;
|
||||
}
|
||||
/* Fall through */
|
||||
case MY_LEX_SKIP: // This should not happen
|
||||
if (c != ')')
|
||||
next_state= MY_LEX_START; // Allow signed numbers
|
||||
|
@ -1908,8 +1940,13 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
case MY_LEX_SET_VAR: // Check if ':='
|
||||
if (yyPeek() != '=')
|
||||
{
|
||||
state= MY_LEX_CHAR; // Return ':'
|
||||
break;
|
||||
next_state= MY_LEX_START;
|
||||
if (m_thd->variables.sql_mode & MODE_ORACLE)
|
||||
{
|
||||
yylval->kwd.set_keyword(m_tok_start, 1);
|
||||
return COLON_ORACLE_SYM;
|
||||
}
|
||||
return (int) ':';
|
||||
}
|
||||
yySkip();
|
||||
return (SET_VAR);
|
||||
|
@ -5926,7 +5963,7 @@ bool LEX::sp_for_loop_implicit_cursor_statement(THD *thd,
|
|||
return true;
|
||||
DBUG_ASSERT(thd->lex == this);
|
||||
bounds->m_direction= 1;
|
||||
bounds->m_upper_bound= NULL;
|
||||
bounds->m_target_bound= NULL;
|
||||
bounds->m_implicit_cursor= true;
|
||||
return false;
|
||||
}
|
||||
|
@ -5970,7 +6007,7 @@ bool LEX::sp_for_loop_condition(THD *thd, const Lex_for_loop_st &loop)
|
|||
Item_splocal *args[2];
|
||||
for (uint i= 0 ; i < 2; i++)
|
||||
{
|
||||
sp_variable *src= i == 0 ? loop.m_index : loop.m_upper_bound;
|
||||
sp_variable *src= i == 0 ? loop.m_index : loop.m_target_bound;
|
||||
args[i]= new (thd->mem_root)
|
||||
Item_splocal(thd, &sp_rcontext_handler_local,
|
||||
&src->name, src->offset, src->type_handler());
|
||||
|
@ -6033,7 +6070,7 @@ bool LEX::sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
|
|||
my_error(ER_SP_UNDECLARED_VAR, MYF(0), item->full_name());
|
||||
return true;
|
||||
}
|
||||
if ((item= bounds.m_upper_bound->get_item())->type() == Item::FIELD_ITEM)
|
||||
if ((item= bounds.m_target_bound->get_item())->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
// We're here is the upper bound is unknown identifier
|
||||
my_error(ER_SP_UNDECLARED_VAR, MYF(0), item->full_name());
|
||||
|
@ -6043,11 +6080,11 @@ bool LEX::sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
|
|||
bounds.m_index->sp_add_for_loop_variable(thd, index,
|
||||
bounds.m_index->get_item())))
|
||||
return true;
|
||||
if (unlikely(!(loop->m_upper_bound=
|
||||
bounds.m_upper_bound->
|
||||
sp_add_for_loop_upper_bound(thd,
|
||||
bounds.
|
||||
m_upper_bound->get_item()))))
|
||||
if (unlikely(!(loop->m_target_bound=
|
||||
bounds.m_target_bound->
|
||||
sp_add_for_loop_target_bound(thd,
|
||||
bounds.
|
||||
m_target_bound->get_item()))))
|
||||
return true;
|
||||
loop->m_direction= bounds.m_direction;
|
||||
loop->m_implicit_cursor= 0;
|
||||
|
@ -6110,7 +6147,7 @@ bool LEX::sp_for_loop_cursor_declarations(THD *thd,
|
|||
bounds.m_index,
|
||||
item_func_sp)))
|
||||
return true;
|
||||
loop->m_upper_bound= NULL;
|
||||
loop->m_target_bound= NULL;
|
||||
loop->m_direction= bounds.m_direction;
|
||||
loop->m_cursor_offset= coffs;
|
||||
loop->m_implicit_cursor= bounds.m_implicit_cursor;
|
||||
|
@ -6916,6 +6953,30 @@ Item *LEX::make_item_colon_ident_ident(THD *thd,
|
|||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name,
|
||||
plsql_cursor_attr_t attr)
|
||||
{
|
||||
uint offset;
|
||||
if (unlikely(!spcont || !spcont->find_cursor(name, &offset, false)))
|
||||
{
|
||||
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), name->str);
|
||||
return NULL;
|
||||
}
|
||||
switch (attr) {
|
||||
case PLSQL_CURSOR_ATTR_ISOPEN:
|
||||
return new (thd->mem_root) Item_func_cursor_isopen(thd, name, offset);
|
||||
case PLSQL_CURSOR_ATTR_FOUND:
|
||||
return new (thd->mem_root) Item_func_cursor_found(thd, name, offset);
|
||||
case PLSQL_CURSOR_ATTR_NOTFOUND:
|
||||
return new (thd->mem_root) Item_func_cursor_notfound(thd, name, offset);
|
||||
case PLSQL_CURSOR_ATTR_ROWCOUNT:
|
||||
return new (thd->mem_root) Item_func_cursor_rowcount(thd, name, offset);
|
||||
}
|
||||
DBUG_ASSERT(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_sysvar(THD *thd,
|
||||
enum_var_type type,
|
||||
const LEX_CSTRING *name,
|
||||
|
|
|
@ -207,6 +207,16 @@ enum enum_view_suid
|
|||
VIEW_SUID_DEFAULT= 2
|
||||
};
|
||||
|
||||
|
||||
enum plsql_cursor_attr_t
|
||||
{
|
||||
PLSQL_CURSOR_ATTR_ISOPEN,
|
||||
PLSQL_CURSOR_ATTR_FOUND,
|
||||
PLSQL_CURSOR_ATTR_NOTFOUND,
|
||||
PLSQL_CURSOR_ATTR_ROWCOUNT
|
||||
};
|
||||
|
||||
|
||||
/* These may not be declared yet */
|
||||
class Table_ident;
|
||||
class sql_exchange;
|
||||
|
@ -3878,6 +3888,10 @@ public:
|
|||
Item *make_item_colon_ident_ident(THD *thd,
|
||||
const Lex_ident_cli_st *a,
|
||||
const Lex_ident_cli_st *b);
|
||||
// PLSQL: cursor%ISOPEN etc
|
||||
Item *make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name,
|
||||
plsql_cursor_attr_t attr);
|
||||
|
||||
// For "SELECT @@var", "SELECT @@var.field"
|
||||
Item *make_item_sysvar(THD *thd,
|
||||
enum_var_type type,
|
||||
|
@ -3958,9 +3972,9 @@ public:
|
|||
/* Integer range FOR LOOP methods */
|
||||
sp_variable *sp_add_for_loop_variable(THD *thd, const LEX_CSTRING *name,
|
||||
Item *value);
|
||||
sp_variable *sp_add_for_loop_upper_bound(THD *thd, Item *value)
|
||||
sp_variable *sp_add_for_loop_target_bound(THD *thd, Item *value)
|
||||
{
|
||||
LEX_CSTRING name= { STRING_WITH_LEN("[upper_bound]") };
|
||||
LEX_CSTRING name= { STRING_WITH_LEN("[target_bound]") };
|
||||
return sp_add_for_loop_variable(thd, &name, value);
|
||||
}
|
||||
bool sp_for_loop_intrange_declarations(THD *thd, Lex_for_loop_st *loop,
|
||||
|
|
|
@ -2915,6 +2915,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
|||
{
|
||||
SELECT_LEX *sl= lex->all_selects_list;
|
||||
DBUG_ENTER("reinit_stmt_before_use");
|
||||
Window_spec *win_spec;
|
||||
|
||||
/*
|
||||
We have to update "thd" pointer in LEX, all its units and in LEX::result,
|
||||
|
@ -2983,6 +2984,17 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
|||
/* Fix ORDER list */
|
||||
for (order= sl->order_list.first; order; order= order->next)
|
||||
order->item= &order->item_ptr;
|
||||
/* Fix window functions too */
|
||||
List_iterator<Window_spec> it(sl->window_specs);
|
||||
|
||||
while ((win_spec= it++))
|
||||
{
|
||||
for (order= win_spec->partition_list->first; order; order= order->next)
|
||||
order->item= &order->item_ptr;
|
||||
for (order= win_spec->order_list->first; order; order= order->next)
|
||||
order->item= &order->item_ptr;
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef DBUG_ASSERT_EXISTS
|
||||
bool res=
|
||||
|
|
|
@ -2655,6 +2655,18 @@ setup_subq_exit:
|
|||
if (!tables_list || !table_count)
|
||||
{
|
||||
choose_tableless_subquery_plan();
|
||||
|
||||
/* The output has atmost one row */
|
||||
if (group_list)
|
||||
{
|
||||
group_list= NULL;
|
||||
group_optimized_away= 1;
|
||||
rollup.state= ROLLUP::STATE_NONE;
|
||||
}
|
||||
order= NULL;
|
||||
simple_order= TRUE;
|
||||
select_distinct= FALSE;
|
||||
|
||||
if (select_lex->have_window_funcs())
|
||||
{
|
||||
if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))
|
||||
|
@ -4079,7 +4091,7 @@ void JOIN::exec_inner()
|
|||
procedure ? procedure_fields_list : *fields,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
||||
|
||||
error= do_select(this, procedure);
|
||||
error= result->view_structure_only() ? false : do_select(this, procedure);
|
||||
/* Accumulate the counts from all join iterations of all join parts. */
|
||||
thd->inc_examined_row_count(join_examined_rows);
|
||||
DBUG_PRINT("counts", ("thd->examined_row_count: %lu",
|
||||
|
|
|
@ -51,11 +51,24 @@ class Longlong_hybrid: public Longlong
|
|||
{
|
||||
protected:
|
||||
bool m_unsigned;
|
||||
int cmp_signed(const Longlong_hybrid& other) const
|
||||
{
|
||||
return m_value < other.m_value ? -1 : m_value == other.m_value ? 0 : 1;
|
||||
}
|
||||
int cmp_unsigned(const Longlong_hybrid& other) const
|
||||
{
|
||||
return (ulonglong) m_value < (ulonglong) other.m_value ? -1 :
|
||||
m_value == other.m_value ? 0 : 1;
|
||||
}
|
||||
public:
|
||||
Longlong_hybrid(longlong nr, bool unsigned_flag)
|
||||
:Longlong(nr), m_unsigned(unsigned_flag)
|
||||
{ }
|
||||
bool is_unsigned() const { return m_unsigned; }
|
||||
bool is_unsigned_outside_of_signed_range() const
|
||||
{
|
||||
return m_unsigned && ((ulonglong) m_value) > (ulonglong) LONGLONG_MAX;
|
||||
}
|
||||
bool neg() const { return m_value < 0 && !m_unsigned; }
|
||||
ulonglong abs() const
|
||||
{
|
||||
|
@ -65,6 +78,21 @@ public:
|
|||
return ((ulonglong) LONGLONG_MAX) + 1;
|
||||
return m_value < 0 ? -m_value : m_value;
|
||||
}
|
||||
int cmp(const Longlong_hybrid& other) const
|
||||
{
|
||||
if (m_unsigned == other.m_unsigned)
|
||||
return m_unsigned ? cmp_unsigned(other) : cmp_signed(other);
|
||||
if (is_unsigned_outside_of_signed_range())
|
||||
return 1;
|
||||
if (other.is_unsigned_outside_of_signed_range())
|
||||
return -1;
|
||||
/*
|
||||
The unsigned argument is in the range 0..LONGLONG_MAX.
|
||||
The signed argument is in the range LONGLONG_MIN..LONGLONG_MAX.
|
||||
Safe to compare as signed.
|
||||
*/
|
||||
return cmp_signed(other);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2580,7 +2580,7 @@ int multi_update::do_updates()
|
|||
check_opt_it.rewind();
|
||||
while(TABLE *tbl= check_opt_it++)
|
||||
{
|
||||
if (unlikely((local_error= tbl->file->ha_rnd_init(1))))
|
||||
if (unlikely((local_error= tbl->file->ha_rnd_init(0))))
|
||||
{
|
||||
err_table= tbl;
|
||||
goto err;
|
||||
|
|
505
sql/sql_yacc.yy
505
sql/sql_yacc.yy
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -691,26 +691,41 @@ public:
|
|||
struct Lex_for_loop_bounds_st
|
||||
{
|
||||
public:
|
||||
class sp_assignment_lex *m_index;
|
||||
class sp_assignment_lex *m_upper_bound;
|
||||
class sp_assignment_lex *m_index; // The first iteration value (or cursor)
|
||||
class sp_assignment_lex *m_target_bound; // The last iteration value
|
||||
int8 m_direction;
|
||||
bool m_implicit_cursor;
|
||||
bool is_for_loop_cursor() const { return m_upper_bound == NULL; }
|
||||
bool is_for_loop_cursor() const { return m_target_bound == NULL; }
|
||||
};
|
||||
|
||||
|
||||
class Lex_for_loop_bounds_intrange: public Lex_for_loop_bounds_st
|
||||
{
|
||||
public:
|
||||
Lex_for_loop_bounds_intrange(int8 direction,
|
||||
class sp_assignment_lex *left_expr,
|
||||
class sp_assignment_lex *right_expr)
|
||||
{
|
||||
m_direction= direction;
|
||||
m_index= direction > 0 ? left_expr : right_expr;
|
||||
m_target_bound= direction > 0 ? right_expr : left_expr;
|
||||
m_implicit_cursor= false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Lex_for_loop_st
|
||||
{
|
||||
public:
|
||||
class sp_variable *m_index;
|
||||
class sp_variable *m_upper_bound;
|
||||
class sp_variable *m_index; // The first iteration value (or cursor)
|
||||
class sp_variable *m_target_bound; // The last iteration value
|
||||
int m_cursor_offset;
|
||||
int8 m_direction;
|
||||
bool m_implicit_cursor;
|
||||
void init()
|
||||
{
|
||||
m_index= 0;
|
||||
m_upper_bound= 0;
|
||||
m_target_bound= 0;
|
||||
m_direction= 0;
|
||||
m_implicit_cursor= false;
|
||||
}
|
||||
|
@ -718,7 +733,7 @@ public:
|
|||
{
|
||||
*this= other;
|
||||
}
|
||||
bool is_for_loop_cursor() const { return m_upper_bound == NULL; }
|
||||
bool is_for_loop_cursor() const { return m_target_bound == NULL; }
|
||||
bool is_for_loop_explicit_cursor() const
|
||||
{
|
||||
return is_for_loop_cursor() && !m_implicit_cursor;
|
||||
|
|
177
sql/upgrade_conf_file.cc
Normal file
177
sql/upgrade_conf_file.cc
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
|
||||
/*
|
||||
Variables that were present in older releases, but are now removed.
|
||||
to get the list of variables that are present in current release
|
||||
execute
|
||||
|
||||
SELECT LOWER(variable_name) from INFORMATION_SCHEMA.GLOBAL_VARIABLES ORDER BY 1
|
||||
|
||||
Compare the list between releases to figure out which variables have gone.
|
||||
|
||||
Note : the list below only includes the default-compiled server and none of the
|
||||
loadable plugins.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <initializer_list>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
|
||||
static const char *removed_variables[] =
|
||||
{
|
||||
"aria_recover",
|
||||
"debug_crc_break",
|
||||
"engine_condition_pushdown",
|
||||
"have_csv",
|
||||
"have_innodb",
|
||||
"have_ndbcluster",
|
||||
"have_partitioning",
|
||||
"innodb_adaptive_flushing_method",
|
||||
"innodb_adaptive_hash_index_partitions",
|
||||
"innodb_additional_mem_pool_size",
|
||||
"innodb_api_bk_commit_interval",
|
||||
"innodb_api_disable_rowlock",
|
||||
"innodb_api_enable_binlog",
|
||||
"innodb_api_enable_mdl",
|
||||
"innodb_api_trx_level",
|
||||
"innodb_blocking_buffer_pool_restore",
|
||||
"innodb_buffer_pool_populate",
|
||||
"innodb_buffer_pool_restore_at_startup",
|
||||
"innodb_buffer_pool_shm_checksum",
|
||||
"innodb_buffer_pool_shm_key",
|
||||
"innodb_checkpoint_age_target",
|
||||
"innodb_cleaner_eviction_factor",
|
||||
"innodb_cleaner_flush_chunk_size",
|
||||
"innodb_cleaner_free_list_lwm",
|
||||
"innodb_cleaner_lru_chunk_size",
|
||||
"innodb_cleaner_lsn_age_factor",
|
||||
"innodb_cleaner_max_flush_time",
|
||||
"innodb_cleaner_max_lru_time",
|
||||
"innodb_corrupt_table_action",
|
||||
"innodb_dict_size_limit",
|
||||
"innodb_doublewrite_file",
|
||||
"innodb_empty_free_list_algorithm",
|
||||
"innodb_fake_changes",
|
||||
"innodb_fast_checksum",
|
||||
"innodb_file_format",
|
||||
"innodb_file_format_check",
|
||||
"innodb_file_format_max",
|
||||
"innodb_flush_neighbor_pages",
|
||||
"innodb_foreground_preflush",
|
||||
"innodb_ibuf_accel_rate",
|
||||
"innodb_ibuf_active_contract",
|
||||
"innodb_ibuf_max_size",
|
||||
"innodb_import_table_from_xtrabackup",
|
||||
"innodb_instrument_semaphores",
|
||||
"innodb_kill_idle_transaction",
|
||||
"innodb_large_prefix",
|
||||
"innodb_lazy_drop_table",
|
||||
"innodb_locking_fake_changes",
|
||||
"innodb_log_arch_dir",
|
||||
"innodb_log_arch_expire_sec",
|
||||
"innodb_log_archive",
|
||||
"innodb_log_block_size",
|
||||
"innodb_log_checksum_algorithm",
|
||||
"innodb_max_bitmap_file_size",
|
||||
"innodb_max_changed_pages",
|
||||
"innodb_merge_sort_block_size",
|
||||
"innodb_mirrored_log_groups",
|
||||
"innodb_mtflush_threads",
|
||||
"innodb_persistent_stats_root_page",
|
||||
"innodb_print_lock_wait_timeout_info",
|
||||
"innodb_purge_run_now",
|
||||
"innodb_purge_stop_now",
|
||||
"innodb_read_ahead",
|
||||
"innodb_recovery_stats",
|
||||
"innodb_recovery_update_relay_log",
|
||||
"innodb_show_locks_held",
|
||||
"innodb_show_verbose_locks",
|
||||
"innodb_stats_auto_update",
|
||||
"innodb_stats_update_need_lock",
|
||||
"innodb_support_xa",
|
||||
"innodb_thread_concurrency_timer_based",
|
||||
"innodb_track_changed_pages",
|
||||
"innodb_track_redo_log_now",
|
||||
"innodb_use_fallocate",
|
||||
"innodb_use_global_flush_log_at_trx_commit",
|
||||
"innodb_use_mtflush",
|
||||
"innodb_use_stacktrace",
|
||||
"innodb_use_sys_malloc",
|
||||
"innodb_use_sys_stats_table",
|
||||
"innodb_use_trim",
|
||||
"log",
|
||||
"log_slow_queries",
|
||||
"rpl_recovery_rank",
|
||||
"sql_big_tables",
|
||||
"sql_low_priority_updates",
|
||||
"sql_max_join_size"
|
||||
};
|
||||
|
||||
|
||||
static int cmp_strings(const void* a, const void *b)
|
||||
{
|
||||
return strcmp((const char *)a, *(const char **)b);
|
||||
}
|
||||
|
||||
/**
|
||||
Convert file from a previous version, by removing
|
||||
*/
|
||||
int upgrade_config_file(const char *myini_path)
|
||||
{
|
||||
#define MY_INI_SECTION_SIZE 32*1024 +3
|
||||
static char section_data[MY_INI_SECTION_SIZE];
|
||||
for (const char *section_name : { "mysqld","server","mariadb" })
|
||||
{
|
||||
DWORD size = GetPrivateProfileSection(section_name, section_data, MY_INI_SECTION_SIZE, myini_path);
|
||||
if (size == MY_INI_SECTION_SIZE - 2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (char *keyval = section_data; *keyval; keyval += strlen(keyval) + 1)
|
||||
{
|
||||
char varname[256];
|
||||
char *key_end = strchr(keyval, '=');
|
||||
if (!key_end)
|
||||
key_end = keyval+ strlen(keyval);
|
||||
|
||||
if (key_end - keyval > sizeof(varname))
|
||||
continue;
|
||||
// copy and normalize (convert dash to underscore) to variable names
|
||||
for (char *p = keyval, *q = varname;; p++,q++)
|
||||
{
|
||||
if (p == key_end)
|
||||
{
|
||||
*q = 0;
|
||||
break;
|
||||
}
|
||||
*q = (*p == '-') ? '_' : *p;
|
||||
}
|
||||
const char *v = (const char *)bsearch(varname, removed_variables, sizeof(removed_variables) / sizeof(removed_variables[0]),
|
||||
sizeof(char *), cmp_strings);
|
||||
|
||||
if (v)
|
||||
{
|
||||
fprintf(stdout, "Removing variable '%s' from config file\n", varname);
|
||||
// delete variable
|
||||
*key_end = 0;
|
||||
WritePrivateProfileString(section_name, keyval, 0, myini_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -236,24 +236,37 @@ WHEELFOR SALESMAN 10030.00
|
|||
MARTIN ENGINEER 10000.00
|
||||
DROP TABLE t1, connect.emp;
|
||||
CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:PORT/connect' OPTION_LIST='User=root,Execsrc=1';
|
||||
SELECT * FROM t2 WHERE command='drop table tx1';
|
||||
command number message
|
||||
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1'
|
||||
Warnings:
|
||||
Warning 1105 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1'
|
||||
SELECT * FROM t2 WHERE command = 'create table tx1 (a int not null, b char(32), c double(8,2))';
|
||||
command number message
|
||||
create table tx1 (a int not null, b char(32), c double(8,2)) 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command in ('insert into tx1 values(1,''The number one'',456.12)',"insert into tx1(a,b) values(2,'The number two'),(3,'The number three')");
|
||||
command number message
|
||||
insert into tx1 values(1,'The number one',456.12) 1 Affected rows
|
||||
insert into tx1(a,b) values(2,'The number two'),(3,'The number three') 2 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command='update tx1 set c = 3.1416 where a = 2';
|
||||
command number message
|
||||
update tx1 set c = 3.1416 where a = 2 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command='select * from tx1';
|
||||
command number message
|
||||
select * from tx1 3 Result set column number
|
||||
Warnings:
|
||||
Warning 1105 Result set column number
|
||||
SELECT * FROM t2 WHERE command='delete from tx1 where a = 2';
|
||||
command number message
|
||||
delete from tx1 where a = 2 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM connect.tx1;
|
||||
a b c
|
||||
1 The number one 456.12
|
||||
|
|
|
@ -9,12 +9,18 @@ OPTION_LIST='Execsrc=1';
|
|||
SELECT * FROM t2 WHERE command='drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
||||
Warnings:
|
||||
Warning 1105 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
||||
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
|
||||
command number message
|
||||
create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2)) 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
||||
command number message
|
||||
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||
OPTION_LIST='Tabtype=TABLE,Maxres=10';
|
||||
|
@ -63,4 +69,6 @@ DROP SERVER 'postgresql';
|
|||
SELECT * FROM t2 WHERE command='drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -26,9 +26,7 @@ Created 6/2/1994 Heikki Tuuri
|
|||
*******************************************************/
|
||||
|
||||
#include "btr0btr.h"
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fsp0sysspace.h"
|
||||
#include "page0page.h"
|
||||
#include "page0zip.h"
|
||||
#include "gis0rtree.h"
|
||||
|
@ -43,7 +41,6 @@ Created 6/2/1994 Heikki Tuuri
|
|||
#include "trx0trx.h"
|
||||
#include "srv0mon.h"
|
||||
#include "gis0geo.h"
|
||||
#include "ut0new.h"
|
||||
#include "dict0boot.h"
|
||||
#include "row0sel.h" /* row_search_max_autoinc() */
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#include "btr0btr.h"
|
||||
#include "fil0fil.h"
|
||||
#include "fil0crypt.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "buf0buddy.h"
|
||||
#include "lock0lock.h"
|
||||
#include "sync0rw.h"
|
||||
|
@ -62,12 +61,10 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#include "dict0dict.h"
|
||||
#include "log0recv.h"
|
||||
#include "srv0mon.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
#include "page0zip.h"
|
||||
#include "sync0sync.h"
|
||||
#include "buf0dump.h"
|
||||
#include "ut0new.h"
|
||||
#include <new>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
@ -75,7 +72,6 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#include "fil0pagecompress.h"
|
||||
#include "fsp0pagecompress.h"
|
||||
#endif
|
||||
#include "ha_prototypes.h"
|
||||
#include "ut0byte.h"
|
||||
#include <new>
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ Doublwrite buffer module
|
|||
Created 2011/12/19
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
#include "buf0dblwr.h"
|
||||
#include "buf0buf.h"
|
||||
#include "buf0checksum.h"
|
||||
|
|
|
@ -25,9 +25,8 @@ The database buffer buf_pool flush algorithm
|
|||
Created 11/11/1995 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
#include "univ.i"
|
||||
#include <mysql/service_thd_wait.h>
|
||||
#include <my_dbug.h>
|
||||
#include <sql_class.h>
|
||||
|
||||
#include "buf0flu.h"
|
||||
|
@ -46,7 +45,6 @@ Created 11/11/1995 Heikki Tuuri
|
|||
#include "os0file.h"
|
||||
#include "trx0sys.h"
|
||||
#include "srv0mon.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "ut0stage.h"
|
||||
#include "fil0pagecompress.h"
|
||||
#ifdef UNIV_LINUX
|
||||
|
|
|
@ -44,7 +44,6 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#include "log0recv.h"
|
||||
#include "srv0srv.h"
|
||||
#include "srv0mon.h"
|
||||
#include "lock0lock.h"
|
||||
|
||||
/** The number of blocks from the LRU_old pointer onward, including
|
||||
the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
|
||||
|
|
|
@ -24,7 +24,7 @@ The database buffer read
|
|||
Created 11/5/1995 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
#include "univ.i"
|
||||
#include <mysql/service_thd_wait.h>
|
||||
|
||||
#include "buf0rea.h"
|
||||
|
|
|
@ -24,8 +24,6 @@ SQL data field and tuple
|
|||
Created 5/30/1994 Heikki Tuuri
|
||||
*************************************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "data0data.h"
|
||||
#include "rem0rec.h"
|
||||
#include "rem0cmp.h"
|
||||
|
|
|
@ -24,8 +24,6 @@ Data types
|
|||
Created 1/16/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "data0type.h"
|
||||
|
||||
/** The DB_TRX_ID,DB_ROLL_PTR values for "no history is available" */
|
||||
|
|
|
@ -24,8 +24,6 @@ Data dictionary creation and booting
|
|||
Created 4/18/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0boot.h"
|
||||
#include "dict0crea.h"
|
||||
#include "btr0btr.h"
|
||||
|
|
|
@ -24,8 +24,6 @@ Database object creation
|
|||
Created 1/8/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0crea.h"
|
||||
#include "btr0pcur.h"
|
||||
#include "btr0btr.h"
|
||||
|
@ -43,8 +41,6 @@ Created 1/8/1996 Heikki Tuuri
|
|||
#include "ut0vec.h"
|
||||
#include "dict0priv.h"
|
||||
#include "fts0priv.h"
|
||||
#include "fsp0space.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "srv0start.h"
|
||||
|
||||
/*****************************************************************//**
|
||||
|
|
|
@ -27,11 +27,8 @@ Created 25/08/2016 Jan Lindström
|
|||
#include "dict0stats.h"
|
||||
#include "dict0stats_bg.h"
|
||||
#include "dict0defrag_bg.h"
|
||||
#include "row0mysql.h"
|
||||
#include "btr0btr.h"
|
||||
#include "srv0start.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
static ib_mutex_t defrag_pool_mutex;
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ ib_warn_row_too_big(const dict_table_t* table);
|
|||
#include "dict0mem.h"
|
||||
#include "dict0priv.h"
|
||||
#include "dict0stats.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "fts0fts.h"
|
||||
#include "fts0types.h"
|
||||
#include "lock0lock.h"
|
||||
|
@ -81,7 +80,6 @@ ib_warn_row_too_big(const dict_table_t* table);
|
|||
#include "srv0start.h"
|
||||
#include "sync0sync.h"
|
||||
#include "trx0undo.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
|
|
@ -25,8 +25,6 @@ from dictionary tables
|
|||
Created 4/24/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0load.h"
|
||||
|
||||
#include "mysql_version.h"
|
||||
|
@ -39,7 +37,6 @@ Created 4/24/1996 Heikki Tuuri
|
|||
#include "dict0priv.h"
|
||||
#include "dict0stats.h"
|
||||
#include "fsp0file.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "fts0priv.h"
|
||||
#include "mach0data.h"
|
||||
#include "page0page.h"
|
||||
|
|
|
@ -25,7 +25,6 @@ Created Jan 06, 2010 Vasil Dimov
|
|||
*******************************************************/
|
||||
|
||||
#include "univ.i"
|
||||
|
||||
#include "ut0ut.h"
|
||||
#include "ut0rnd.h"
|
||||
#include "dyn0buf.h"
|
||||
|
@ -33,8 +32,6 @@ Created Jan 06, 2010 Vasil Dimov
|
|||
#include "trx0trx.h"
|
||||
#include "pars0pars.h"
|
||||
#include "dict0stats.h"
|
||||
#include "ha_prototypes.h"
|
||||
#include "ut0new.h"
|
||||
#include <mysql_com.h>
|
||||
#include "btr0btr.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ Created Apr 25, 2012 Vasil Dimov
|
|||
#include "dict0defrag_bg.h"
|
||||
#include "row0mysql.h"
|
||||
#include "srv0start.h"
|
||||
#include "ut0new.h"
|
||||
#include "fil0fil.h"
|
||||
#ifdef WITH_WSREP
|
||||
# include "mysql/service_wsrep.h"
|
||||
|
|
|
@ -39,7 +39,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
|
|||
#include "btr0scrub.h"
|
||||
#include "fsp0fsp.h"
|
||||
#include "fil0pagecompress.h"
|
||||
#include "ha_prototypes.h" // IB_LOG_
|
||||
#include <my_crypt.h>
|
||||
|
||||
/** Mutex for keys */
|
||||
|
|
|
@ -32,10 +32,7 @@ Created 10/25/1995 Heikki Tuuri
|
|||
#include "dict0boot.h"
|
||||
#include "dict0dict.h"
|
||||
#include "fsp0file.h"
|
||||
#include "fsp0file.h"
|
||||
#include "fsp0fsp.h"
|
||||
#include "fsp0space.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "hash0hash.h"
|
||||
#include "log0log.h"
|
||||
#include "log0recv.h"
|
||||
|
@ -47,7 +44,6 @@ Created 10/25/1995 Heikki Tuuri
|
|||
#include "row0mysql.h"
|
||||
#include "srv0start.h"
|
||||
#include "trx0purge.h"
|
||||
#include "ut0new.h"
|
||||
#include "buf0lru.h"
|
||||
#include "ibuf0ibuf.h"
|
||||
#include "os0event.h"
|
||||
|
|
|
@ -47,7 +47,6 @@ Updated 14/02/2015
|
|||
#include "page0zip.h"
|
||||
#include "trx0sys.h"
|
||||
#include "row0mysql.h"
|
||||
#include "ha_prototypes.h" // IB_LOG_
|
||||
#include "buf0lru.h"
|
||||
#include "ibuf0ibuf.h"
|
||||
#include "sync0sync.h"
|
||||
|
|
|
@ -24,16 +24,11 @@ Tablespace data file implementation
|
|||
Created 2013-7-26 by Kevin Lewis
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fil0fil.h"
|
||||
#include "fsp0types.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "os0file.h"
|
||||
#include "page0page.h"
|
||||
#include "srv0start.h"
|
||||
#include "ut0new.h"
|
||||
#include "fil0crypt.h"
|
||||
|
||||
/** Initialize the name, size and order of this datafile
|
||||
@param[in] name tablespace name, will be copied
|
||||
|
|
|
@ -24,8 +24,6 @@ File space management
|
|||
Created 11/29/1995 Heikki Tuuri
|
||||
***********************************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fsp0fsp.h"
|
||||
#include "buf0buf.h"
|
||||
#include "fil0fil.h"
|
||||
|
@ -41,7 +39,6 @@ Created 11/29/1995 Heikki Tuuri
|
|||
#include "btr0sea.h"
|
||||
#include "dict0boot.h"
|
||||
#include "log0log.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "dict0mem.h"
|
||||
#include "fsp0types.h"
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ Shared tablespace implementation.
|
|||
Created 2012-11-16 by Sunny Bains as srv/srv0space.cc
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fsp0space.h"
|
||||
#include "fsp0sysspace.h"
|
||||
#include "fsp0fsp.h"
|
||||
#include "os0file.h"
|
||||
|
|
|
@ -24,8 +24,6 @@ Created 2012-11-16 by Sunny Bains as srv/srv0space.cc
|
|||
Refactored 2013-7-26 by Kevin Lewis
|
||||
*******************************************************/
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fsp0sysspace.h"
|
||||
#include "srv0start.h"
|
||||
#include "trx0sys.h"
|
||||
|
@ -33,7 +31,6 @@ Refactored 2013-7-26 by Kevin Lewis
|
|||
#include "mem0mem.h"
|
||||
#include "os0file.h"
|
||||
#include "row0mysql.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
/** The server header file is included to access opt_initialize global variable.
|
||||
If server passes the option for create/open DB to SE, we should remove such
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue