mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-29782 CONNECT YEAR type conversion fix
When using the MySQL table type the CONNECT engine converted the YEAR datatype to DATETIME for INSERT queries. This is incorrect, causing an error on the INSERT. It should be SHORT instead.
This commit is contained in:
parent
476b24d084
commit
358635bbad
3 changed files with 27 additions and 1 deletions
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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 #
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue