diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index d3c244b277a..1dcbca88a7b 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -364,5 +364,16 @@ hex(col) DROP TABLE t2; DROP TABLE t1; # +# MDEV-29782 CONNECT engine converted YEAR to DATETIME, causing INSERT to fail +# +CREATE TABLE t1 (id year); +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; +INSERT INTO t2 VALUES (1999); +SELECT * FROM t2; +id +1999 +DROP TABLE t2; +DROP TABLE t1; +# # End of 10.3 tests # diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test index a50db4a6457..cd52f78fb30 100644 --- a/storage/connect/mysql-test/connect/t/mysql.test +++ b/storage/connect/mysql-test/connect/t/mysql.test @@ -533,6 +533,21 @@ DROP TABLE t2; DROP TABLE t1; +--echo # +--echo # MDEV-29782 CONNECT engine converted YEAR to DATETIME, causing INSERT to fail +--echo # + +CREATE TABLE t1 (id year); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' + +INSERT INTO t2 VALUES (1999); +SELECT * FROM t2; + +DROP TABLE t2; +DROP TABLE t1; + --echo # --echo # End of 10.3 tests --echo # diff --git a/storage/connect/myutil.cpp b/storage/connect/myutil.cpp index c49db48bfb3..45b2c46e217 100644 --- a/storage/connect/myutil.cpp +++ b/storage/connect/myutil.cpp @@ -183,6 +183,7 @@ int MYSQLtoPLG(int mytype, char *var) switch (mytype) { case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: type = TYPE_SHORT; break; case MYSQL_TYPE_LONG: @@ -209,7 +210,6 @@ int MYSQLtoPLG(int mytype, char *var) case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_YEAR: case MYSQL_TYPE_TIME: type = TYPE_DATE; break;