Merge mariadb-10.5.5

This commit is contained in:
Marko Mäkelä 2020-08-10 21:11:54 +03:00
commit 17be2b47ba
218 changed files with 4496 additions and 1619 deletions

View File

@ -2,6 +2,11 @@
# Wrapper for CPackRPM.cmake
#
IF(NOT DEFINED RPM_RECOMMENDS)
EXECUTE_PROCESS(COMMAND rpm --recommends ERROR_QUIET RESULT_VARIABLE RPM_RECOMMENDS)
MESSAGE("CPackRPM:Debug: Testing rpm --recommends: ${RPM_RECOMMENDS}")
ENDIF()
#
# Support for per-component LICENSE and VENDOR
#
@ -47,6 +52,20 @@ if (acc)
file(WRITE ${${base_var}} "${acc}")
endif()
#
# Support for the Recommends: tag.
# We don't use Suggests: so here he hijack Suggests: variable
# to implement Recommends:
#
IF (CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS)
IF (RPM_RECOMMENDS EQUAL 0) # exit code 0 means ok
SET(TMP_RPM_SUGGESTS "Recommends: ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
ELSE() # rpm is too old to recommend
SET(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES
"${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES} ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
ENDIF()
ENDIF()
# load the original CPackRPM.cmake
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)

View File

@ -30,7 +30,6 @@ SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "")
SET(HAVE_BFILL CACHE INTERNAL "")
SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")
SET(HAVE_BSS_START CACHE INTERNAL "")
SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "")
SET(HAVE_COMPRESS CACHE INTERNAL "")
SET(HAVE_CRYPT CACHE INTERNAL "")

View File

@ -242,7 +242,6 @@
/* Symbols we may use */
#cmakedefine HAVE_SYS_ERRLIST 1
/* used by stacktrace functions */
#cmakedefine HAVE_BSS_START 1
#cmakedefine HAVE_BACKTRACE 1
#cmakedefine HAVE_BACKTRACE_SYMBOLS 1
#cmakedefine HAVE_BACKTRACE_SYMBOLS_FD 1

View File

@ -795,14 +795,6 @@ CHECK_CXX_SOURCE_COMPILES("
HAVE_ABI_CXA_DEMANGLE)
ENDIF()
CHECK_C_SOURCE_COMPILES("
int main(int argc, char **argv)
{
extern char *__bss_start;
return __bss_start ? 1 : 0;
}"
HAVE_BSS_START)
CHECK_C_SOURCE_COMPILES("
int main()
{

161
debian/control vendored
View File

@ -31,6 +31,7 @@ Build-Depends: bison,
libnuma-dev [!armhf],
libpam0g-dev,
libpcre2-dev,
libreadline-gplv2-dev [i386 amd64],
libsnappy-dev,
libssl-dev | libssl1.0-dev,
libsystemd-dev [linux-any],
@ -276,36 +277,22 @@ Conflicts: mariadb-client-10.0,
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
mysql-client-5.5 (<< ${source:Version}),
mysql-client-5.5,
mysql-client-core-5.1,
mysql-client-core-5.5,
mysql-client-core-5.6,
mysql-client-core-5.7,
mysql-client-core-8.0,
virtual-mysql-client-core
Replaces: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
mariadb-client-5.5,
Replaces: mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
mariadb-client-core-5.5,
mariadb-client-core-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
mariadb-client-core-5.5,
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
mysql-client-5.5,
mysql-client-core-5.1,
mysql-client-core-5.5,
mysql-client-core-5.6,
@ -349,50 +336,28 @@ Conflicts: mariadb-client (<< ${source:Version}),
mysql-client-5.7,
mysql-client-8.0,
mysql-client-core-5.0,
mysql-client-core-5.1 (<< ${source:Version}),
mysql-client-core-5.5 (<< ${source:Version}),
mysql-client-core-5.6 (<< ${source:Version}),
mysql-client-core-5.7 (<< ${source:Version}),
mysql-client-core-8.0 (<< ${source:Version}),
mysql-client-core-5.1,
mysql-client-core-5.5,
mysql-client-core-5.6,
mysql-client-core-5.7,
mysql-client-core-8.0,
mytop,
virtual-mysql-client
Breaks: mariadb-client-core-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5 (<< ${source:Version})
Replaces: mariadb-client (<< ${source:Version}),
Replaces: mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
mariadb-client-5.5,
mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
mariadb-client-5.5,
mariadb-client-core-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5 (<< ${source:Version}),
mariadb-server-10.5 (<< ${source:Version}),
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
mysql-client-5.5,
mysql-client-5.6,
mysql-client-5.7,
mysql-client-8.0,
mysql-client-core-5.0,
mysql-client-core-5.1 (<< ${source:Version}),
mysql-client-core-5.5 (<< ${source:Version}),
mysql-client-core-5.6 (<< ${source:Version}),
mysql-client-core-5.7 (<< ${source:Version}),
mysql-client-core-8.0 (<< ${source:Version}),
mytop,
virtual-mysql-client
Provides: default-mysql-client,
@ -431,40 +396,15 @@ Conflicts: mariadb-server-core-10.0,
mysql-server-core-5.7,
mysql-server-core-8.0,
virtual-mysql-server-core
Breaks: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5 (<< ${source:Version}),
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5 (<< ${source:Version}),
mysql-server-5.6,
mysql-server-5.7,
mysql-server-8.0
Replaces: mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5 (<< ${source:Version}),
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5 (<< ${source:Version}),
Replaces: mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
mariadb-server-core-5.5,
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
mariadb-server-core-10.3,
mariadb-server-core-10.4,
mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
mariadb-server-core-5.5,
mysql-server-5.0,
mysql-server-5.6,
mysql-server-5.7,
mysql-server-8.0,
mysql-server-core-5.0,
mysql-server-core-5.1,
mysql-server-core-5.5,
@ -518,11 +458,11 @@ Conflicts: mariadb-server (<< ${source:Version}),
mariadb-server-5.2,
mariadb-server-5.3,
mariadb-server-5.5,
mysql-client-5.5 (<< ${source:Version}),
mysql-client-5.6 (<< ${source:Version}),
mysql-client-5.7 (<< ${source:Version}),
mysql-client-8.0 (<< ${source:Version}),
mysql-server (<< ${source:Version}),
mysql-client-5.5,
mysql-client-5.6,
mysql-client-5.7,
mysql-client-8.0,
mysql-server,
mysql-server-4.1,
mysql-server-5.0,
mysql-server-5.1,
@ -531,24 +471,15 @@ Conflicts: mariadb-server (<< ${source:Version}),
mysql-server-5.7,
mysql-server-8.0,
virtual-mysql-server
Replaces: libmariadbclient-dev (<< 5.5.0),
libmariadbclient16,
mariadb-client-10.5 (<< ${source:Version}),
mariadb-server (<< ${source:Version}),
Replaces: mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
mariadb-server-5.5,
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
mariadb-server-5.5,
mysql-client-5.5 (<< ${source:Version}),
mysql-client-5.6 (<< ${source:Version}),
mysql-client-5.7 (<< ${source:Version}),
mysql-client-8.0 (<< ${source:Version}),
mysql-server (<< ${source:Version}),
mysql-server-4.1,
mysql-server-5.0,
mysql-server-5.1,
@ -800,32 +731,18 @@ Depends: mariadb-client-10.5 (= ${binary:Version}),
${misc:Depends},
${perl:Depends},
${shlibs:Depends}
Breaks: mariadb-server-5.5,
Breaks: mariadb-test-5.5,
mariadb-test-10.0,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-10.3,
mariadb-test-10.4,
mariadb-test-5.5,
mysql-server-5.7,
mysql-testsuite,
mysql-testsuite-5.5,
mysql-testsuite-5.6,
mysql-testsuite-5.7,
mysql-testsuite-8.0
Replaces: mariadb-server-5.5,
Replaces: mariadb-test-5.5,
mariadb-test-10.0,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-10.3,
mariadb-test-10.4,
mariadb-test-5.5,
mysql-server-5.7,
mysql-testsuite,
mysql-testsuite-5.5,
mysql-testsuite-5.6,
mysql-testsuite-5.7,
mysql-testsuite-8.0,
virtual-mysql-testsuite
Provides: virtual-mysql-testsuite
Suggests: patch
@ -843,21 +760,23 @@ Multi-Arch: foreign
Depends: ${misc:Depends},
${perl:Depends},
${shlibs:Depends}
Breaks: mariadb-test-10.0,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-5.5,
Breaks: mariadb-test-data-5.5,
mariadb-test-data-10.0,
mariadb-test-data-10.1,
mariadb-test-data-10.2,
mariadb-test-data-10.3,
mariadb-test-data-10.4,
mysql-testsuite,
mysql-testsuite-5.5,
mysql-testsuite-5.6,
mysql-testsuite-5.7,
mysql-testsuite-8.0
Replaces: mariadb-test-10.0,
mariadb-test-10.1,
mariadb-test-10.2,
mariadb-test-5.5,
Replaces: mariadb-test-data-5.5,
mariadb-test-data-10.0,
mariadb-test-data-10.1,
mariadb-test-data-10.2,
mariadb-test-data-10.3,
mariadb-test-data-10.4,
mysql-testsuite,
mysql-testsuite-5.5,
mysql-testsuite-5.6,

View File

@ -114,6 +114,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_explain.cc ../sql/sql_explain.h
../sql/sql_analyze_stmt.cc ../sql/sql_analyze_stmt.h
../sql/compat56.cc
../sql/sql_schema.cc
../sql/sql_type.cc ../sql/sql_type.h
../sql/sql_mode.cc
../sql/sql_type_string.cc

View File

@ -1,6 +1,6 @@
'\" t
.\"
.TH "\FBMYSQL_UPGRADE\FR" "1" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System"
.TH "\FBMYSQL_UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.5" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@ -165,6 +165,8 @@ in the data directory\&. This is used to quickly check whether all tables have b
\fB\-\-force\fR
option\&.
.PP
For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&.
.PP
If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&.
\fBmysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes

View File

@ -2011,5 +2011,21 @@ CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAI
Warnings:
Warning 1280 Name 'foo' ignored for PRIMARY key.
DROP TABLE t1;
#
# 10.4 Test
#
# MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK &&
# is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES
# upon attempt to create existing table
#
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED,
e DATE, PERIOD FOR app(s,e));
ERROR HY000: Period field `s` cannot be GENERATED ALWAYS AS
UNLOCK TABLES;
DROP TABLE t1;
# End of 10.4 Test
CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible);
drop table t1;
# End of 10.5 Test

View File

@ -1873,9 +1873,30 @@ drop table t1;
CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2));
DROP TABLE t1;
--echo #
--echo # 10.4 Test
--echo #
--echo # MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK &&
--echo # is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES
--echo # upon attempt to create existing table
--echo #
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
--error ER_PERIOD_FIELD_WRONG_ATTRIBUTES
CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED,
e DATE, PERIOD FOR app(s,e));
UNLOCK TABLES;
DROP TABLE t1;
--echo # End of 10.4 Test
#
# MDEV-22199 Add VISIBLE option for indexes in create table
#
CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible);
drop table t1;
--echo # End of 10.5 Test

View File

@ -214,3 +214,4 @@ SELECT * FROM t1;
a b
hello 12NKz5XM5JeKI
DROP TABLE t1;
# End of 10.2 tests

View File

@ -120,3 +120,5 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 (a) VALUES ('hello');
SELECT * FROM t1;
DROP TABLE t1;
--echo # End of 10.2 tests

View File

