diff options
Diffstat (limited to 'storage/connect/mysql-test')
5 files changed, 69 insertions, 6 deletions
diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 83c2bc0abb5..918256ac395 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -304,5 +304,27 @@ INSERT INTO t2 VALUES (10),(20),(30),(40); DROP TABLE t2; DROP TABLE t1; # +# MDEV-28533 CONNECT engine does not quote columns involved in WHERE clause +# +CREATE TABLE t1 (id int, `spaced col` varchar(10),`nospace` varchar(10)); +insert into t1 values (1,1,'x1'),(2,'C-003','x2'); +SELECT * from t1; +id spaced col nospace +1 1 x1 +2 C-003 x2 +CREATE TABLE t2 (id int, `spaced col` varchar(10), `nospace` varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; +SELECT * from t2; +id spaced col nospace +1 1 x1 +2 C-003 x2 +SELECT `id` FROM t2 WHERE t2.`nospace` = 'x1'; +id +1 +SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003'; +id +2 +DROP TABLE t1; +DROP TABLE t2; +# # End of 10.3 tests # diff --git a/storage/connect/mysql-test/connect/r/odbc_postgresql.result b/storage/connect/mysql-test/connect/r/odbc_postgresql.result index dc23dbdb990..fd23197c37f 100644 --- a/storage/connect/mysql-test/connect/r/odbc_postgresql.result +++ b/storage/connect/mysql-test/connect/r/odbc_postgresql.result @@ -17,6 +17,7 @@ mtr public t2 TABLE mtr public v1 VIEW mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in all schemas @@ -28,6 +29,7 @@ mtr public t2 TABLE mtr public v1 VIEW mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in all schemas @@ -39,6 +41,7 @@ mtr public t2 TABLE mtr public v1 VIEW mtr schema1 t1 TABLE mtr schema1 t2 TABLE +mtr schema1 t3 TABLE mtr schema1 v1 VIEW DROP TABLE t1; # All tables in the default schema ("public") @@ -101,6 +104,8 @@ mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 b 1 bpchar 10 40 NULL NULL 0 mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All columns in the schemas "public" and "schema1" @@ -112,6 +117,8 @@ mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t3 b 1 bpchar 10 40 NULL NULL 0 mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All tables "t1" in all schemas @@ -195,7 +202,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t1' `DATA_CHARSET`='utf8' SELECT * FROM t1; a aaa @@ -206,7 +213,7 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 NOT NULL + `a` char(10) CHARACTER SET utf8mb3 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -230,7 +237,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.v1' `DATA_CHARSET`='utf8' SELECT * FROM t1; a aaa @@ -241,7 +248,7 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 DEFAULT NULL + `a` char(10) CHARACTER SET utf8mb3 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -265,7 +272,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8' +) ENGINE=CONNECT DEFAULT CHARSET=utf8mb3 CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='schema1.t2' `DATA_CHARSET`='utf8' SELECT * FROM t1; a xxx @@ -276,7 +283,7 @@ CREATE TABLE t2 AS SELECT * FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` char(10) CHARACTER SET utf8 NOT NULL + `a` char(10) CHARACTER SET utf8mb3 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -294,3 +301,8 @@ zzz ÄÖÜ DROP VIEW v1; DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +DELETE FROM t1 WHERE a='20'; +Warnings: +Note 1105 schema1.t3: 0 affected rows +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test index 451de29c0b0..ce76a4665d5 100644 --- a/storage/connect/mysql-test/connect/t/mysql.test +++ b/storage/connect/mysql-test/connect/t/mysql.test @@ -484,5 +484,25 @@ DROP TABLE t2; DROP TABLE t1; --echo # +--echo # MDEV-28533 CONNECT engine does not quote columns involved in WHERE clause +--echo # + +CREATE TABLE t1 (id int, `spaced col` varchar(10),`nospace` varchar(10)); +insert into t1 values (1,1,'x1'),(2,'C-003','x2'); + +SELECT * from t1; + +--replace_result $PORT PORT +--eval CREATE TABLE t2 (id int, `spaced col` varchar(10), `nospace` varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' + +SELECT * from t2; +SELECT `id` FROM t2 WHERE t2.`nospace` = 'x1'; +SELECT `id` FROM t2 WHERE t2.`spaced col` = 'C-003'; + + +DROP TABLE t1; +DROP TABLE t2; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/storage/connect/mysql-test/connect/t/odbc_postgresql.sql b/storage/connect/mysql-test/connect/t/odbc_postgresql.sql index 1c302294393..a795817a4d3 100644 --- a/storage/connect/mysql-test/connect/t/odbc_postgresql.sql +++ b/storage/connect/mysql-test/connect/t/odbc_postgresql.sql @@ -25,3 +25,6 @@ INSERT INTO schema1.t1 VALUES ('aaa'),('bbb'),('ccc'),('яяя'); CREATE VIEW schema1.v1 AS SELECT * FROM schema1.t1; CREATE TABLE schema1.t2 (a CHAR(10) NOT NULL); INSERT INTO schema1.t2 VALUES ('xxx'),('yyy'),('zzz'),('ÄÖÜ'); +CREATE TABLE schema1.t3 (a CHAR(10) NOT NULL, b CHAR(10) NOT NULL); +INSERT INTO schema1.t3 VALUES ('xxx', 'aaa'),('yyy', 'bbb'),('zzz', 'ccc'),('ÄÖÜ', 'яяя'); + diff --git a/storage/connect/mysql-test/connect/t/odbc_postgresql.test b/storage/connect/mysql-test/connect/t/odbc_postgresql.test index 7fc16130713..86597423d04 100644 --- a/storage/connect/mysql-test/connect/t/odbc_postgresql.test +++ b/storage/connect/mysql-test/connect/t/odbc_postgresql.test @@ -205,3 +205,9 @@ CREATE VIEW v1 AS SELECT * FROM t1; SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +# MDEV-25767 DELETE with WHERE condition crashes when two columns used for +# pkey +CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr'; +DELETE FROM t1 WHERE a='20'; +DROP TABLE t1; |