Description:
I insert a data in table:
insert into test_date(start_time) values("2024-08-06");
But at the binary log, it shows:'2024:08:06', but what i insert is:"2024-08-06"
Binary log:
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 891
#240801 16:40:40 server id 1 end_log_pos 968 CRC32 0x3ac60249 Query thread_id=8860 exec_time=0 error_code=0
SET TIMESTAMP=1722501640/*!*/;
BEGIN
/*!*/;
# at 968
#240801 16:40:40 server id 1 end_log_pos 1046 CRC32 0x1d74713c Rows_query
# insert into test_date(start_time) values("2024-08-06")
# at 1046
#240801 16:40:40 server id 1 end_log_pos 1104 CRC32 0xd1f736a6 Table_map: `testdb`.`test_date` mapped to number 136
# has_generated_invisible_primary_key=0
# at 1104
#240801 16:40:40 server id 1 end_log_pos 1147 CRC32 0x1d720487 Write_rows: table id 136 flags: STMT_END_F
### INSERT INTO `testdb`.`test_date`
### SET
### @1=7 /* INT meta=0 nullable=0 is_null=0 */
### @2='2024:08:06' /* DATE meta=0 nullable=1 is_null=0 */
# at 1147
#240801 16:40:40 server id 1 end_log_pos 1178 CRC32 0x55fc3f57 Xid = 57632
COMMIT/*!*/;
How to repeat:
create a table:
CREATE TABLE `test_date` (
`id` int NOT NULL AUTO_INCREMENT,
`start_time` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Insert value:
insert into test_date(start_time) values("2024-08-06");
Flush logs to write to the binary log:
flush binary logs;
Check the binary log:
mysqlbinlog -vv --base64-output=decode-rows binlog.000007
ps.use the actual file name instead of "binlog.000007"
Description: I insert a data in table: insert into test_date(start_time) values("2024-08-06"); But at the binary log, it shows:'2024:08:06', but what i insert is:"2024-08-06" Binary log: SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 891 #240801 16:40:40 server id 1 end_log_pos 968 CRC32 0x3ac60249 Query thread_id=8860 exec_time=0 error_code=0 SET TIMESTAMP=1722501640/*!*/; BEGIN /*!*/; # at 968 #240801 16:40:40 server id 1 end_log_pos 1046 CRC32 0x1d74713c Rows_query # insert into test_date(start_time) values("2024-08-06") # at 1046 #240801 16:40:40 server id 1 end_log_pos 1104 CRC32 0xd1f736a6 Table_map: `testdb`.`test_date` mapped to number 136 # has_generated_invisible_primary_key=0 # at 1104 #240801 16:40:40 server id 1 end_log_pos 1147 CRC32 0x1d720487 Write_rows: table id 136 flags: STMT_END_F ### INSERT INTO `testdb`.`test_date` ### SET ### @1=7 /* INT meta=0 nullable=0 is_null=0 */ ### @2='2024:08:06' /* DATE meta=0 nullable=1 is_null=0 */ # at 1147 #240801 16:40:40 server id 1 end_log_pos 1178 CRC32 0x55fc3f57 Xid = 57632 COMMIT/*!*/; How to repeat: create a table: CREATE TABLE `test_date` ( `id` int NOT NULL AUTO_INCREMENT, `start_time` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; Insert value: insert into test_date(start_time) values("2024-08-06"); Flush logs to write to the binary log: flush binary logs; Check the binary log: mysqlbinlog -vv --base64-output=decode-rows binlog.000007 ps.use the actual file name instead of "binlog.000007"