@ -35,3 +35,41 @@ DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(D
1234 12345 123456 1234567
DROP TABLE t1;
End of 5.0 tests
#
# MDEV-23330 Server crash or ASAN negative-size-param in
# my_strnncollsp_binary / SORT_FIELD_ATTR::compare_packed_varstrings
#
CREATE TABLE t1 (a CHAR(240), b BIT(48));
INSERT INTO t1 VALUES ('a',b'0001'),('b',b'0010'),('c',b'0011'),('d',b'0100'),('e',b'0001'),('f',b'0101'),('g',b'0110'),('h',b'0111'),('i',b'1000'),('j',b'1001');
SELECT DES_DECRYPT(a, 'x'), HEX(BINARY b) FROM t1 GROUP BY 1, 2 WITH ROLLUP;
DES_DECRYPT(a, 'x') HEX(BINARY b)
a 000000000001
a NULL
b 000000000002
b NULL
c 000000000003
c NULL
d 000000000004
d NULL
e 000000000001
e NULL
f 000000000005
f NULL
g 000000000006
g NULL
h 000000000007
h NULL
i 000000000008
i NULL
j 000000000009
j NULL
NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT t1 VALUES (1),(2);
SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2;
CHAR_LENGTH(a) DES_DECRYPT(a)
1 ¢
1 ¢
DROP TABLE t1;
End of 10.5 tests

View File

@ -37,3 +37,24 @@ SELECT
DROP TABLE t1;
--Echo End of 5.0 tests
--echo #
--echo # MDEV-23330 Server crash or ASAN negative-size-param in
--echo # my_strnncollsp_binary / SORT_FIELD_ATTR::compare_packed_varstrings
--echo #
CREATE TABLE t1 (a CHAR(240), b BIT(48));
INSERT INTO t1 VALUES ('a',b'0001'),('b',b'0010'),('c',b'0011'),('d',b'0100'),('e',b'0001'),('f',b'0101'),('g',b'0110'),('h',b'0111'),('i',b'1000'),('j',b'1001');
SELECT DES_DECRYPT(a, 'x'), HEX(BINARY b) FROM t1 GROUP BY 1, 2 WITH ROLLUP;
DROP TABLE t1;
#
# don't change the charset of a literal Item_string
#
CREATE TABLE t1 (a INT);
INSERT t1 VALUES (1),(2);
SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2;
DROP TABLE t1;
--Echo End of 10.5 tests

View File

@ -1186,13 +1186,13 @@ i count(*) std(e1/e2)
3 4 0.00000000
select std(s1/s2) from bug22555;
std(s1/s2)
0.21325764
0.21328517
select std(o1/o2) from bug22555;
std(o1/o2)
0.2132576358664934
select std(e1/e2) from bug22555;
std(e1/e2)
0.21325764
0.21328517
set @saved_div_precision_increment=@@div_precision_increment;
set div_precision_increment=19;
select i, count(*), std(s1/s2) from bug22555 group by i order by i;

View File

@ -348,7 +348,6 @@ truncate(4, cast(-2 as unsigned)) truncate(4, 18446744073709551614) truncate(4,
4 4 0
Warnings:
Note 1105 Cast to unsigned converted negative integer to it's positive complement
Note 1105 Cast to unsigned converted negative integer to it's positive complement
select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
round(10000000000000000000, -19) truncate(10000000000000000000, -19)
10000000000000000000 10000000000000000000
@ -1784,7 +1783,7 @@ ROUND(10e0,NULL) AS c3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double DEFAULT NULL,
`c1` int(2) DEFAULT NULL,
`c2` double DEFAULT NULL,
`c3` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

View File

@ -25,6 +25,19 @@ ERROR HY000: Table 'procs_priv' was not locked with LOCK TABLES
REVOKE PROCESS ON *.* FROM u;
ERROR HY000: Table 'db' was not locked with LOCK TABLES
DROP TABLE t1;
create database mysqltest1;
use mysqltest1;
create table t1(id int);
insert t1 values(2);
create user u1@localhost;
grant select on mysqltest1.t1 to u1@localhost;
grant update on mysqltest1.* to u1@localhost;
connect u1, localhost, u1;
update mysqltest1.t1 set id=1 where id=2;
connection default;
disconnect u1;
drop user u1@localhost;
drop database mysqltest1;
#
# MDEV-20076: SHOW GRANTS does not quote role names properly
#

View File

@ -34,6 +34,27 @@ REVOKE EXECUTE ON PROCEDURE sp FROM u;
REVOKE PROCESS ON *.* FROM u;
DROP TABLE t1;
#
# MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user
#
create database mysqltest1;
use mysqltest1;
create table t1(id int);
insert t1 values(2);
create user u1@localhost;
grant select on mysqltest1.t1 to u1@localhost;
grant update on mysqltest1.* to u1@localhost;
connect u1, localhost, u1;
update mysqltest1.t1 set id=1 where id=2;
connection default;
disconnect u1;
drop user u1@localhost;
drop database mysqltest1;
#
# End of 10.1 tests
#
--echo #
--echo # MDEV-20076: SHOW GRANTS does not quote role names properly
--echo #

View File

@ -158,3 +158,13 @@ show triggers like '%T1%';
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
drop table t1;
set GLOBAL sql_mode=default;
#
# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
#
# Compatibility schema names respect the filesystem case sensitivity
CREATE TABLE t1 (a MARIADB_SCHEMA.date);
ERROR HY000: Unknown data type: 'MARIADB_SCHEMA.date'
CREATE TABLE t1 (a Mariadb_schema.date);
ERROR HY000: Unknown data type: 'Mariadb_schema.date'
CREATE TABLE t1 (a mariadb_schema.date);
DROP TABLE t1;

View File

@ -130,3 +130,18 @@ let $datadir= `select @@datadir`;
remove_file $datadir/mysql_upgrade_info;
set GLOBAL sql_mode=default;
--echo #
--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
--echo #
--echo # Compatibility schema names respect the filesystem case sensitivity
--error ER_UNKNOWN_DATA_TYPE
CREATE TABLE t1 (a MARIADB_SCHEMA.date);
--error ER_UNKNOWN_DATA_TYPE
CREATE TABLE t1 (a Mariadb_schema.date);
CREATE TABLE t1 (a mariadb_schema.date);
DROP TABLE t1;

View File

@ -4097,4 +4097,14 @@ Y
B
A
DROP TABLE t1;
#
# MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part
#
CREATE TABLE t1 (a CHAR(3), b BINARY(255));
INSERT t1 VALUES ('foo','bar'),('baz','qux');
SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f;
f
baz
foo
DROP TABLE t1;
# End of 10.5 tests

View File

@ -2533,4 +2533,12 @@ SELECT * FROM t1 ORDER BY a DESC;
DROP TABLE t1;
--echo #
--echo # MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part
--echo #
CREATE TABLE t1 (a CHAR(3), b BINARY(255));
INSERT t1 VALUES ('foo','bar'),('baz','qux');
SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f;
DROP TABLE t1;
--echo # End of 10.5 tests

View File

@ -619,7 +619,7 @@ select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
Testing that / is left associative
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
1.00000000 1.00000000 9.0000
1.00000000 1.00000000 8.9998
Testing that / has precedence over |
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)

View File

@ -2767,5 +2767,45 @@ SELECT 1 FROM t1 WHERE a XOR 'a';
1
DROP TABLE t1;
#
# Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE
# WITH A COMPOSITE PREFIX INDEX
#
create table t1(id int unsigned not null,
data varchar(2) default null,
key data_idx (data(1),id)
) default charset=utf8
partition by range (id) (
partition p10 values less than (10),
partition p20 values less than (20)
);
insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
select id from t1 where data = 'ab' order by id;
id
4
5
6
14
15
16
drop table t1;
create table t1(id int unsigned not null,
data text default null,
key data_idx (data(1),id)
) default charset=utf8
partition by range (id) (
partition p10 values less than (10),
partition p20 values less than (20)
);
insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
select id from t1 where data = 'ab' order by id;
id
4
5
6
14
15
16
drop table t1;
#
# End of 10.1 tests
#

View File

@ -2976,6 +2976,34 @@ CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
SELECT 1 FROM t1 WHERE a XOR 'a';
DROP TABLE t1;
--echo #
--echo # Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE
--echo # WITH A COMPOSITE PREFIX INDEX
--echo #
create table t1(id int unsigned not null,
data varchar(2) default null,
key data_idx (data(1),id)
) default charset=utf8
partition by range (id) (
partition p10 values less than (10),
partition p20 values less than (20)
);
insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
select id from t1 where data = 'ab' order by id;
drop table t1;
create table t1(id int unsigned not null,
data text default null,
key data_idx (data(1),id)
) default charset=utf8
partition by range (id) (
partition p10 values less than (10),
partition p20 values less than (20)
);
insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
select id from t1 where data = 'ab' order by id;
drop table t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -9,5 +9,38 @@ ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
#
# MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows
#
CREATE TABLE t1 (
id int(11) auto_increment primary key,
c1 int(11) DEFAULT NULL
) PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (4),
PARTITION p1 VALUES LESS THAN MAXVALUE
);
insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1);
insert into t1(c1) select c1 from t1;
insert into t1(c1) select c1 from t1;
select count(*) from t1;
count(*)
32
select count(*) from t1 where id <4;
count(*)
3
flush status;
set session use_stat_tables='preferably';
# Must NOT show "Engine-independent statistics collected":
alter table t1 analyze partition p0;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Should not have Handler_read_rnd_next=34
show session status like 'Handler_read_rnd%';
Variable_name Value
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 34
drop table t1;
SET use_stat_tables = DEFAULT;

View File

@ -11,7 +11,33 @@ CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
ANALYZE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows
--echo #
CREATE TABLE t1 (
id int(11) auto_increment primary key,
c1 int(11) DEFAULT NULL
) PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (4),
PARTITION p1 VALUES LESS THAN MAXVALUE
);
insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1);
insert into t1(c1) select c1 from t1;
insert into t1(c1) select c1 from t1;
select count(*) from t1;
select count(*) from t1 where id <4;
flush status;
set session use_stat_tables='preferably';
--echo # Must NOT show "Engine-independent statistics collected":
alter table t1 analyze partition p0;
--echo # Should not have Handler_read_rnd_next=34
show session status like 'Handler_read_rnd%';
drop table t1;
SET use_stat_tables = DEFAULT;
DROP TABLE t1;

View File

@ -2585,6 +2585,30 @@ e 2
o 6
DROP TABLE t1, t2;
#
# MDEV-19232: Floating point precision / value comparison problem
#
CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0));
INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797);
INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422);
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='subquery_cache=on';
SELECT
population, area, population/area,
cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1;
population area population/area cast(population/area as DECIMAL(20,9))
11797 91 129.6374 129.637400000
SELECT * FROM t1 A
WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
region area population
Central America and the Caribbean 442 66422
SET optimizer_switch='subquery_cache=off';
SELECT * FROM t1 A
WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
region area population
Central America and the Caribbean 442 66422
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
#
# MDEV-22852: SIGSEGV in sortlength (optimized builds)
#
SET @save_optimizer_switch=@@optimizer_switch;

View File

@ -2115,6 +2115,32 @@ EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t
SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
DROP TABLE t1, t2;
--echo #
--echo # MDEV-19232: Floating point precision / value comparison problem
--echo #
CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0));
INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797);
INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422);
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='subquery_cache=on';
SELECT
population, area, population/area,
cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1;
SELECT * FROM t1 A
WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
SET optimizer_switch='subquery_cache=off';
SELECT * FROM t1 A
WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
--echo #
--echo # MDEV-22852: SIGSEGV in sortlength (optimized builds)
--echo #

View File

@ -975,4 +975,131 @@ id
DROP PROCEDURE p1;
DROP TABLE t1;
# End of 10.0 tests
#
# MDEV-23221: A subquery causes crash
#
create table t1 (
location_code varchar(10),
country_id varchar(10)
);
insert into t1 values ('HKG', 'HK');
insert into t1 values ('NYC', 'US');
insert into t1 values ('LAX', 'US');
create table t2 (
container_id varchar(10),
cntr_activity_type varchar(10),
cntr_dest varchar(10)
);
insert into t2 values ('AAAA1111', 'VSL', 'NYC');
insert into t2 values ('AAAA1111', 'CUV', 'NYC');
insert into t2 values ('BBBB2222', 'VSL', 'LAX');
insert into t2 values ('BBBB2222', 'XYZ', 'LAX');
# Must not crash or return an error:
select
(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
(select
max(container_id)
from t2 as cl2
where
cl2.container_id = cl1.container_id and
cl2.cntr_activity_type = 'CUV' and
exists (select location_code
from t1
where
location_code = cl2.cntr_dest and
country_id = dest_cntry)
) as CUV
from
t2 cl1;
dest_cntry CUV
US AAAA1111
US AAAA1111
US NULL
US NULL
prepare s from "select
(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
(select
max(container_id)
from t2 as cl2
where
cl2.container_id = cl1.container_id and
cl2.cntr_activity_type = 'CUV' and
exists (select location_code
from t1
where
location_code = cl2.cntr_dest and
country_id = dest_cntry)
) as CUV
from
t2 cl1";
execute s;
dest_cntry CUV
US AAAA1111
US AAAA1111
US NULL
US NULL
execute s;
dest_cntry CUV
US AAAA1111
US AAAA1111
US NULL
US NULL
drop table t1,t2;
#
# MDEV-20557: SQL query with duplicate table aliases consistently crashes server
# (Just a testcase)
#
create table t1 (id int, id2 int);
create table t2 (id int, id2 int, a int);
create table t3 (id int);
create table t4 (id int);
select (select 1 from t1 where (exists
(select 1 from t2
where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt
from t3;
ERROR 42000: This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left expression of IN/ALL/ANY'
drop table t1,t2,t3,t4;
#
# MDEV-21649: Crash when using nested EXISTS
# (Just a testcase)
#
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id));
CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id));
SELECT
W0.`id`
FROM
`t1` W0
WHERE (
EXISTS(
SELECT
V0.`id`
FROM
`t2` V0
WHERE (
EXISTS(
SELECT
U0.`id`
FROM
`t2` U0
INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`)
WHERE (
U0.`ip_id` = V0.`ip_id`
AND U4.`storage_method_id` = (
SELECT
U5.`storage_method_id`
FROM
`t3` U5
WHERE
U5.`storage_target_id` = V0.`id`
LIMIT
1
)
)
)
)
)
);
id
drop table t1,t2,t3;
set optimizer_switch=default;

View File

@ -829,5 +829,117 @@ DROP TABLE t1;
--echo # End of 10.0 tests
--echo #
--echo # MDEV-23221: A subquery causes crash
--echo #
create table t1 (
location_code varchar(10),
country_id varchar(10)
);
insert into t1 values ('HKG', 'HK');
insert into t1 values ('NYC', 'US');
insert into t1 values ('LAX', 'US');
create table t2 (
container_id varchar(10),
cntr_activity_type varchar(10),
cntr_dest varchar(10)
);
insert into t2 values ('AAAA1111', 'VSL', 'NYC');
insert into t2 values ('AAAA1111', 'CUV', 'NYC');
insert into t2 values ('BBBB2222', 'VSL', 'LAX');
insert into t2 values ('BBBB2222', 'XYZ', 'LAX');
let $query=
select
(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
(select
max(container_id)
from t2 as cl2
where
cl2.container_id = cl1.container_id and
cl2.cntr_activity_type = 'CUV' and
exists (select location_code
from t1
where
location_code = cl2.cntr_dest and
country_id = dest_cntry)
) as CUV
from
t2 cl1;
--echo # Must not crash or return an error:
eval $query;
eval prepare s from "$query";
execute s;
execute s;
drop table t1,t2;
--echo #
--echo # MDEV-20557: SQL query with duplicate table aliases consistently crashes server
--echo # (Just a testcase)
--echo #
create table t1 (id int, id2 int);
create table t2 (id int, id2 int, a int);
create table t3 (id int);
create table t4 (id int);
--error ER_NOT_SUPPORTED_YET
select (select 1 from t1 where (exists
(select 1 from t2
where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt
from t3;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-21649: Crash when using nested EXISTS
--echo # (Just a testcase)
--echo #
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id));
CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id));
SELECT
W0.`id`
FROM
`t1` W0
WHERE (
EXISTS(
SELECT
V0.`id`
FROM
`t2` V0
WHERE (
EXISTS(
SELECT
U0.`id`
FROM
`t2` U0
INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`)
WHERE (
U0.`ip_id` = V0.`ip_id`
AND U4.`storage_method_id` = (
SELECT
U5.`storage_method_id`
FROM
`t3` U5
WHERE
U5.`storage_target_id` = V0.`id`
LIMIT
1
)
)
)
)
)
);
drop table t1,t2,t3;
#restore defaults
set optimizer_switch=default;

View File

@ -676,6 +676,27 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0
DROP TABLE t1;
#
# MDEV-23282 FLOAT(53,0) badly handles out-of-range values
#
CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
SELECT c1, c2 FROM t1;
c1 c2
3.40282e38 -3.40282e38
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
SELECT c1, c2 FROM t1;
c1 c2
340282346638528860000000000000000000000 -340282346638528860000000000000000000000
DROP TABLE t1;
#
# End of 10.1 tests
#
#

View File

