summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-10-31 18:28:33 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2018-10-31 18:28:33 +0200
commite16d91b889c3307ff1512d20221082e78cc8fcc0 (patch)
tree6c3051daec6c85cd8262976fc3e0f2307d969f9d
parentd6ee7ab1a1cec0143e66f3ac75d8cee7c60f69b0 (diff)
downloadmariadb-git-e16d91b889c3307ff1512d20221082e78cc8fcc0.tar.gz
Fix merge error on tests.
-rw-r--r--mysql-test/t/alter_table.test81
-rw-r--r--mysql-test/t/grant.test38
-rw-r--r--mysql-test/t/type_float.test41
3 files changed, 82 insertions, 78 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 30300efb34e..aea1a880a81 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -287,7 +287,7 @@ drop table t1;
#
set names koi8r;
create table t1 (a char(10) character set koi8r);
-insert into t1 values ('����');
+insert into t1 values ('ÔÅÓÔ');
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
@@ -367,7 +367,7 @@ DROP TABLE T12207;
# modified. In other words, the values were reinterpreted
# as UTF8 instead of being converted.
create table t1 (a text) character set koi8r;
-insert into t1 values (_koi8r'����');
+insert into t1 values (_koi8r'ÔÅÓÔ');
select hex(a) from t1;
alter table t1 convert to character set cp1251;
select hex(a) from t1;
@@ -1346,52 +1346,55 @@ DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
+#
+# Test of ALTER TABLE IF [NOT] EXISTS
+#
-SET GLOBAL max_allowed_packet=17825792;
-
---connect(con1, localhost, root,,)
-CREATE TABLE t1 (t1_fld1 TEXT);
-CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
-CREATE TABLE t3 (t3_fld1 LONGTEXT);
-
-INSERT INTO t1 VALUES (REPEAT('a',300));
-INSERT INTO t2 VALUES (REPEAT('b',65680));
-INSERT INTO t3 VALUES (REPEAT('c',16777300));
+CREATE TABLE t1 (
+ id INT(11) NOT NULL,
+ x_param INT(11) DEFAULT NULL,
+ PRIMARY KEY (id)
+) ENGINE=MYISAM;
-SELECT LENGTH(t1_fld1) FROM t1;
-SELECT LENGTH(t2_fld1) FROM t2;
-SELECT LENGTH(t3_fld1) FROM t3;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
+ ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
---echo # With strict mode
-SET SQL_MODE='STRICT_ALL_TABLES';
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 MODIFY IF EXISTS lol INT;
---error ER_DATA_TOO_LONG
-ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
---error ER_DATA_TOO_LONG
-ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
---error ER_DATA_TOO_LONG
-ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
-
---echo # With non-strict mode
-SET SQL_MODE='';
+DROP INDEX IF EXISTS x_param ON t1;
+DROP INDEX IF EXISTS x_param ON t1;
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
-ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
-ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
-ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
+CREATE TABLE t1 (
+ id INT(11) NOT NULL,
+ x_param INT(11) DEFAULT NULL,
+ PRIMARY KEY (id)
+) ENGINE=INNODB;
-SELECT LENGTH(my_t1_fld1) FROM t1;
-SELECT LENGTH(my_t2_fld1) FROM t2;
-SELECT LENGTH(my_t3_fld1) FROM t3;
+CREATE TABLE t2 (
+ id INT(11) NOT NULL) ENGINE=INNODB;
-# Cleanup
---disconnect con1
---source include/wait_until_disconnected.inc
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
+ ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
---connection default
-DROP TABLE t1, t2, t3;
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 MODIFY IF EXISTS lol INT;
-SET SQL_MODE=default;
-SET GLOBAL max_allowed_packet=default;
+DROP INDEX IF EXISTS x_param ON t1;
+DROP INDEX IF EXISTS x_param ON t1;
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
SHOW CREATE TABLE t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index b96f8033be5..f2dfb01cc39 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -210,26 +210,26 @@ drop user mysqltest_1@localhost;
# Bug#3403 Wrong encoding in SHOW GRANTS output
#
SET NAMES koi8r;
-CREATE DATABASE ��;
-USE ��;
-CREATE TABLE ��� (��� INT);
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ INT);
-GRANT SELECT ON ��.* TO ����@localhost;
-SHOW GRANTS FOR ����@localhost;
-REVOKE SELECT ON ��.* FROM ����@localhost;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
-GRANT SELECT ON ��.��� TO ����@localhost;
-SHOW GRANTS FOR ����@localhost;
-REVOKE SELECT ON ��.��� FROM ����@localhost;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
-GRANT SELECT (���) ON ��.��� TO ����@localhost;
-SHOW GRANTS FOR ����@localhost;
-REVOKE SELECT (���) ON ��.��� FROM ����@localhost;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
# Revoke does not drop user. Leave a clean user table for the next tests.
-DROP USER ����@localhost;
+DROP USER ÀÚÅÒ@localhost;
-DROP DATABASE ��;
+DROP DATABASE ÂÄ;
SET NAMES latin1;
#
@@ -512,14 +512,14 @@ set @user123="non-existent";
select * from mysql.db where user=@user123;
set names koi8r;
-create database ��;
-grant select on ��.* to root@localhost;
-select hex(Db) from mysql.db where Db='��';
+create database ÂÄ;
+grant select on ÂÄ.* to root@localhost;
+select hex(Db) from mysql.db where Db='ÂÄ';
show grants for root@localhost;
flush privileges;
show grants for root@localhost;
-drop database ��;
-revoke all privileges on ��.* from root@localhost;
+drop database ÂÄ;
+revoke all privileges on ÂÄ.* from root@localhost;
show grants for root@localhost;
set names latin1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index ebed9550afe..5dfb4a75bb3 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -363,32 +363,33 @@ DROP TABLE t1;
--echo #
---echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
+--echo # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265
+--echo # (WARN_DATA_TRUNCATED)
--echo #
-SELECT LEFT('a',EXP(50));
-SELECT LEFT('a', COALESCE(1e30));
-
-CREATE TABLE t1 (a FLOAT);
-INSERT INTO t1 VALUES (1e30);
-SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
+CREATE TABLE t1 (f FLOAT);
+INSERT INTO t1 VALUES ('1.');
+INSERT INTO t1 VALUES ('2.0.');
+INSERT INTO t1 VALUES ('.');
+SELECT * FROM t1 ORDER BY f;
DROP TABLE t1;
-PREPARE stmt FROM 'SELECT LEFT(111,?)';
-SET @a=1e30;
-EXECUTE stmt USING @a;
-DEALLOCATE PREPARE stmt;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
-DROP TABLE t1;
+--echo #
+--echo # Start of 10.0 tests
+--echo #
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES (1e30),(0);
-SELECT LEFT('a', SUM(a)) FROM t1;
-SELECT LEFT('a', AVG(a)) FROM t1;
-DROP TABLE t1;
+--echo #
+--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
+--echo #
+CREATE TABLE t1 (a DATETIME PRIMARY KEY);
+INSERT INTO t1 VALUES ('1999-01-01 00:00:00');
+CREATE TABLE t2 (a DOUBLE);
+INSERT INTO t2 VALUES (19990101000000);
+INSERT INTO t2 VALUES (990101000000);
+SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
+SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
+ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
--echo # t2 should NOT be eliminated