diff --git a/dbcon/ddlpackageproc/ddlpackageprocessor.h b/dbcon/ddlpackageproc/ddlpackageprocessor.h index f43aa2c68..6b3ccdf07 100644 --- a/dbcon/ddlpackageproc/ddlpackageprocessor.h +++ b/dbcon/ddlpackageproc/ddlpackageprocessor.h @@ -196,42 +196,6 @@ class DDLPackageProcessor int spare : 6; Date( ) { year = 0; month = 0; day = 0; spare = 0;} }; */ - /** @brief a structure to hold a datetime - */ - struct dateTime - { - unsigned msecond : 20; - unsigned second : 6; - unsigned minute : 6; - unsigned hour : 6; - unsigned day : 6; - unsigned month : 4; - unsigned year : 16; - // NULL column value = 0xFFFFFFFFFFFFFFFE - EXPORT dateTime() - { - year = 0xFFFF; - month = 0xF; - day = 0x3F; - hour = 0x3F; - minute = 0x3F; - second = 0x3F; - msecond = 0xFFFFE; - } - }; - /* - struct dateTime - { - int year : 16; - int month : 4; - int day : 6; - int hour : 6; - int minute : 6; - int second : 6; - int msecond : 20; - dateTime( ) { year = 0; month = 0; day = 0; hour = 0; minute = 0; second = 0; msecond = 0; } - } - ; */ /** @brief a vector of dictionary object ids */ typedef std::vector DictionaryOIDList; diff --git a/dbcon/dmlpackageproc/dmlpackageprocessor.h b/dbcon/dmlpackageproc/dmlpackageprocessor.h index 730e20b90..ec7956c81 100644 --- a/dbcon/dmlpackageproc/dmlpackageprocessor.h +++ b/dbcon/dmlpackageproc/dmlpackageprocessor.h @@ -149,30 +149,6 @@ class DMLPackageProcessor spare = 0x3E; } }; - /** @brief a structure to hold a datetime - */ - struct dateTime - { - unsigned msecond : 20; - unsigned second : 6; - unsigned minute : 6; - unsigned hour : 6; - unsigned day : 6; - unsigned month : 4; - unsigned year : 16; - // NULL column value = 0xFFFFFFFFFFFFFFFE - dateTime() - { - year = 0xFFFF; - month = 0xF; - day = 0x3F; - hour = 0x3F; - minute = 0x3F; - second = 0x3F; - msecond = 0xFFFFE; - } - }; - /** @brief ctor */ DMLPackageProcessor(BRM::DBRM* aDbrm, uint32_t sid) diff --git a/mysql-test/columnstore/basic/r/MCOL-5035-update-insert-same-behavior.result b/mysql-test/columnstore/basic/r/MCOL-5035-update-insert-same-behavior.result new file mode 100644 index 000000000..413f18e45 --- /dev/null +++ b/mysql-test/columnstore/basic/r/MCOL-5035-update-insert-same-behavior.result @@ -0,0 +1,17 @@ +DROP DATABASE IF EXISTS MCOL5535; +CREATE DATABASE MCOL5535; +USE MCOL5535; +CREATE TABLE t1(i INTEGER, x DATETIME) ENGINE=COLUMNSTORE; +INSERT INTO t1 (i, x) VALUES (1, '0000-00-00 00:00:00'), (2, NULL), (3, '2024-01-01 01:01:01'); +SELECT * FROM t1; +i x +1 0000-00-00 00:00:00 +2 NULL +3 2024-01-01 01:01:01 +UPDATE t1 SET x='0000-00-00 00:00:00' WHERE i = 3; +SELECT * FROM t1; +i x +1 0000-00-00 00:00:00 +2 NULL +3 0000-00-00 00:00:00 +DROP DATABASE MCOL5535; diff --git a/mysql-test/columnstore/basic/t/MCOL-5035-update-insert-same-behavior.test b/mysql-test/columnstore/basic/t/MCOL-5035-update-insert-same-behavior.test new file mode 100644 index 000000000..7083c5091 --- /dev/null +++ b/mysql-test/columnstore/basic/t/MCOL-5035-update-insert-same-behavior.test @@ -0,0 +1,19 @@ +--disable_warnings +DROP DATABASE IF EXISTS MCOL5535; +--enable_warnings + +CREATE DATABASE MCOL5535; + +USE MCOL5535; + +CREATE TABLE t1(i INTEGER, x DATETIME) ENGINE=COLUMNSTORE; + +INSERT INTO t1 (i, x) VALUES (1, '0000-00-00 00:00:00'), (2, NULL), (3, '2024-01-01 01:01:01'); + +SELECT * FROM t1; + +UPDATE t1 SET x='0000-00-00 00:00:00' WHERE i = 3; + +SELECT * FROM t1; + +DROP DATABASE MCOL5535; diff --git a/writeengine/server/we_dmlcommandproc.cpp b/writeengine/server/we_dmlcommandproc.cpp index 5260c66ce..79f62ad34 100644 --- a/writeengine/server/we_dmlcommandproc.cpp +++ b/writeengine/server/we_dmlcommandproc.cpp @@ -3696,16 +3696,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin inData = columnsUpdated[j]->get_DataVector()[0]; } - if (((colType.colDataType == execplan::CalpontSystemCatalog::DATE) && (inData.safeString("").compare("0000-00-00") == 0)) || - ((colType.colDataType == execplan::CalpontSystemCatalog::DATETIME) && - (inData.safeString("").compare("0000-00-00 00:00:00") == 0)) || - ((colType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP) && - (inData.safeString("").compare("0000-00-00 00:00:00") == 0))) - { - inData.dropString(); - isNull = true; - } - uint64_t nextVal = 0; if (colType.autoincrement)