@ -485,6 +485,20 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0;
DROP TABLE t1;
--echo #
--echo # MDEV-23282 FLOAT(53,0) badly handles out-of-range values
--echo #
CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
SELECT c1, c2 FROM t1;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
SELECT c1, c2 FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -178,5 +178,59 @@ c3 18446744073709551615
c4 18446744073709551615
c5 18446744073709551615
#
# MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result
#
SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11);
ROUND(0xFFFFFFFFFFFFFFFF,-10) ROUND(0xFFFFFFFFFFFFFFFF,-11)
18446744070000000000 18446744100000000000
CREATE TABLE t1 AS SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ROUND(0xFFFFFFFFFFFFFFFF,-10)` decimal(21,0) unsigned NOT NULL,
`ROUND(0xFFFFFFFFFFFFFFFF,-11)` decimal(21,0) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
ROUND(0xFFFFFFFFFFFFFFFF,-10) ROUND(0xFFFFFFFFFFFFFFFF,-11)
18446744070000000000 18446744100000000000
DROP TABLE t1;
#
# MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result
#
SELECT
ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2,
ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3,
ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5;
c1 NULL
c2 18446744073709551615
c3 18446744073709551620
c4 20000000000000000000
c5 20000000000000000000
CREATE OR REPLACE TABLE t1 AS
SELECT
ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2,
ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3,
ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5;
SELECT * FROM t1;
c1 NULL
c2 18446744073709551615
c3 18446744073709551620
c4 20000000000000000000
c5 20000000000000000000
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`c1` bigint(20) unsigned DEFAULT NULL,
`c2` decimal(21,0) unsigned NOT NULL,
`c3` decimal(21,0) unsigned NOT NULL,
`c4` decimal(21,0) unsigned NOT NULL,
`c5` decimal(21,0) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 10.4 tests
#

View File

@ -46,6 +46,42 @@ DELIMITER ;$$
--horizontal_results
--echo #
--echo # MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result
--echo #
SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11);
CREATE TABLE t1 AS SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result
--echo #
--vertical_results
SELECT
ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2,
ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3,
ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5;
CREATE OR REPLACE TABLE t1 AS
SELECT
ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2,
ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3,
ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4,
ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--horizontal_results
--echo #
--echo # End of 10.4 tests
--echo #

File diff suppressed because it is too large Load Diff

View File

@ -295,6 +295,7 @@ DROP TABLE t1;
--echo #
--echo # MDEV-23337 Rounding functions create a wrong data type for numeric input
--echo # MDEV-23350 ROUND(bigint_22_or_longer) returns a wrong data type
--echo #
DELIMITER $$;
@ -304,7 +305,7 @@ BEGIN
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t);
INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000);
INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000);
CREATE TABLE t2 AS SELECT a, ROUND(a), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1;
CREATE TABLE t2 AS SELECT a, ROUND(a), ROUND(a,1), ROUND(a,10), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t1, t2;
@ -318,16 +319,122 @@ CALL p1('smallint');
CALL p1('mediumint');
CALL p1('int');
CALL p1('bigint');
CALL p1('bigint(20)');
CALL p1('bigint(21)');
CALL p1('bigint(22)');
CALL p1('bigint(23)');
CALL p1('bigint(30)');
CALL p1('tinyint unsigned');
CALL p1('smallint unsigned');
CALL p1('mediumint unsigned');
CALL p1('int unsigned');
CALL p1('bigint unsigned');
CALL p1('bigint(20) unsigned');
CALL p1('bigint(21) unsigned');
CALL p1('bigint(22) unsigned');
CALL p1('bigint(23) unsigned');
CALL p1('bigint(30) unsigned');
--horizontal_results
DROP PROCEDURE p1;
--echo #
--echo # MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result
--echo #
SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11);
CREATE TABLE t1 AS SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-23367 ROUND(18446744073709551615,-1) returns a wrong result
--echo #
--vertical_results
SELECT
ROUND(18446744073709551615,-1) AS c01,
ROUND(18446744073709551615,-19) AS c19;
CREATE OR REPLACE TABLE t1 AS
SELECT
ROUND(18446744073709551615,-1) AS c01,
ROUND(18446744073709551615,-19) AS c19;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--horizontal_results
DELIMITER $$;
CREATE PROCEDURE p1(t VARCHAR(64))
BEGIN
SELECT t AS ``;
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t);
INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000);
INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000);
CREATE TABLE t2 AS SELECT
a, ROUND(a,-1), ROUND(a,-2), ROUND(a,-19), ROUND(a,-20), ROUND(a,-30)
FROM t1
ORDER BY a;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t1, t2;
END;
$$
DELIMITER ;$$
--vertical_results
CALL p1('tinyint');
CALL p1('smallint');
CALL p1('mediumint');
CALL p1('int');
CALL p1('bigint');
CALL p1('bigint(20)');
CALL p1('bigint(21)');
CALL p1('bigint(22)');
CALL p1('bigint(23)');
CALL p1('bigint(30)');
CALL p1('tinyint unsigned');
CALL p1('smallint unsigned');
CALL p1('mediumint unsigned');
CALL p1('int unsigned');
CALL p1('bigint unsigned');
CALL p1('bigint(20) unsigned');
CALL p1('bigint(21) unsigned');
CALL p1('bigint(22) unsigned');
CALL p1('bigint(23) unsigned');
CALL p1('bigint(30) unsigned');
--horizontal_results
DROP PROCEDURE p1;
--echo #
--echo # MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result
--echo #
--vertical_results
SELECT
ROUND(18446744073709551615,NULL) AS c1,
ROUND(18446744073709551615,rand()*0) AS c2,
ROUND(18446744073709551615,rand()*0-19) AS c3;
CREATE OR REPLACE TABLE t1 AS
SELECT
ROUND(18446744073709551615,NULL) AS c1,
ROUND(18446744073709551615,rand()*0) AS c2,
ROUND(18446744073709551615,rand()*0-19) AS c3;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--horizontal_results
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -1532,11 +1532,8 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000)
0.81298807395367312459230693948000000000
create table t1 as select 5.05 / 0.014;
Warnings:
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
show warnings;
Level Code Message
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -1651,8 +1648,6 @@ my_col
0.12345678912345678912345678912345678912
DROP TABLE t1;
CREATE TABLE t1 SELECT 1 / .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
my_col decimal(65,4) YES NULL

View File

@ -91,8 +91,6 @@ DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
insert ignore into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
insert ignore into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
Warning 1264 Out of range value for column 'utiny' at row 1
@ -130,7 +128,7 @@ select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,ut
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
12 0.33333333 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
12 0.3333 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 0 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1
14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 0 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295
15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295
@ -182,7 +180,7 @@ Warning 1265 Data truncated for column 'new_field' at row 7
select * from t2;
auto string mediumblob_col new_field
1 2 2 ne
2 0.33333333 ne
2 0.3333 ne
3 -1 -1 ne
4 -429496729 -4294967295 ne
5 4294967295 4294967295 ne

View File

@ -179,6 +179,7 @@ my @DEFAULT_SUITES= qw(
csv-
compat/oracle-
compat/mssql-
compat/maxdb-
encryption-
federated-
funcs_1-
@ -691,8 +692,7 @@ sub run_test_server ($$$) {
My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel);
# Limit number of core files saved
if ($opt_max_save_core > 0 &&
$num_saved_cores >= $opt_max_save_core)
if ($num_saved_cores >= $opt_max_save_core)
{
mtr_report(" - deleting it, already saved",
"$opt_max_save_core");
@ -708,8 +708,7 @@ sub run_test_server ($$$) {
},
$worker_savedir);
if ($opt_max_save_datadir > 0 &&
$num_saved_datadir >= $opt_max_save_datadir)
if ($num_saved_datadir >= $opt_max_save_datadir)
{
mtr_report(" - skipping '$worker_savedir/'");
rmtree($worker_savedir);
@ -718,9 +717,9 @@ sub run_test_server ($$$) {
{
mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
rename($worker_savedir, $savedir);
$num_saved_datadir++;
}
resfile_print_test();
$num_saved_datadir++;
$num_failed_test++ unless ($result->{retries} ||
$result->{exp_fail});
@ -1277,6 +1276,17 @@ sub command_line_setup {
report_option('verbose', $opt_verbose);
}
# Negative values aren't meaningful on integer options
foreach(grep(/=i$/, keys %options))
{
if (defined ${$options{$_}} &&
do { no warnings "numeric"; int ${$options{$_}} < 0})
{
my $v= (split /=/)[0];
die("$v doesn't accept a negative value:");
}
}
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ($glob_mysql_test_dir =~ / /)
@ -6458,12 +6468,12 @@ Options for debugging the product
test(s)
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_core, set to 0 for no limit. Set
it's default with MTR_MAX_SAVE_CORE
$opt_max_save_core. Set its default with
MTR_MAX_SAVE_CORE
max-save-datadir Limit the number of datadir saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_datadir, set to 0 for no limit. Set
it's default with MTR_MAX_SAVE_DATADIR
$opt_max_save_datadir. Set its default with
MTR_MAX_SAVE_DATADIR
max-test-fail Limit the number of test failures before aborting
the current test run. Defaults to
$opt_max_test_fail, set to 0 for no limit. Set

View File

@ -0,0 +1,65 @@
include/master-slave.inc
[connection master]
#
# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
#
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:00:00');
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
SET sql_mode=MAXDB;
CREATE TABLE t2 SELECT * FROM t1;
SET timestamp=DEFAULT;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a TIMESTAMP)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (NULL)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('2001-01-01 10:20:30')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE "t2" (
"a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp()
)
master-bin.000001 # Annotate_rows # # CREATE TABLE t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
connection slave;
SELECT * FROM t1;
a
2001-01-01 10:00:00
2001-01-01 10:20:30
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET sql_mode=MAXDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp()
)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE "t2" (
"a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp()
)
connection master;
DROP TABLE t1, t2;
include/rpl_end.inc

View File

@ -0,0 +1,34 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--echo #
--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
--echo #
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:00:00');
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
SET sql_mode=MAXDB;
CREATE TABLE t2 SELECT * FROM t1;
SET timestamp=DEFAULT;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
--sync_slave_with_master
SELECT * FROM t1;
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SET sql_mode=MAXDB;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
--connection master
DROP TABLE t1, t2;
--source include/rpl_end.inc

View File

@ -0,0 +1,53 @@
#
# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
#
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
def_timestamp TIMESTAMP,
mdb_timestamp mariadb_schema.TIMESTAMP,
ora_timestamp oracle_schema.TIMESTAMP,
max_timestamp maxdb_schema.TIMESTAMP
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`def_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`mdb_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`ora_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`max_timestamp` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET sql_mode=MAXDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"def_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp(),
"mdb_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
"ora_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
"max_timestamp" datetime DEFAULT NULL
)
DROP TABLE t1;
SET sql_mode=MAXDB;
CREATE TABLE t1 (
def_timestamp TIMESTAMP,
mdb_timestamp mariadb_schema.TIMESTAMP,
ora_timestamp oracle_schema.TIMESTAMP,
max_timestamp maxdb_schema.TIMESTAMP
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"def_timestamp" datetime DEFAULT NULL,
"mdb_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp(),
"ora_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
"max_timestamp" datetime DEFAULT NULL
)
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`def_timestamp` datetime DEFAULT NULL,
`mdb_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`ora_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`max_timestamp` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@ -0,0 +1,29 @@
--echo #
--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
--echo #
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
def_timestamp TIMESTAMP,
mdb_timestamp mariadb_schema.TIMESTAMP,
ora_timestamp oracle_schema.TIMESTAMP,
max_timestamp maxdb_schema.TIMESTAMP
);
SHOW CREATE TABLE t1;
SET sql_mode=MAXDB;
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET sql_mode=MAXDB;
CREATE TABLE t1 (
def_timestamp TIMESTAMP,
mdb_timestamp mariadb_schema.TIMESTAMP,
ora_timestamp oracle_schema.TIMESTAMP,
max_timestamp maxdb_schema.TIMESTAMP
);
SHOW CREATE TABLE t1;
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
DROP TABLE t1;

View File

@ -0,0 +1,86 @@
include/master-slave.inc
[connection master]
SET SQL_MODE=DEFAULT;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES ('2001-01-01');
SET SQL_MODE= ORACLE;
CREATE TABLE t2 SELECT * FROM t1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a DATE)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (NULL)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('2001-01-01')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE "t2" (
"a" mariadb_schema.date DEFAULT NULL
)
master-bin.000001 # Annotate_rows # # CREATE TABLE t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
SET SQL_MODE= DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET SQL_MODE= ORACLE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" mariadb_schema.date DEFAULT NULL
)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE "t2" (
"a" mariadb_schema.date DEFAULT NULL
)
connection slave;
SELECT * FROM t1;
a
NULL
2001-01-01
SELECT * FROM t2;
a
NULL
2001-01-01
SET SQL_MODE= DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET SQL_MODE= ORACLE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" mariadb_schema.date DEFAULT NULL
)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE "t2" (
"a" mariadb_schema.date DEFAULT NULL
)
connection master;
DROP TABLE t1, t2;
include/rpl_end.inc

View File

@ -6,3 +6,150 @@ t1 CREATE TABLE "t1" (
"a" datetime DEFAULT NULL
)
DROP TABLE t1;
#
# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
#
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a unknown.DATE);
ERROR HY000: Unknown data type: 'unknown.date'
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
def_date DATE,
mdb_date mariadb_schema.DATE,
ora_date oracle_schema.DATE,
max_date maxdb_schema.DATE
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`def_date` date DEFAULT NULL,
`mdb_date` date DEFAULT NULL,
`ora_date` datetime DEFAULT NULL,
`max_date` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET sql_mode=ORACLE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"def_date" mariadb_schema.date DEFAULT NULL,
"mdb_date" mariadb_schema.date DEFAULT NULL,
"ora_date" datetime DEFAULT NULL,
"max_date" mariadb_schema.date DEFAULT NULL
)
DROP TABLE t1;
SET sql_mode=ORACLE;
CREATE TABLE t1 (
def_date DATE,
mdb_date mariadb_schema.DATE,
ora_date oracle_schema.DATE,
max_date maxdb_schema.DATE
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"def_date" datetime DEFAULT NULL,
"mdb_date" mariadb_schema.date DEFAULT NULL,
"ora_date" datetime DEFAULT NULL,
"max_date" mariadb_schema.date DEFAULT NULL
)
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`def_date` datetime DEFAULT NULL,
`mdb_date` date DEFAULT NULL,
`ora_date` datetime DEFAULT NULL,
`max_date` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# ALTER..MODIFY and ALTER..CHANGE understand qualifiers
#
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2001-01-01');
SET sql_mode=ORACLE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" mariadb_schema.date DEFAULT NULL
)
SELECT * FROM t1;
a
2001-01-01
ALTER TABLE t1 MODIFY a DATE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" datetime DEFAULT NULL
)
SELECT * FROM t1;
a
2001-01-01 00:00:00
ALTER TABLE t1 MODIFY a mariadb_schema.DATE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" mariadb_schema.date DEFAULT NULL
)
SELECT * FROM t1;
a
2001-01-01
ALTER TABLE t1 MODIFY a oracle_schema.DATE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" datetime DEFAULT NULL
)
SELECT * FROM t1;
a
2001-01-01 00:00:00
ALTER TABLE t1 CHANGE a b mariadb_schema.DATE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"b" mariadb_schema.date DEFAULT NULL
)
SELECT * FROM t1;
b
2001-01-01
ALTER TABLE t1 CHANGE b a oracle_schema.DATE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" datetime DEFAULT NULL
)
SELECT * FROM t1;
a
2001-01-01 00:00:00
DROP TABLE t1;
#
# Qualified syntax is not supported yet in SP
# See MDEV-23353 Qualified data types in SP
#
SET sql_mode=ORACLE;
CREATE FUNCTION f1() RETURN mariadb_schema.DATE AS
BEGIN
RETURN CURRENT_DATE;
END;
$$
ERROR HY000: Unknown data type: 'mariadb_schema'
CREATE PROCEDURE p1(a mariadb_schema.DATE) AS
BEGIN
NULL;
END;
$$
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AS
BEGIN
NULL;
END' at line 1
CREATE PROCEDURE p1() AS
a mariadb_schema.DATE;
BEGIN
NULL;
END;
$$
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ';
BEGIN
NULL;
END' at line 2

View File

@ -0,0 +1,38 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
SET SQL_MODE=DEFAULT;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES ('2001-01-01');
SET SQL_MODE= ORACLE;
CREATE TABLE t2 SELECT * FROM t1;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
SET SQL_MODE= DEFAULT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SET SQL_MODE= ORACLE;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
--sync_slave_with_master
SELECT * FROM t1;
SELECT * FROM t2;
SET SQL_MODE= DEFAULT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SET SQL_MODE= ORACLE;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
# Cleanup
--connection master
DROP TABLE t1, t2;
--source include/rpl_end.inc

View File

@ -2,3 +2,100 @@ SET sql_mode=ORACLE;
CREATE TABLE t1 (a DATE);
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode
--echo #
SET sql_mode=DEFAULT;
--error ER_UNKNOWN_DATA_TYPE
CREATE TABLE t1 (a unknown.DATE);
SET sql_mode=DEFAULT;
CREATE TABLE t1 (
def_date DATE,
mdb_date mariadb_schema.DATE,
ora_date oracle_schema.DATE,
max_date maxdb_schema.DATE
);
SHOW CREATE TABLE t1;
SET sql_mode=ORACLE;
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET sql_mode=ORACLE;
CREATE TABLE t1 (
def_date DATE,
mdb_date mariadb_schema.DATE,
ora_date oracle_schema.DATE,
max_date maxdb_schema.DATE
);
SHOW CREATE TABLE t1;
SET sql_mode=DEFAULT;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # ALTER..MODIFY and ALTER..CHANGE understand qualifiers
--echo #
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2001-01-01');
SET sql_mode=ORACLE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 MODIFY a DATE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 MODIFY a mariadb_schema.DATE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 MODIFY a oracle_schema.DATE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 CHANGE a b mariadb_schema.DATE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
ALTER TABLE t1 CHANGE b a oracle_schema.DATE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Qualified syntax is not supported yet in SP
--echo # See MDEV-23353 Qualified data types in SP
--echo #
SET sql_mode=ORACLE;
DELIMITER $$;
--error ER_UNKNOWN_DATA_TYPE
CREATE FUNCTION f1() RETURN mariadb_schema.DATE AS
BEGIN
RETURN CURRENT_DATE;
END;
$$
--error ER_PARSE_ERROR
CREATE PROCEDURE p1(a mariadb_schema.DATE) AS
BEGIN
NULL;
END;
$$
--error ER_PARSE_ERROR
CREATE PROCEDURE p1() AS
a mariadb_schema.DATE;
BEGIN
NULL;
END;
$$
DELIMITER ;$$

View File

@ -1896,9 +1896,13 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 3
INSERT IGNORE INTO t5 VALUES('1e+52','-1e+52','1e+52',5),('1e-52','-1e-52','1e-52',6);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
Warning 1264 Out of range value for column 'c3' at row 1
INSERT IGNORE INTO t5 VALUES('1e+53','-1e+53','1e+53',7),('1e-53','-1e-53','1e-53',8);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
Warning 1264 Out of range value for column 'c3' at row 1
SELECT * FROM t5;
c1 c2 c3 c4

View File

@ -46,3 +46,4 @@ partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
sql_log_bin : MDEV-21491 galera.sql_log_bin
versioning_trx_id : MDEV-18590 galera.versioning_trx_id
MW-328A : MDEV-22666?

View File

@ -1,10 +1,19 @@
--- default_row_format_alter.result
+++ default_row_format_alter,compact.reject
@@ -91,6 +91,6 @@
@@ -91,7 +91,7 @@
ALTER TABLE t1 ADD b INT;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
-Dynamic
+Compact
DROP TABLE t1;
#
# MDEV-23345 Assertion not_redundant() == old.not_redundant() failed
@@ -102,6 +102,6 @@
ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
-Dynamic
+Compact
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;

View File

@ -1,10 +1,19 @@
--- default_row_format_alter.result
+++ default_row_format_alter,compact.reject
@@ -91,6 +91,6 @@
+++ default_row_format_alter,redundant.reject
@@ -91,7 +91,7 @@
ALTER TABLE t1 ADD b INT;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
-Dynamic
+Redundant
DROP TABLE t1;
#
# MDEV-23345 Assertion not_redundant() == old.not_redundant() failed
@@ -102,6 +102,6 @@
ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
-Dynamic
+Redundant
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;

View File

@ -93,4 +93,15 @@ SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
Dynamic
DROP TABLE t1;
#
# MDEV-23345 Assertion not_redundant() == old.not_redundant() failed
#
SET GLOBAL innodb_default_row_format = @row_format;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB;
SET GLOBAL innodb_default_row_format= COMPACT;
ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
Dynamic
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;

View File

@ -33,6 +33,7 @@ a
20
UPDATE t SET a=3 WHERE a=1;
# restart: --innodb-read-only
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version
# (only a=3; no record for a=20)!

View File

@ -106,4 +106,14 @@ ALTER TABLE t1 ADD b INT;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
--echo #
--echo # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed
--echo #
SET GLOBAL innodb_default_row_format = @row_format;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB;
SET GLOBAL innodb_default_row_format= COMPACT;
ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;

View File

@ -59,6 +59,7 @@ SELECT * FROM t;
UPDATE t SET a=3 WHERE a=1;
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
--echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
--echo # In earlier versions, this would return the last committed version
--echo # (only a=3; no record for a=20)!

View File

@ -0,0 +1,15 @@
call mtr.add_suppression('Unknown key id 1. Can''t continue');
set global aria_encrypt_tables= 1;
create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
alter table t1 disable keys;
insert into t1 values (1,1);
alter table t1 enable keys;
ERROR HY000: Unknown key id 1. Can't continue!
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair Error Unknown key id 1. Can't continue!
test.t1 repair Error Unknown key id 1. Can't continue!
test.t1 repair status OK
drop table t1;
set global aria_encrypt_tables= default;

View File

@ -0,0 +1,14 @@
#
# MDEV-18496 Crash when Aria encryption is enabled but plugin not available
#
call mtr.add_suppression('Unknown key id 1. Can''t continue');
set global aria_encrypt_tables= 1;
create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
alter table t1 disable keys;
insert into t1 values (1,1);
error 192;
alter table t1 enable keys;
repair table t1 use_frm;
drop table t1;
set global aria_encrypt_tables= default;

View File

@ -1,3 +1,4 @@
FLUSH TABLES;
#
# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE

View File

@ -8,6 +8,10 @@
# Crash tests don't work with embedded
--source include/not_embedded.inc
# Make sure system tables are not open, as the test will kill the server
# and it will cause corruption errors in the log
FLUSH TABLES;
# Partitioning test that require debug features
--echo #

View File

@ -0,0 +1,5 @@
create role r;
set role r;
drop role r;
revoke all on *.* from current_role;
ERROR OP000: Invalid role specification `r`

View File

@ -0,0 +1,9 @@
--source include/not_embedded.inc
#
# MDEV-22521 Server crashes in traverse_role_graph_up or Assertion `user' fails in traverse_role_graph_impl
#
create role r;
set role r;
drop role r;
error ER_INVALID_ROLE;
revoke all on *.* from current_role;

View File

@ -2,8 +2,10 @@ include/rpl_init.inc [topology=1->2]
*** MDEV-5509: Incorrect value for Seconds_Behind_Master if parallel replication ***
connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
set global slave_parallel_mode= optimistic;
include/start_slave.inc
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
@ -157,6 +159,7 @@ UNLOCK TABLES;
connection server_2;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
set global slave_parallel_mode= @old_parallel_mode;
include/start_slave.inc
connection server_1;
DROP TABLE t1, t2;

View File

@ -8,8 +8,10 @@
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
set global slave_parallel_mode= optimistic;
--source include/start_slave.inc
--connection server_1
@ -219,6 +221,7 @@ UNLOCK TABLES;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
set global slave_parallel_mode= @old_parallel_mode;
--source include/start_slave.inc
--connection server_1

View File

@ -51,9 +51,9 @@ INSERT into t1(name, salary, income_tax) values('Record_2', 501, 501*2.5/1000);
INSERT into t1(name, salary, income_tax) values('Record_3', 210, 210*2.5/1000);
SELECT * from t1;
id name salary income_tax
1 Record_1 100011 250.027
2 Record_2 501 1.2525
3 Record_3 210 0.525
1 Record_1 100011 250.03
2 Record_2 501 1.25
3 Record_3 210 0.53
connect test_con2, localhost, root,,;
connection test_con2;
## Verifying session & global value of variable ##
@ -69,11 +69,11 @@ INSERT into t1(name, salary, income_tax) values('Record_5', 501, 501*2.5/1000);
INSERT into t1(name, salary, income_tax) values('Record_6', 210, 210*2.5/1000);
SELECT * from t1;
id name salary income_tax
1 Record_1 100011 250.027
2 Record_2 501 1.2525
3 Record_3 210 0.525
4 Record_4 100011 250.027
5 Record_5 501 1.2525
1 Record_1 100011 250.03
2 Record_2 501 1.25
3 Record_3 210 0.53
4 Record_4 100011 250.028
5 Record_5 501 1.253
6 Record_6 210 0.525
## Dropping table t1 ##
drop table t1;

View File

@ -29,7 +29,7 @@ set time_zone='+1:00';
flush tables;
select * from t1;
a b v
1 2 0.3333333330000000000
1 2 0.3333000000000000000
select * from t8;
a b v
1234567890 2 2009-02-14 00:31:30

File diff suppressed because it is too large Load Diff

View File

@ -33,13 +33,14 @@
#include <execinfo.h>
#endif
#ifdef __linux__
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
static char *heap_start;
char *__bss_start;
#else
#define PTR_SANE(p) (p)
#endif /* __linux */
#if(defined HAVE_BSS_START) && !(defined __linux__)
extern char *__bss_start;
#endif
/**
Default handler for printing stacktrace
@ -67,9 +68,9 @@ static sig_handler default_handle_fatal_signal(int sig)
void my_init_stacktrace(int setup_handlers)
{
#if(defined HAVE_BSS_START) && !(defined __linux__)
#ifdef __linux__
heap_start = (char*) &__bss_start;
#endif
#endif /* __linux */
if (setup_handlers)
{
struct sigaction sa;
@ -186,15 +187,15 @@ static int safe_print_str(const char *addr, size_t max_len)
int my_safe_print_str(const char* val, size_t max_len)
{
#ifdef __linux__
char *heap_end;
#ifdef __linux__
// Try and make use of /proc filesystem to safely print memory contents.
if (!safe_print_str(val, max_len))
return 0;
#endif
heap_end= (char*) sbrk(0);
#endif
if (!PTR_SANE(val))
{

View File

@ -234,7 +234,7 @@ maria_declare_plugin(type_geom)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE // Maturity (see include/mysql/plugin.h)*/
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -249,6 +249,6 @@ maria_declare_plugin(type_geom)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)
MariaDB_PLUGIN_MATURITY_STABLE // Maturity (see include/mysql/plugin.h)
}
maria_declare_plugin_end;

View File

@ -35,7 +35,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function INET6_ATON()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME inet6_ntoa
@ -45,7 +45,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function INET6_NTOA()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME inet_aton
@ -55,7 +55,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function INET_ATON()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME inet_ntoa
@ -65,7 +65,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function INET_NTOA()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME is_ipv4
@ -75,7 +75,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function IS_IPV4()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME is_ipv4_compat
@ -85,7 +85,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function IS_IPV4_COMPAT()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME is_ipv4_mapped
@ -95,7 +95,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function IS_IPV4_MAPPED()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
---- ----
PLUGIN_NAME is_ipv6
@ -105,7 +105,7 @@ PLUGIN_TYPE FUNCTION
PLUGIN_AUTHOR MariaDB Corporation
PLUGIN_DESCRIPTION Function IS_IPV6()
PLUGIN_LICENSE GPL
PLUGIN_MATURITY Alpha
PLUGIN_MATURITY Stable
PLUGIN_AUTH_VERSION 1.0
#
# End of 10.5 tests

View File

@ -201,7 +201,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -216,7 +216,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -231,7 +231,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -246,7 +246,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -261,7 +261,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -276,7 +276,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -291,7 +291,7 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
},
{
MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
@ -306,6 +306,6 @@ maria_declare_plugin(type_inet)
NULL, // Status variables
NULL, // System variables
"1.0", // String version representation
MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/
MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
}
maria_declare_plugin_end;

View File

@ -67,6 +67,7 @@ Usage: $0 [OPTIONS]
--cross-bootstrap For internal use. Used when building the MariaDB system
tables on a different host than the target.
--datadir=path The path to the MariaDB data directory.
--no-defaults Don't read default options from any option file.
--defaults-extra-file=name
Read this file after the global files are read.
--defaults-file=name Only read default options from the given file name.
@ -79,8 +80,6 @@ Usage: $0 [OPTIONS]
--help Display this help and exit.
--ldata=path The path to the MariaDB data directory. Same as
--datadir.
--no-defaults Don't read default options from any option file.
--defaults-file=path Read only this configuration file.
--rpm For internal use. This option is used by RPM files
during the MariaDB installation process.
--skip-name-resolve Use IP addresses rather than hostnames when creating

View File

@ -145,6 +145,7 @@ SET (SQL_SOURCE
rpl_gtid.cc rpl_parallel.cc
semisync.cc semisync_master.cc semisync_slave.cc
semisync_master_ack_receiver.cc
sql_schema.cc
sql_type.cc sql_mode.cc sql_type_json.cc
sql_type_string.cc
sql_type_geom.cc

View File

@ -305,7 +305,7 @@ uint my_datetime_binary_length(uint dec)
/*
On disk we store as unsigned number with DATETIMEF_INT_OFS offset,
for HA_KETYPE_BINARY compatibilty purposes.
for HA_KETYPE_BINARY compatibility purposes.
*/
#define DATETIMEF_INT_OFS 0x8000000000LL

View File

@ -34,7 +34,7 @@
/*
Action to perform at a synchronization point.
NOTE: This structure is moved around in memory by realloc(), qsort(),
and memmove(). Do not add objects with non-trivial constuctors
and memmove(). Do not add objects with non-trivial constructors
or destructors, which might prevent moving of this structure
with these functions.
*/
@ -571,7 +571,7 @@ static void debug_sync_reset(THD *thd)
@description
Removing an action mainly means to decrement the ds_active counter.
But if the action is between other active action in the array, then
the array needs to be shrinked. The active actions above the one to
the array needs to be shrunk. The active actions above the one to
be removed have to be moved down by one slot.
*/

View File

@ -237,7 +237,7 @@ static File open_error_msg_file(const char *file_name, const char *language,
MYF(0))) < 0)
{
/*
Trying pre-5.4 sematics of the --language parameter.
Trying pre-5.4 semantics of the --language parameter.
It included the language-specific part, e.g.:
--language=/path/to/english/
*/

View File

@ -78,8 +78,8 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
(struct st_mariadb_encryption*) plugin->plugin->info;
/*
Copmiler on Spark doesn't like the '?' operator here as it
belives the (uint (*)...) implies the C++ call model.
Compiler on Spark doesn't like the '?' operator here as it
believes the (uint (*)...) implies the C++ call model.
*/
if (handle->crypt_ctx_size)
encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;

View File

@ -173,7 +173,7 @@ Event_creation_ctx::load_from_db(THD *thd,
/*************************************************************************/
/*
Initiliazes dbname and name of an Event_queue_element_for_exec
Initializes dbname and name of an Event_queue_element_for_exec
object
SYNOPSIS

View File

@ -678,7 +678,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
DBUG_PRINT("info", ("name: %.*s", (int) parse_data->name.length,
parse_data->name.str));
DBUG_PRINT("info", ("check existance of an event with the same name"));
DBUG_PRINT("info", ("check existence of an event with the same name"));
if (!find_named_event(&parse_data->dbname, &parse_data->name, table))
{
if (thd->lex->create_info.or_replace())

View File

@ -97,7 +97,7 @@ Event_parse_data::init_name(THD *thd, sp_name *spn)
ENDS or AT is in the past, we are trying to create an event that
will never be executed. If it has ON COMPLETION NOT PRESERVE
(default), then it would normally be dropped already, so on CREATE
EVENT we give a warning, and do not create anyting. On ALTER EVENT
EVENT we give a warning, and do not create anything. On ALTER EVENT
we give a error, and do not change the event.
If the event has ON COMPLETION PRESERVE, then we see if the event is
@ -362,7 +362,7 @@ wrong_value:
EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will
start at the date shown above. Expressions are possible :
DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at
DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tomorrow at
same time.
RETURN VALUE
@ -417,7 +417,7 @@ wrong_value:
EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will
end at the date shown above. Expressions are possible :
DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at
DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tomorrow at
same time.
RETURN VALUE

View File

@ -364,7 +364,7 @@ Event_queue::drop_matching_events(THD *thd, const LEX_CSTRING *pattern,
We don't call mysql_cond_broadcast(&COND_queue_state);
If we remove the top event:
1. The queue is empty. The scheduler will wake up at some time and
realize that the queue is empty. If create_event() comes inbetween
realize that the queue is empty. If create_event() comes in between
it will signal the scheduler
2. The queue is not empty, but the next event after the previous top,
won't be executed any time sooner than the element we removed. Hence,

View File

@ -130,7 +130,7 @@ bool Events::check_if_system_tables_error()
/**
Reconstructs interval expression from interval type and expression
value that is in form of a value of the smalles entity:
value that is in form of a value of the smallest entity:
For
YEAR_MONTH - expression is in months
DAY_MINUTE - expression is in minutes

View File

@ -42,7 +42,7 @@
#define MAX_EXPONENT 1024
/*****************************************************************************
Instansiate templates and static variables
Instantiate templates and static variables
*****************************************************************************/
static const char *zero_timestamp="0000-00-00 00:00:00.000000";
@ -88,7 +88,7 @@ bool Field::marked_for_write_or_computed() const
/*
Rules for merging different types of fields in UNION
NOTE: to avoid 256*256 table, gap in table types numeration is skiped
NOTE: to avoid 256*256 table, gap in table types numeration is skipped
following #defines describe that gap and how to canculate number of fields
and index of field in this array.
*/
@ -1087,7 +1087,7 @@ Field_longstr::pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field)
{
StringBuffer<LONGLONG_BUFFER_SIZE> buf;
val_str(&buf, &buf);
return to + sort_field->pack_sort_string(to, &buf);
return to + sort_field->pack_sort_string(to, &buf, field_charset());
}
@ -1552,7 +1552,7 @@ Item *Field_num::get_equal_zerofill_const_item(THD *thd, const Context &ctx,
/**
Contruct warning parameters using thd->no_errors
Construct warning parameters using thd->no_errors
to determine whether to generate or suppress warnings.
We can get here in a query like this:
SELECT COUNT(@@basedir);
@ -1600,7 +1600,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
if (filter.want_warning_edom())
{
/*
We can use err.ptr() here as ErrConvString is guranteed to put an
We can use err.ptr() here as ErrConvString is guaranteed to put an
end \0 here.
*/
THD *wthd= thd ? thd : current_thd;
@ -1632,7 +1632,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
- found garbage at the end of the string.
@param type Data type name (e.g. "decimal", "integer", "double")
@param edom Indicates that the string-to-number routine retuned
@param edom Indicates that the string-to-number routine returned
an error code equivalent to EDOM (value out of domain),
i.e. the string fully consisted of garbage and the
conversion routine could not get any digits from it.
@ -1695,7 +1695,7 @@ int Field_num::check_edom_and_truncation(const char *type, bool edom,
/*
Conver a string to an integer then check bounds.
Convert a string to an integer then check bounds.
SYNOPSIS
Field_num::get_int
@ -2809,7 +2809,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
We only have to generate warnings if count_cuted_fields is set.
This is to avoid extra checks of the number when they are not needed.
Even if this flag is not set, it's OK to increment warnings, if
it makes the code easer to read.
it makes the code easier to read.
*/
if (get_thd()->count_cuted_fields > CHECK_FIELD_EXPRESSION)
@ -2892,7 +2892,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
}
/*
Now write the formated number
Now write the formatted number
First the digits of the int_% parts.
Do we have enough room to write these digits ?
@ -3409,7 +3409,7 @@ int Field_new_decimal::store(const char *from, size_t length,
If check_decimal() failed because of EDOM-alike error,
(e.g. E_DEC_BAD_NUM), we have to initialize decimal_value to zero.
Note: if check_decimal() failed because of truncation,
decimal_value is alreay properly initialized.
decimal_value is already properly initialized.
*/
my_decimal_set_zero(&decimal_value);
/*
@ -4781,11 +4781,12 @@ int truncate_double(double *nr, uint field_length, uint dec,
{
uint order= field_length - dec;
uint step= array_elements(log_10) - 1;
max_value= 1.0;
double max_value_by_dec= 1.0;
for (; order > step; order-= step)
max_value*= log_10[step];
max_value*= log_10[order];
max_value-= 1.0 / log_10[dec];
max_value_by_dec*= log_10[step];
max_value_by_dec*= log_10[order];
max_value_by_dec-= 1.0 / log_10[dec];
set_if_smaller(max_value, max_value_by_dec);
/* Check for infinity so we don't get NaN in calculations */
if (!std::isinf(res))
@ -5076,7 +5077,7 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
{
/*
We mark the flag with TIMESTAMP_FLAG to indicate to the client that
this field will be automaticly updated on insert.
this field will be automatically updated on insert.
*/
flags|= TIMESTAMP_FLAG;
if (unireg_check != TIMESTAMP_DN_FIELD)
@ -7505,7 +7506,7 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end,
with the real type. Since all allowable types have 0xF as most
significant bits of the metadata word, lengths <256 will not affect
the real type at all, while all other values will result in a
non-existant type in the range 17-244.
non-existent type in the range 17-244.
@see Field_string::unpack
@ -7706,8 +7707,7 @@ void Field_varstring::mark_unused_memory_as_defined()
#endif
int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uint max_len) const
int Field_varstring::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
uint a_length, b_length;
int diff;
@ -7722,14 +7722,51 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
a_length= uint2korr(a_ptr);
b_length= uint2korr(b_ptr);
}
set_if_smaller(a_length, max_len);
set_if_smaller(b_length, max_len);
set_if_smaller(a_length, field_length);
set_if_smaller(b_length, field_length);
diff= field_charset()->strnncollsp(a_ptr + length_bytes, a_length,
b_ptr + length_bytes, b_length);
return diff;
}
static int cmp_str_prefix(const uchar *ua, size_t alen, const uchar *ub,
size_t blen, size_t prefix, CHARSET_INFO *cs)
{
const char *a= (char*)ua, *b= (char*)ub;
MY_STRCOPY_STATUS status;
prefix/= cs->mbmaxlen;
alen= cs->cset->well_formed_char_length(cs, a, a + alen, prefix, &status);
blen= cs->cset->well_formed_char_length(cs, b, b + blen, prefix, &status);
return cs->coll->strnncollsp(cs, ua, alen, ub, blen);
}
int Field_varstring::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
size_t prefix_len) const
{
/* avoid expensive well_formed_char_length if possible */
if (prefix_len == table->field[field_index]->field_length)
return Field_varstring::cmp(a_ptr, b_ptr);
size_t a_length, b_length;
if (length_bytes == 1)
{
a_length= *a_ptr;
b_length= *b_ptr;
}
else
{
a_length= uint2korr(a_ptr);
b_length= uint2korr(b_ptr);
}
return cmp_str_prefix(a_ptr+length_bytes, a_length, b_ptr+length_bytes,
b_length, prefix_len, field_charset());
}
/**
@note
varstring and blob keys are ALWAYS stored with a 2 byte length prefix
@ -8235,8 +8272,8 @@ longlong Field_varstring_compressed::val_int(void)
}
int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uint max_len) const
int Field_varstring_compressed::cmp(const uchar *a_ptr,
const uchar *b_ptr) const
{
String a, b;
uint a_length, b_length;
@ -8255,13 +8292,10 @@ int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uncompress(&a, &a, a_ptr + length_bytes, a_length);
uncompress(&b, &b, b_ptr + length_bytes, b_length);
if (a.length() > max_len)
a.length(max_len);
if (b.length() > max_len)
b.length(max_len);
return sortcmp(&a, &b, field_charset());
}
Binlog_type_info Field_varstring_compressed::binlog_type_info() const
{
return Binlog_type_info(Field_varstring_compressed::binlog_type(),
@ -8498,16 +8532,25 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
}
int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uint max_length) const
int Field_blob::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
uchar *blob1,*blob2;
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
memcpy(&blob2, b_ptr+packlength, sizeof(char*));
uint a_len= get_length(a_ptr), b_len= get_length(b_ptr);
set_if_smaller(a_len, max_length);
set_if_smaller(b_len, max_length);
return Field_blob::cmp(blob1,a_len,blob2,b_len);
size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr);
return cmp(blob1, (uint32)a_len, blob2, (uint32)b_len);
}
int Field_blob::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
size_t prefix_len) const
{
uchar *blob1,*blob2;
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
memcpy(&blob2, b_ptr+packlength, sizeof(char*));
size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr);
return cmp_str_prefix(blob1, a_len, blob2, b_len, prefix_len,
field_charset());
}
@ -9690,7 +9733,8 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value)
The a and b pointer must be pointers to the field in a record
(not the table->record[0] necessarily)
*/
int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len) const
int Field_bit::cmp_prefix(const uchar *a, const uchar *b,
size_t prefix_len) const
{
my_ptrdiff_t a_diff= a - ptr;
my_ptrdiff_t b_diff= b - ptr;

View File

@ -321,7 +321,7 @@ protected:
};
// String-to-number convertion methods for the old code compatibility
// String-to-number conversion methods for the old code compatibility
longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
const char *end) const
{
@ -402,7 +402,7 @@ public:
/*
Item context attributes.
Comparison functions pass their attributes to propagate_equal_fields().
For exmple, for string comparison, the collation of the comparison
For example, for string comparison, the collation of the comparison
operation is important inside propagate_equal_fields().
*/
class Context
@ -1273,8 +1273,13 @@ public:
const Conv_param &param)
const;
inline int cmp(const uchar *str) const { return cmp(ptr,str); }
virtual int cmp_max(const uchar *a, const uchar *b, uint max_len) const
{ return cmp(a, b); }
/*
The following method is used for comparing prefix keys.
Currently it's only used in partitioning.
*/
virtual int cmp_prefix(const uchar *a, const uchar *b,
size_t prefix_len) const
{ return cmp(a, b); }
virtual int cmp(const uchar *,const uchar *) const=0;
virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const
{ return memcmp(a,b,pack_length()); }
@ -2269,7 +2274,7 @@ public:
};
class Field_decimal :public Field_real {
class Field_decimal final :public Field_real {
public:
Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@ -2315,7 +2320,7 @@ public:
/* New decimal/numeric field which use fixed point arithmetic */
class Field_new_decimal :public Field_num {
class Field_new_decimal final :public Field_num {
public:
/* The maximum number of decimal digits can be stored */
uint precision;
@ -2545,7 +2550,7 @@ public:
};
class Field_short :public Field_int
class Field_short final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@ -2598,7 +2603,7 @@ public:
}
};
class Field_medium :public Field_int
class Field_medium final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@ -2644,7 +2649,7 @@ public:
};
class Field_long :public Field_int
class Field_long final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@ -2807,7 +2812,7 @@ public:
};
class Field_float :public Field_real {
class Field_float final :public Field_real {
public:
Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@ -2893,28 +2898,28 @@ public:
}
const Type_handler *type_handler() const override
{ return &type_handler_double; }
enum ha_base_keytype key_type() const override { return HA_KEYTYPE_DOUBLE; }
int store(const char *to,size_t length,CHARSET_INFO *charset) override;
int store(double nr) override;
int store(longlong nr, bool unsigned_val) override;
int reset() override { bzero(ptr,sizeof(double)); return 0; }
double val_real() override;
longlong val_int() override { return val_int_from_real(false); }
ulonglong val_uint() override { return (ulonglong) val_int_from_real(true); }
String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff, uint length) override;
uint32 pack_length() const override { return sizeof(double); }
uint row_pack_length() const override { return pack_length(); }
ulonglong get_max_int_value() const override
enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_DOUBLE; }
int store(const char *to,size_t length,CHARSET_INFO *charset) override final;
int store(double nr) override final;
int store(longlong nr, bool unsigned_val) override final;
int reset() override final { bzero(ptr,sizeof(double)); return 0; }
double val_real() override final;
longlong val_int() override final { return val_int_from_real(false); }
ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); }
String *val_str(String *, String *) override final;
bool send_binary(Protocol *protocol) override final;
int cmp(const uchar *,const uchar *) const override final;
void sort_string(uchar *buff, uint length) override final;
uint32 pack_length() const override final { return sizeof(double); }
uint row_pack_length() const override final { return pack_length(); }
ulonglong get_max_int_value() const override final
{
/*
We use the maximum as per IEEE754-2008 standard, 2^53
*/
return 0x20000000000000ULL;
}
Binlog_type_info binlog_type_info() const override;
Binlog_type_info binlog_type_info() const override final;
};
@ -2943,40 +2948,40 @@ public:
{
return do_field_string;
}
int store(const char *to, size_t length, CHARSET_INFO *cs) override
int store(const char *to, size_t length, CHARSET_INFO *cs) override final
{ null[0]=1; return 0; }
int store(double nr) override { null[0]=1; return 0; }
int store(longlong nr, bool unsigned_val) override { null[0]=1; return 0; }
int store_decimal(const my_decimal *d) override { null[0]=1; return 0; }
int reset() override { return 0; }
double val_real() override { return 0.0;}
longlong val_int() override { return 0;}
bool val_bool() override { return false; }
my_decimal *val_decimal(my_decimal *) override { return 0; }
String *val_str(String *value,String *value2) override
int store(double nr) override final { null[0]=1; return 0; }
int store(longlong nr, bool unsigned_val) override final { null[0]=1; return 0; }
int store_decimal(const my_decimal *d) override final { null[0]=1; return 0; }
int reset() override final { return 0; }
double val_real() override final { return 0.0;}
longlong val_int() override final { return 0;}
bool val_bool() override final { return false; }
my_decimal *val_decimal(my_decimal *) override final { return 0; }
String *val_str(String *value,String *value2) override final
{ value2->length(0); return value2;}
bool is_equal(const Column_definition &new_field) const override;
int cmp(const uchar *a, const uchar *b) const override { return 0;}
void sort_string(uchar *buff, uint length) override {}
uint32 pack_length() const override { return 0; }
void sql_type(String &str) const override;
uint size_of() const override { return sizeof *this; }
uint32 max_display_length() const override { return 4; }
void move_field_offset(my_ptrdiff_t ptr_diff) override {}
bool is_equal(const Column_definition &new_field) const override final;
int cmp(const uchar *a, const uchar *b) const override final { return 0;}
void sort_string(uchar *buff, uint length) override final {}
uint32 pack_length() const override final { return 0; }
void sql_type(String &str) const override final;
uint size_of() const override final { return sizeof *this; }
uint32 max_display_length() const override final { return 4; }
void move_field_offset(my_ptrdiff_t ptr_diff) override final {}
bool can_optimize_keypart_ref(const Item_bool_func *cond,
const Item *item) const override
const Item *item) const override final
{
return false;
}
bool can_optimize_group_min_max(const Item_bool_func *cond,
const Item *const_item) const override
const Item *const_item) const override final
{
return false;
}
};
class Field_temporal: public Field {
class Field_temporal :public Field {
protected:
Item *get_equal_const_item_datetime(THD *thd, const Context &ctx,
Item *const_item);
@ -3093,7 +3098,7 @@ public:
- DATETIME(1..6)
- DATETIME(0..6) - MySQL56 version
*/
class Field_temporal_with_date: public Field_temporal {
class Field_temporal_with_date :public Field_temporal {
protected:
virtual void store_TIME(const MYSQL_TIME *ltime) = 0;
void store_datetime(const Datetime &dt)
@ -3300,7 +3305,7 @@ public:
/**
TIMESTAMP(0..6) - MySQL56 version
*/
class Field_timestampf :public Field_timestamp_with_dec {
class Field_timestampf final :public Field_timestamp_with_dec {
void store_TIMEVAL(const timeval &tv) override;
public:
Field_timestampf(uchar *ptr_arg,
@ -3348,7 +3353,7 @@ public:
};
class Field_year :public Field_tiny {
class Field_year final :public Field_tiny {
public:
Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@ -3409,7 +3414,7 @@ public:
};
class Field_date_common: public Field_temporal_with_date
class Field_date_common :public Field_temporal_with_date
{
protected:
int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str,
@ -3434,7 +3439,7 @@ public:
};
class Field_date :public Field_date_common
class Field_date final :public Field_date_common
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@ -3475,7 +3480,7 @@ public:
};
class Field_newdate :public Field_date_common
class Field_newdate final :public Field_date_common
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@ -3566,7 +3571,7 @@ public:
};
class Field_time0: public Field_time
class Field_time0 final :public Field_time
{
protected:
void store_TIME(const MYSQL_TIME *ltime) override;
@ -3623,7 +3628,7 @@ public:
/**
TIME(1..6)
*/
class Field_time_hires :public Field_time_with_dec {
class Field_time_hires final :public Field_time_with_dec {
longlong zero_point;
void store_TIME(const MYSQL_TIME *) override;
public:
@ -3656,7 +3661,7 @@ public:
/**
TIME(0..6) - MySQL56 version
*/
class Field_timef :public Field_time_with_dec {
class Field_timef final :public Field_time_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
public:
Field_timef(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
@ -3741,7 +3746,11 @@ public:
};
class Field_datetime0 :public Field_datetime
/*
Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte
*/
class Field_datetime0 final :public Field_datetime
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@ -3803,30 +3812,30 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
uint decimals() const override { return dec; }
enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
void make_send_field(Send_field *field) override;
bool send_binary(Protocol *protocol) override;
uchar *pack(uchar *to, const uchar *from, uint max_length) override
uint decimals() const override final { return dec; }
enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; }
void make_send_field(Send_field *field) override final;
bool send_binary(Protocol *protocol) override final;
uchar *pack(uchar *to, const uchar *from, uint max_length) override final
{ return Field::pack(to, from, max_length); }
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
uint param_data) override
uint param_data) override final
{ return Field::unpack(to, from, from_end, param_data); }
void sort_string(uchar *to, uint length) override
void sort_string(uchar *to, uint length) override final
{
DBUG_ASSERT(length == pack_length());
memcpy(to, ptr, length);
}
double val_real() override;
longlong val_int() override;
String *val_str(String *, String *) override;
double val_real() override final;
longlong val_int() override final;
String *val_str(String *, String *) override final;
};
/**
DATETIME(1..6)
*/
class Field_datetime_hires :public Field_datetime_with_dec {
class Field_datetime_hires final :public Field_datetime_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
const override;
@ -3856,7 +3865,8 @@ public:
/**
DATETIME(0..6) - MySQL56 version
*/
class Field_datetimef :public Field_datetime_with_dec {
class Field_datetimef final :public Field_datetime_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
const override;
@ -3950,7 +3960,7 @@ new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
unireg_check, field_name, dec);
}
class Field_string :public Field_longstr {
class Field_string final :public Field_longstr {
class Warn_filter_string: public Warn_filter
{
public:
@ -4143,11 +4153,9 @@ public:
longlong val_int() override;
String *val_str(String *, String *) override;
my_decimal *val_decimal(my_decimal *) override;
int cmp_max(const uchar *, const uchar *, uint max_length) const override;
int cmp(const uchar *a,const uchar *b) const override
{
return cmp_max(a, b, ~0U);
}
int cmp(const uchar *a,const uchar *b) const override;
int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const
override;
void sort_string(uchar *buff,uint length) override;
uint get_key_image(uchar *buff, uint length,
const uchar *ptr_arg, imagetype type) const override;
@ -4185,7 +4193,7 @@ public:
};
class Field_varstring_compressed: public Field_varstring {
class Field_varstring_compressed final :public Field_varstring {
public:
Field_varstring_compressed(uchar *ptr_arg,
uint32 len_arg, uint length_bytes_arg,
@ -4222,8 +4230,7 @@ private:
{
return (field_length - 1) / mbmaxlen();
}
int cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_len) const
override;
int cmp(const uchar *a_ptr, const uchar *b_ptr) const override;
/*
Compressed fields can't have keys as two rows may have different
@ -4434,9 +4441,9 @@ public:
longlong val_int() override;
String *val_str(String *, String *) override;
my_decimal *val_decimal(my_decimal *) override;
int cmp_max(const uchar *, const uchar *, uint max_length) const override;
int cmp(const uchar *a,const uchar *b) const override
{ return cmp_max(a, b, ~0U); }
int cmp(const uchar *a, const uchar *b) const override;
int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const
override;
int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length)
const;
int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const
@ -4588,7 +4595,7 @@ public:
};
class Field_blob_compressed: public Field_blob {
class Field_blob_compressed final :public Field_blob {
public:
Field_blob_compressed(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@ -4754,7 +4761,7 @@ private:
};
class Field_set :public Field_enum {
class Field_set final :public Field_enum {
public:
Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@ -4802,7 +4809,7 @@ private:
This is the reason:
- Field_bit::cmp_binary() is only implemented in the base class
(Field::cmp_binary()).
- Field::cmp_binary() currenly use pack_length() to calculate how
- Field::cmp_binary() currently uses pack_length() to calculate how
long the data is.
- pack_length() includes size of the bits stored in the NULL bytes
of the record.
@ -4874,7 +4881,8 @@ public:
}
int cmp_binary_offset(uint row_offset) override
{ return cmp_offset(row_offset); }
int cmp_max(const uchar *a, const uchar *b, uint max_length) const override;
int cmp_prefix(const uchar *a, const uchar *b,
size_t max_length) const override;
int key_cmp(const uchar *a, const uchar *b) const override
{ return cmp_binary((uchar *) a, (uchar *) b); }
int key_cmp(const uchar *str, uint length) const override;
@ -5002,7 +5010,7 @@ private:
an extended version of Field_bit_as_char and not the other way
around. Hence, we should refactor it to fix the hierarchy order.
*/
class Field_bit_as_char: public Field_bit {
class Field_bit_as_char final :public Field_bit {
public:
Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@ -5017,7 +5025,7 @@ public:
};
class Field_row: public Field_null
class Field_row final :public Field_null
{
class Virtual_tmp_table *m_table;
public:

View File

@ -975,12 +975,12 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
}
if (!quick_select)
{
(void) file->extra(HA_EXTRA_NO_CACHE); /* End cacheing of records */
(void) file->extra(HA_EXTRA_NO_CACHE); /* End caching of records */
if (!next_pos)
file->ha_rnd_end();
}
/* Signal we should use orignal column read and write maps */
/* Signal we should use original column read and write maps */
sort_form->column_bitmaps_set(save_read_set, save_write_set);
if (unlikely(thd->is_error()))
@ -2544,12 +2544,13 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item,
const SORT_FIELD_ATTR *sort_field,
Sort_param *param) const
{
CHARSET_INFO *cs= item->collation.collation;
bool maybe_null= item->maybe_null;
if (maybe_null)
*to++= 1;
String *res= item->str_result(&param->tmp_buffer);
Binary_string *res= item->str_result(&param->tmp_buffer);
if (!res)
{
if (maybe_null)
@ -2573,7 +2574,7 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item,
return sort_field->original_length;
}
}
return sort_field->pack_sort_string(to, res);
return sort_field->pack_sort_string(to, res, cs);
}
@ -2937,7 +2938,8 @@ int compare_packed_sort_keys(void *sort_param,
*/
uint
SORT_FIELD_ATTR::pack_sort_string(uchar *to, String *str) const
SORT_FIELD_ATTR::pack_sort_string(uchar *to, const Binary_string *str,
CHARSET_INFO *cs) const
{
uchar *orig_to= to;
uint32 length, data_length;
@ -2956,7 +2958,7 @@ SORT_FIELD_ATTR::pack_sort_string(uchar *to, String *str) const
memcpy(to, (uchar*)str->ptr(), data_length);
to+= data_length;
if (str->charset() == &my_charset_bin && suffix_length)
if (cs == &my_charset_bin && suffix_length)
{
// suffix length stored in bigendian form
store_bigendian(length, to, suffix_length);

View File

@ -1877,7 +1877,7 @@ int Gcalc_scan_iterator::add_eq_node(Gcalc_heap::Info *node, point *sp)
if (!en)
GCALC_DBUG_RETURN(1);
/* eq_node iserted after teh equal point. */
/* eq_node inserted after the equal point. */
en->next= node->get_next();
node->next= en;

View File

@ -362,9 +362,9 @@ enum Gcalc_scan_events
/*
Gcalc_scan_iterator incapsulates the slisescan algorithm.
It takes filled Gcalc_heap as an datasource. Then can be
iterated trought the vertexes and intersection points with
Gcalc_scan_iterator incapsulates the slicescan algorithm.
It takes filled Gcalc_heap as a datasource. Then can be
iterated through the vertexes and intersection points with
the step() method. After the 'step()' one usually observes
the current 'slice' to do the necessary calculations, like
looking for intersections, calculating the area, whatever.

View File

@ -1184,14 +1184,14 @@ int Gcalc_operation_reducer::connect_threads(
{
rp0->outer_poly= prev_range->thread_start;
tb->thread_start= prev_range->thread_start;
/* Chack if needed */
/* Check if needed */
ta->thread_start= prev_range->thread_start;
}
else
{
rp0->outer_poly= 0;
ta->thread_start= rp0;
/* Chack if needed */
/* Check if needed */
tb->thread_start= rp0;
}
GCALC_DBUG_RETURN(0);

View File

@ -1522,7 +1522,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
/**
@brief Check and repair the table if neccesary
@brief Check and repair the table if necessary
@param thd Thread object
@ -3049,7 +3049,7 @@ error:
/**
Read the .par file to get the partitions engines and names
@param name Name of table file (without extention)
@param name Name of table file (without extension)
@return Operation status
@retval true Failure
@ -3279,7 +3279,7 @@ static uchar *get_part_name(PART_NAME_DEF *part, size_t *length,
@return Operation status
@retval true Failure
@retval false Sucess
@retval false Success
*/
bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
@ -3405,7 +3405,7 @@ err:
@return Operation status
@retval true Failure
@retval false Sucess
@retval false Success
*/
bool ha_partition::set_ha_share_ref(Handler_share **ha_share_arg)
@ -4396,7 +4396,7 @@ int ha_partition::write_row(const uchar * buf)
/*
If we have failed to set the auto-increment value for this row,
it is highly likely that we will not be able to insert it into
the correct partition. We must check and fail if neccessary.
the correct partition. We must check and fail if necessary.
*/
if (unlikely(error))
goto exit;
@ -4465,7 +4465,7 @@ exit:
have the previous row record in it, while new_data will have the newest
data in it.
Keep in mind that the server can do updates based on ordering if an
ORDER BY clause was used. Consecutive ordering is not guarenteed.
ORDER BY clause was used. Consecutive ordering is not guaranteed.
Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
new_data is always record[0]
@ -4593,7 +4593,7 @@ exit:
(from either a previous rnd_xxx() or index_xxx() call).
If you keep a pointer to the last row or can access a primary key it will
make doing the deletion quite a bit easier.
Keep in mind that the server does no guarentee consecutive deletions.
Keep in mind that the server does no guarantee consecutive deletions.
ORDER BY clauses can be used.
Called in sql_acl.cc and sql_udf.cc to manage internal table information.
@ -5011,7 +5011,7 @@ int ha_partition::end_bulk_insert()
When scan is used we will scan one handler partition at a time.
When preparing for rnd_pos we will init all handler partitions.
No extra cache handling is needed when scannning is not performed.
No extra cache handling is needed when scanning is not performed.
Before initialising we will call rnd_end to ensure that we clean up from
any previous incarnation of a table scan.
@ -8714,7 +8714,7 @@ static int end_keyread_cb(handler* h, void *unused)
function after completing a query.
3) It is called when deleting the QUICK_RANGE_SELECT object if the
QUICK_RANGE_SELECT object had its own handler object. It is called
immediatley before close of this local handler object.
immediately before close of this local handler object.
HA_EXTRA_KEYREAD:
HA_EXTRA_NO_KEYREAD:
These parameters are used to provide an optimisation hint to the handler.
@ -8751,7 +8751,7 @@ static int end_keyread_cb(handler* h, void *unused)
HA_EXTRA_IGNORE_DUP_KEY:
HA_EXTRA_NO_IGNORE_DUP_KEY:
Informs the handler to we will not stop the transaction if we get an
duplicate key errors during insert/upate.
duplicate key errors during insert/update.
Always called in pair, triggered by INSERT IGNORE and other similar
SQL constructs.
Not used by MyISAM.
@ -10251,7 +10251,7 @@ bool ha_partition::prepare_inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
Non allowed changes would be catched in prep_alter_part_table().
Non allowed changes would be caought in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO)
{
@ -10287,7 +10287,7 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
Non allowed changes would be catched in prep_alter_part_table().
Non allowed changes would be caught in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO)
{
@ -10335,7 +10335,7 @@ bool ha_partition::commit_inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
Non allowed changes would be catched in prep_alter_part_table().
Non allowed changes would be caught in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO)
{

View File

@ -515,7 +515,7 @@ public:
-------------------------------------------------------------------------
MODULE create/delete handler object
-------------------------------------------------------------------------
Object create/delete methode. The normal called when a table object
Object create/delete method. Normally called when a table object
exists. There is also a method to create the handler object with only
partition information. This is used from mysql_create_table when the
table is to be created and the engine type is deduced to be the
@ -832,7 +832,7 @@ public:
/**
@breif
Positions an index cursor to the index specified in the hanlde. Fetches the
Positions an index cursor to the index specified in the handle. Fetches the
row if available. If the key value is null, begin at first key of the
index.
*/
@ -1132,7 +1132,7 @@ public:
HA_REC_NOT_IN_SEQ:
This flag is set for handlers that cannot guarantee that the rows are
returned accroding to incremental positions (0, 1, 2, 3...).
returned according to incremental positions (0, 1, 2, 3...).
This also means that rnd_next() should return HA_ERR_RECORD_DELETED
if it finds a deleted row.
(MyISAM (not fixed length row), HEAP, InnoDB)

View File

@ -804,7 +804,7 @@ int ha_end()
DBUG_ENTER("ha_end");
/*
This should be eventualy based on the graceful shutdown flag.
This should be eventually based on the graceful shutdown flag.
So if flag is equal to HA_PANIC_CLOSE, the deallocate
the errors.
*/
@ -1536,8 +1536,8 @@ int ha_commit_trans(THD *thd, bool all)
THD_TRANS *trans= all ? &thd->transaction->all : &thd->transaction->stmt;
/*
"real" is a nick name for a transaction for which a commit will
make persistent changes. E.g. a 'stmt' transaction inside a 'all'
transation is not 'real': even though it's possible to commit it,
make persistent changes. E.g. a 'stmt' transaction inside an 'all'
transaction is not 'real': even though it's possible to commit it,
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
@ -2829,7 +2829,7 @@ handler *handler::clone(const char *name, MEM_ROOT *mem_root)
/*
TODO: Implement a more efficient way to have more than one index open for
the same table instance. The ha_open call is not cachable for clone.
the same table instance. The ha_open call is not cacheable for clone.
This is not critical as the engines already have the table open
and should be able to use the original instance of the table.
@ -3731,7 +3731,7 @@ int handler::update_auto_increment()
index_init() or rnd_init() and in any column_bitmaps_signal() call after
this.
The handler is allowd to do changes to the bitmap after a index_init or
The handler is allowed to do changes to the bitmap after a index_init or
rnd_init() call is made as after this, MySQL will not use the bitmap
for any program logic checking.
*/
@ -3794,7 +3794,7 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
{ // Autoincrement at key-start
error= ha_index_last(table->record[1]);
/*
MySQL implicitely assumes such method does locking (as MySQL decides to
MySQL implicitly assumes such method does locking (as MySQL decides to
use nr+increment without checking again with the handler, in
handler::update_auto_increment()), so reserves to infinite.
*/
@ -6812,7 +6812,7 @@ int handler::check_duplicate_long_entry_key(const uchar *new_rec, uint key_no)
DBUG_ASSERT(fnc->arguments()[0]->type() == Item::FIELD_ITEM);
t_field= static_cast<Item_field *>(fnc->arguments()[0])->field;
uint length= (uint)fnc->arguments()[1]->val_int();
if (t_field->cmp_max(t_field->ptr, t_field->ptr + diff, length))
if (t_field->cmp_prefix(t_field->ptr, t_field->ptr + diff, length))
is_same= false;
}
}
@ -8306,6 +8306,7 @@ bool Table_period_info::check_field(const Create_field* f,
{
my_error(ER_PERIOD_FIELD_WRONG_ATTRIBUTES, MYF(0),
f->field_name.str, "GENERATED ALWAYS AS");
res= true;
}
return res;

View File

@ -240,7 +240,7 @@ enum chf_create_flags {
this flag must implement start_read_removal() and end_read_removal().
The handler may return "fake" rows constructed from the key of the row
asked for. This is used to optimize UPDATE and DELETE by reducing the
numer of roundtrips between handler and storage engine.
number of roundtrips between handler and storage engine.
Example:
UPDATE a=1 WHERE pk IN (<keys>)
@ -582,7 +582,7 @@ enum enum_binlog_command {
/* Bits in used_fields */
#define HA_CREATE_USED_AUTO (1UL << 0)
#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer availble
#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer available
#define HA_CREATE_USED_UNION (1UL << 2)
#define HA_CREATE_USED_INSERT_METHOD (1UL << 3)
#define HA_CREATE_USED_MIN_ROWS (1UL << 4)
@ -1242,7 +1242,7 @@ struct handler_iterator {
/*
Pointer to buffer for the iterator to use.
Should be allocated by function which created the iterator and
destroied by freed by above "destroy" call
destroyed by freed by above "destroy" call
*/
void *buffer;
};
@ -1455,7 +1455,7 @@ struct handlerton
"cookie".
The flush and call of commit_checkpoint_notify_ha() need not happen
immediately - it can be scheduled and performed asynchroneously (ie. as
immediately - it can be scheduled and performed asynchronously (ie. as
part of next prepare(), or sync every second, or whatever), but should
not be postponed indefinitely. It is however also permissible to do it
immediately, before returning from commit_checkpoint_request().
@ -1551,7 +1551,7 @@ struct handlerton
file extention. This is implied by the open_table_error()
and the default discovery implementation.
Second element - data file extention. This is implied
Second element - data file extension. This is implied
assumed by REPAIR TABLE ... USE_FRM implementation.
*/
const char **tablefile_extensions; // by default - empty list
@ -2297,7 +2297,7 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
CONVERT TO CHARACTER SET DEFAULT
to
CONVERT TO CHARACTER SET <character-set-of-the-current-database>
TODO: Should't we postpone resolution of DEFAULT until the
TODO: Shouldn't we postpone resolution of DEFAULT until the
character set of the table owner database is loaded from its db.opt?
*/
DBUG_ASSERT(cs);
@ -3093,7 +3093,7 @@ public:
ha_statistics stats;
/** MultiRangeRead-related members: */
range_seq_t mrr_iter; /* Interator to traverse the range sequence */
range_seq_t mrr_iter; /* Iterator to traverse the range sequence */
RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */
HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */
uint ranges_in_seq; /* Total number of ranges in the traversed sequence */
@ -4188,7 +4188,7 @@ public:
This method offers the storage engine, the possibility to store a reference
to a table name which is going to be used with query cache.
The method is called each time a statement is written to the cache and can
be used to verify if a specific statement is cachable. It also offers
be used to verify if a specific statement is cacheable. It also offers
the possibility to register a generic (but static) call back function which
is called each time a statement is matched against the query cache.

View File

@ -2157,14 +2157,14 @@ public:
const LEX_CSTRING &field_name_arg):
Item_ref(thd, context_arg, item, table_name_arg, field_name_arg) {}
virtual inline void print (String *str, enum_query_type query_type)
void print (String *str, enum_query_type query_type) override
{
if (ref)
(*ref)->print(str, query_type);
else
Item_ident::print(str, query_type);
}
virtual Ref_Type ref_type() { return AGGREGATE_REF; }
Ref_Type ref_type() override final { return AGGREGATE_REF; }
};
@ -5074,7 +5074,7 @@ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
@note
We have to mark all items between current_sel (including) and
last_select (excluding) as dependend (select before last_select should
last_select (excluding) as dependent (select before last_select should
be marked with actual table mask used by resolved item, all other with
OUTER_REF_TABLE_BIT) and also write dependence information to Item of
resolved identifier.
@ -5448,7 +5448,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
bool upward_lookup= FALSE;
TABLE_LIST *table_list;
/* Calulate the TABLE_LIST for the table */
/* Calculate the TABLE_LIST for the table */
table_list= (cached_table ? cached_table :
field_found && (*from_field) != view_ref_found ?
(*from_field)->table->pos_in_table_list : 0);
@ -6184,7 +6184,7 @@ Item *Item_field::propagate_equal_fields(THD *thd,
but failed to create a valid DATE literal from the given string literal.
Do not do constant propagation in such cases and unlink
"this" from the found Item_equal (as this equality not usefull).
"this" from the found Item_equal (as this equality not useful).
*/
item_equal= NULL;
return this;
@ -7906,7 +7906,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
/*
Due to cache, find_field_in_tables() can return field which
doesn't belong to provided outer_context. In this case we have
to find proper field context in order to fix field correcly.
to find proper field context in order to fix field correctly.
*/
do
{
@ -8091,9 +8091,9 @@ Item* Item_ref::transform(THD *thd, Item_transformer transformer, uchar *arg)
callback functions.
First the function applies the analyzer to the Item_ref object. Then
if the analizer succeeeds we first applies the compile method to the
if the analyzer succeeds we first apply the compile method to the
object the Item_ref object is referencing. If this returns a new
item the old item is substituted for a new one. After this the
item the old item is substituted for a new one. After this the
transformer is applied to the Item_ref object itself.
The compile function is not called if the analyzer returns NULL
in the parameter arg_p.

View File

@ -164,7 +164,7 @@ void dummy_error_processor(THD *thd, void *data);
void view_error_processor(THD *thd, void *data);
/*
Instances of Name_resolution_context store the information necesary for
Instances of Name_resolution_context store the information necessary for
name resolution of Items and other context analysis of a query made in
fix_fields().
@ -344,7 +344,7 @@ public:
Monotonicity is defined only for Item* trees that represent table
partitioning expressions (i.e. have no subselects/user vars/PS parameters
etc etc). An Item* tree is assumed to have the same monotonicity properties
as its correspoinding function F:
as its corresponding function F:
[signed] longlong F(field1, field2, ...) {
put values of field_i into table record buffer;
@ -1153,7 +1153,7 @@ public:
/*
real_type() is the type of base item. This is same as type() for
most items, except Item_ref() and Item_cache_wrapper() where it
shows the type for the underlaying item.
shows the type for the underlying item.
*/
virtual enum Type real_type() const { return type(); }
@ -1299,7 +1299,7 @@ public:
The caller can modify the returned String, if it's not marked
"const" (with the String::mark_as_const() method). That means that
if the item returns its own internal buffer (e.g. tmp_value), it
*must* be marked "const" [1]. So normally it's preferrable to
*must* be marked "const" [1]. So normally it's preferable to
return the result value in the String, that was passed as an
argument. But, for example, SUBSTR() returns a String that simply
points into the buffer of SUBSTR()'s args[0]->val_str(). Such a
@ -1775,7 +1775,7 @@ public:
@param cond_ptr[OUT] Store a replacement item here if the condition
can be simplified, e.g.:
WHERE part1 OR part2 OR part3
with one of the partN evalutating to SEL_TREE::ALWAYS.
with one of the partN evaluating to SEL_TREE::ALWAYS.
*/
virtual SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
/*
@ -2369,8 +2369,9 @@ public:
virtual bool is_outer_field() const { DBUG_ASSERT(is_fixed()); return FALSE; }
/**
Checks if this item or any of its decendents contains a subquery. This is a
replacement of the former Item::has_subquery() and Item::with_subselect.
Checks if this item or any of its descendents contains a subquery.
This is a replacement of the former Item::has_subquery() and
Item::with_subselect.
*/
virtual bool with_subquery() const { DBUG_ASSERT(is_fixed()); return false; }
@ -6061,7 +6062,7 @@ public:
This is the method that updates the cached value.
It must be explicitly called by the user of this class to store the value
of the orginal item in the cache.
of the original item in the cache.
*/
virtual void copy() = 0;

View File

@ -192,7 +192,7 @@ bool Cached_item_field::cmp(void)
/*
If value is not null and value changed (from null to not null or
becasue of value change), then copy the new value to buffer.
because of value change), then copy the new value to buffer.
*/
if (! null_value && (tmp || (tmp= (field->cmp(buff) != 0))))
field->get_image(buff,length,field->charset());

View File

@ -1404,7 +1404,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
@note
Item_in_optimizer should work as pass-through for
- subqueries that were processed by ALL/ANY->MIN/MAX rewrite
- subqueries taht were originally EXISTS subqueries (and were coverted by
- subqueries that were originally EXISTS subqueries (and were coinverted by
the EXISTS->IN rewrite)
When Item_in_optimizer is not not working as a pass-through, it
@ -1991,8 +1991,8 @@ longlong Item_func_interval::val_int()
interval_range *range= intervals + mid;
my_bool cmp_result;
/*
The values in the range intervall may have different types,
Only do a decimal comparision of the first argument is a decimal
The values in the range interval may have different types,
Only do a decimal comparison if the first argument is a decimal
and we are comparing against a decimal
*/
if (dec && range->type == DECIMAL_RESULT)
@ -2634,7 +2634,7 @@ Item_func_nullif::fix_length_and_dec()
Some examples of what NULLIF can end up with after argument
substitution (we don't mention args[1] in some cases for simplicity):
1. l_expr is not an aggragate function:
1. l_expr is not an aggregate function:
a. No conversion happened.
args[0] and args[2] were not replaced to something else
@ -2758,7 +2758,7 @@ Item_func_nullif::fix_length_and_dec()
In this case we remember and reuse m_arg0 during EXECUTE time as args[2].
QQ: How to make sure that m_args0 does not point
to something temporary which will be destoyed between PREPARE and EXECUTE.
to something temporary which will be destroyed between PREPARE and EXECUTE.
The condition below should probably be more strict and somehow check that:
- change_item_tree() was called for the new args[0]
- m_args0 is referenced from inside args[0], e.g. as a function argument,
@ -7301,7 +7301,7 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item)
and not ot2.col.
eliminate_item_equal() also has code that deals with equality substitution
in presense of SJM nests.
in presence of SJM nests.
*/
TABLE_LIST *emb_nest;

View File

@ -178,7 +178,7 @@ protected:
/*
Return the full select tree for "field_item" and "value":
- a single SEL_TREE if the field is not in a multiple equality, or
- a conjuction of all SEL_TREEs for all fields from
- a conjunction of all SEL_TREEs for all fields from
the same multiple equality with "field_item".
*/
SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
@ -744,7 +744,7 @@ public:
{ return get_item_copy<Item_func_eq>(thd, this); }
};
class Item_func_equal :public Item_bool_rowready_func2
class Item_func_equal final :public Item_bool_rowready_func2
{
public:
Item_func_equal(THD *thd, Item *a, Item *b):
@ -3331,7 +3331,7 @@ public:
};
class Item_cond_and :public Item_cond
class Item_cond_and final :public Item_cond
{
public:
COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for
@ -3368,7 +3368,7 @@ inline bool is_cond_and(Item *item)
return func_item && func_item->functype() == Item_func::COND_AND_FUNC;
}
class Item_cond_or :public Item_cond
class Item_cond_or final :public Item_cond
{
public:
Item_cond_or(THD *thd): Item_cond(thd) {}

View File

@ -525,7 +525,7 @@ Item *Item_func::transform(THD *thd, Item_transformer transformer, uchar *argume
callback functions.
First the function applies the analyzer to the root node of
the Item_func object. Then if the analizer succeeeds (returns TRUE)
the Item_func object. Then if the analyzer succeeds (returns TRUE)
the function recursively applies the compile method to each argument
of the Item_func node.
If the call of the method for an argument item returns a new item
@ -1493,13 +1493,14 @@ double Item_func_div::real_op()
my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
{
int err;
my_decimal tmp;
VDec2_lazy val(args[0], args[1]);
if ((null_value= val.has_null()))
return 0;
if ((err= check_decimal_overflow(my_decimal_div(E_DEC_FATAL_ERROR &
~E_DEC_OVERFLOW &
~E_DEC_DIV_ZERO,
decimal_value,
&tmp,
val.m_a.ptr(), val.m_b.ptr(),
prec_increment))) > 3)
{
@ -1508,6 +1509,7 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
null_value= 1;
return 0;
}
tmp.round_to(decimal_value, decimals, HALF_UP);
return decimal_value;
}
@ -1564,7 +1566,7 @@ bool Item_func_div::fix_length_and_dec()
DBUG_ENTER("Item_func_div::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
prec_increment= current_thd->variables.div_precincrement;
maybe_null= 1; // devision by zero
maybe_null= 1; // division by zero
const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div;
DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_non_commutative_test;);
@ -2516,6 +2518,20 @@ void Item_func_round::fix_arg_datetime()
}
bool Item_func_round::test_if_length_can_increase()
{
if (truncate)
return false;
if (args[1]->const_item() && !args[1]->is_expensive())
{
// Length can increase in some cases: e.g. ROUND(9,-1) -> 10.
Longlong_hybrid val1= args[1]->to_longlong_hybrid();
return !args[1]->null_value && val1.neg();
}
return true; // ROUND(x,n), where n is not a constant.
}
/**
Calculate data type and attributes for INT-alike input.
@ -2534,52 +2550,41 @@ void Item_func_round::fix_arg_datetime()
simple cases.
*/
void Item_func_round::fix_arg_int(const Type_handler *preferred,
const Type_std_attributes *preferred_attrs)
const Type_std_attributes *preferred_attrs,
bool use_decimal_on_length_increase)
{
DBUG_ASSERT(args[0]->decimals == 0);
if (args[1]->const_item())
Type_std_attributes::set(preferred_attrs);
if (!test_if_length_can_increase())
{
Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if (args[1]->null_value)
fix_length_and_dec_double(NOT_FIXED_DEC);
else if ((!val1.to_uint(DECIMAL_MAX_SCALE) && truncate) ||
args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS)
{
// Here we can keep INT_RESULT
// Length can increase in some cases: ROUND(9,-1) -> 10
int length_can_increase= MY_TEST(!truncate && val1.neg());
if (preferred)
{
Type_std_attributes::set(preferred_attrs);
if (!length_can_increase)
{
// Preserve the exact data type and attributes
set_handler(preferred);
}
else
{
max_length++;
set_handler(type_handler_long_or_longlong());
}
}
else
{
/*
This branch is currently used for hex hybrid only.
It's known to be unsigned. So sign length is 0.
*/
DBUG_ASSERT(args[0]->unsigned_flag); // no needs to add sign length
max_length= args[0]->decimal_precision() + length_can_increase;
unsigned_flag= true;
decimals= 0;
set_handler(type_handler_long_or_longlong());
}
}
else
fix_length_and_dec_decimal(val1.to_uint(DECIMAL_MAX_SCALE));
// Preserve the exact data type and attributes
set_handler(preferred);
}
else
fix_length_and_dec_double(args[0]->decimals);
{
max_length++;
if (use_decimal_on_length_increase)
set_handler(&type_handler_newdecimal);
else
set_handler(type_handler_long_or_longlong());
}
}
void Item_func_round::fix_arg_hex_hybrid()
{
DBUG_ASSERT(args[0]->decimals == 0);
DBUG_ASSERT(args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS);
DBUG_ASSERT(args[0]->unsigned_flag); // no needs to add sign length
bool length_can_increase= test_if_length_can_increase();
max_length= args[0]->decimal_precision() + MY_TEST(length_can_increase);
unsigned_flag= true;
decimals= 0;
if (length_can_increase && args[0]->max_length >= 8)
set_handler(&type_handler_newdecimal);
else
set_handler(type_handler_long_or_longlong());
}
@ -4812,7 +4817,7 @@ bool Item_func_set_user_var::register_field_in_bitmap(void *arg)
@param type type of new value
@param cs charset info for new value
@param dv derivation for new value
@param unsigned_arg indiates if a value of type INT_RESULT is unsigned
@param unsigned_arg indicates if a value of type INT_RESULT is unsigned
@note Sets error and fatal error if allocation fails.
@ -6750,7 +6755,7 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
/*
Here we check privileges of the stored routine only during view
creation, in order to validate the view. A runtime check is
perfomed in Item_func_sp::execute(), and this method is not
performed in Item_func_sp::execute(), and this method is not
called during context analysis. Notice, that during view
creation we do not infer into stored routine bodies and do not
check privileges of its statements, which would probably be a

View File

@ -1897,6 +1897,7 @@ class Item_func_round :public Item_func_hybrid_field_type
bool truncate;
void fix_length_and_dec_decimal(uint decimals_to_set);
void fix_length_and_dec_double(uint decimals_to_set);
bool test_if_length_can_increase();
public:
Item_func_round(THD *thd, Item *a, Item *b, bool trunc_arg)
:Item_func_hybrid_field_type(thd, a, b), truncate(trunc_arg) {}
@ -1918,7 +1919,9 @@ public:
}
void fix_arg_decimal();
void fix_arg_int(const Type_handler *preferred,
const Type_std_attributes *preferred_attributes);
const Type_std_attributes *preferred_attributes,
bool use_decimal_on_length_increase);
void fix_arg_hex_hybrid();
void fix_arg_double();
void fix_arg_time();
void fix_arg_datetime();

View File

@ -984,7 +984,7 @@ String *Item_func_concat_ws::val_str(String *str)
goto null; // Must be a blob
}
else if (res2 == &tmp_value)
{ // This can happend only 1 time
{ // This can happen only 1 time
if (tmp_value.replace(0,0,*sep_str) || tmp_value.replace(0,0,*res))
goto null;
res= &tmp_value;
@ -1134,7 +1134,7 @@ bool Item_func_reverse::fix_length_and_dec()
}
/**
Replace all occurences of string2 in string1 with string3.
Replace all occurrences of string2 in string1 with string3.
Don't reallocate val_str() if not needed.
@ -3979,7 +3979,7 @@ bool Item_func_export_set::fix_length_and_dec()
using in a SQL statement.
Adds a \\ before all characters that needs to be escaped in a SQL string.
We also escape '^Z' (END-OF-FILE in windows) to avoid probelms when
We also escape '^Z' (END-OF-FILE in windows) to avoid problems when
running commands from a file in windows.
This function is very useful when you want to generate SQL statements.

View File

@ -1171,12 +1171,12 @@ void Item_singlerow_subselect::reset()
/**
@todo
- We cant change name of Item_field or Item_ref, because it will
prevent it's correct resolving, but we should save name of
- We can't change name of Item_field or Item_ref, because it will
prevent its correct resolving, but we should save name of
removed item => we do not make optimization if top item of
list is field or reference.
- switch off this optimization for prepare statement,
because we do not rollback this changes.
because we do not rollback these changes.
Make rollback for it, or special name resolving mode in 5.0.
@param join Join object of the subquery (i.e. 'child' join).
@ -1199,8 +1199,8 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
select_lex->item_list.elements == 1 &&
!select_lex->item_list.head()->with_sum_func() &&
/*
We cant change name of Item_field or Item_ref, because it will
prevent it's correct resolving, but we should save name of
We can't change name of Item_field or Item_ref, because it will
prevent its correct resolving, but we should save name of
removed item => we do not make optimization if top item of
list is field or reference.
TODO: solve above problem
@ -1698,7 +1698,7 @@ longlong Item_exists_subselect::val_int()
Return the result of EXISTS as a string value
Converts the true/false result into a string value.
Note that currently this cannot be NULL, so if the query exection fails
Note that currently this cannot be NULL, so if the query execution fails
it will return 0.
@param decimal_value[out] buffer to hold the resulting string value
@ -1721,7 +1721,7 @@ String *Item_exists_subselect::val_str(String *str)
Return the result of EXISTS as a decimal value
Converts the true/false result into a decimal value.
Note that currently this cannot be NULL, so if the query exection fails
Note that currently this cannot be NULL, so if the query execution fails
it will return 0.
@param decimal_value[out] Buffer to hold the resulting decimal value
@ -2419,7 +2419,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
is_not_null_test(v3))
where is_not_null_test registers NULLs values but reject rows.
in case when we do not need correct NULL, we have simplier construction:
in case when we do not need correct NULL, we have simpler construction:
EXISTS (SELECT ... WHERE where and
(l1 = v1) and
(l2 = v2) and
@ -2822,6 +2822,8 @@ bool Item_exists_subselect::select_prepare_to_be_in()
Check if 'func' is an equality in form "inner_table.column = outer_expr"
@param func Expression to check
@param allow_subselect If true, the outer_expr part can have a subquery
If false, it cannot.
@param local_field OUT Return "inner_table.column" here
@param outer_expr OUT Return outer_expr here
@ -2829,6 +2831,7 @@ bool Item_exists_subselect::select_prepare_to_be_in()
*/
static bool check_equality_for_exist2in(Item_func *func,
bool allow_subselect,
Item_ident **local_field,
Item **outer_exp)
{
@ -2839,7 +2842,8 @@ static bool check_equality_for_exist2in(Item_func *func,
args= func->arguments();
if (args[0]->real_type() == Item::FIELD_ITEM &&
args[0]->all_used_tables() != OUTER_REF_TABLE_BIT &&
args[1]->all_used_tables() == OUTER_REF_TABLE_BIT)
args[1]->all_used_tables() == OUTER_REF_TABLE_BIT &&
(allow_subselect || !args[1]->with_subquery()))
{
/* It is Item_field or Item_direct_view_ref) */
DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM ||
@ -2850,7 +2854,8 @@ static bool check_equality_for_exist2in(Item_func *func,
}
else if (args[1]->real_type() == Item::FIELD_ITEM &&
args[1]->all_used_tables() != OUTER_REF_TABLE_BIT &&
args[0]->all_used_tables() == OUTER_REF_TABLE_BIT)
args[0]->all_used_tables() == OUTER_REF_TABLE_BIT &&
(allow_subselect || !args[0]->with_subquery()))
{
/* It is Item_field or Item_direct_view_ref) */
DBUG_ASSERT(args[1]->type() == Item::FIELD_ITEM ||
@ -2879,6 +2884,13 @@ typedef struct st_eq_field_outer
outer1=inner_tbl1.col1 AND ... AND outer2=inner_tbl1.col2 AND remainder_cond
if there is just one outer_expr=inner_expr pair, then outer_expr can have a
subselect in it. If there are many such pairs, then none of outer_expr can
have a subselect in it. If we allow this, the query will fail with an error:
This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left
expression of IN/ALL/ANY'
@param conds Condition to be checked
@parm result Array to collect EQ_FIELD_OUTER elements describing
inner-vs-outer equalities the function has found.
@ -2896,14 +2908,17 @@ static bool find_inner_outer_equalities(Item **conds,
{
List_iterator<Item> li(*((Item_cond*)*conds)->argument_list());
Item *item;
bool allow_subselect= true;
while ((item= li++))
{
if (item->type() == Item::FUNC_ITEM &&
check_equality_for_exist2in((Item_func *)item,
allow_subselect,
&element.local_field,
&element.outer_exp))
{
found= TRUE;
allow_subselect= false;
element.eq_ref= li.ref();
if (result.append(element))
goto alloc_err;
@ -2912,6 +2927,7 @@ static bool find_inner_outer_equalities(Item **conds,
}
else if ((*conds)->type() == Item::FUNC_ITEM &&
check_equality_for_exist2in((Item_func *)*conds,
true,
&element.local_field,
&element.outer_exp))
{
@ -3278,7 +3294,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
/*
In some optimisation cases we will not need this Item_in_optimizer
object, but we can't know it here, but here we need address correct
reference on left expresion.
reference on left expression.
note: we won't need Item_in_optimizer when handling degenerate cases
like "... IN (SELECT 1)"
@ -3310,7 +3326,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
and all that items do not make permanent changes in current item arena
which allow to us call them with changed arena (if we do not know nature
of Item, we have to call fix_fields() for it only with original arena to
avoid memory leack)
avoid memory leak)
*/
if (left_expr->cols() == 1)
trans_res= single_value_transformer(join);
@ -3473,7 +3489,7 @@ bool Item_in_subselect::setup_mat_engine()
/*
The select_engine (that executes transformed IN=>EXISTS subselects) is
pre-created at parse time, and is stored in statment memory (preserved
pre-created at parse time, and is stored in statement memory (preserved
across PS executions).
*/
DBUG_ASSERT(engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE);
@ -3941,7 +3957,7 @@ int subselect_single_select_engine::exec()
For at least one of the pushed predicates the following is true:
We should not apply optimizations based on the condition that was
pushed down into the subquery. Those optimizations are ref[_or_null]
acceses. Change them to be full table scans.
accesses. Change them to be full table scans.
*/
JOIN_TAB *tab;
for (tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
@ -6177,7 +6193,7 @@ int subselect_partial_match_engine::exec()
if (has_covering_null_row)
{
/*
If there is a NULL-only row that coveres all columns the result of IN
If there is a NULL-only row that covers all columns the result of IN
is UNKNOWN.
*/
item_in->value= 0;
@ -6373,7 +6389,7 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
for (uint i= (non_null_key ? 1 : 0); i < merge_keys_count; i++)
{
/*
Check if the first and only indexed column contains NULL in the curent
Check if the first and only indexed column contains NULL in the current
row, and add the row number to the corresponding key.
*/
if (merge_keys[i]->get_field(0)->is_null())
@ -6585,7 +6601,7 @@ bool subselect_rowid_merge_engine::partial_match()
}
/*
If all nullable columns contain only NULLs, then there is a guranteed
If all nullable columns contain only NULLs, then there is a guaranteed
partial match, and we don't need to search for a matching row.
*/
if (has_covering_null_columns)

Some files were not shown because too many files have changed in this diff Show More