Mysql
讀取器與寫入器極光mysql中的奇怪最大(日期)返回
這裡發生了一些非常奇怪的事情,我無法指出。使用 AWS Aurora,在作者中選擇 max(date) 給了我一個日期,在閱讀器中它返回奇怪的日期和警告。列是
datetime
。作家:
MySQL [(none)]> select max(colDT) from tbl_example; +---------------------+ | max(colDT) | +---------------------+ | 2020-02-12 00:00:00 | +---------------------+
讀者:
MySQL [(none)]> select id from tbl_example where colDT=(select max(colDT) from tbl_example); Empty set, 3 warnings (0.00 sec) MySQL [(none)]> show warnings; +---------+------+-----------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+-----------------------------------------------------------------------------+ | Warning | 1292 | Incorrect datetime value: ':082-05-31 31:63:51' for column 'colDT' at row 1 | | Warning | 1292 | Incorrect datetime value: ':082-05-31 31:63:51' for column 'colDT' at row 1 | | Warning | 1292 | Incorrect datetime value: ':082-05-31 31:63:51' for column 'colDT' at row 1 | +---------+------+-----------------------------------------------------------------------------+
還有一些奇怪的地方:
MySQL [(none)]> select max(colDT),id from tbl_example ; +---------------------+-------+ | max(colDT) | id | +---------------------+-------+ | :082-05-31 31:63:51 | 94113 | +---------------------+-------+ 1 row in set (46.47 sec) MySQL [(none)]> select * from tbl_example where id=94113; +-------+-------+---------------------+---------+--------+---------+ | id | bbbbb | colDT | cc | dd | ee | +-------+-------+---------------------+---------+--------+---------+ | 94113 | 1 | 2019-08-07 00:00:00 | 6 | 17 | 1 | +-------+-------+---------------------+---------+--------+---------+ 1 row in set (0.00 sec)
表定義:
MySQL [(none)]> show create table tbl_example\G *************************** 1. row *************************** Table: tbl_example Create Table: CREATE TABLE `tbl_example ` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bbbbb` tinyint(4) NOT NULL, `colDT` datetime NOT NULL, `cc` int(11) unsigned NOT NULL, `dd` int(11) unsigned NOT NULL, `ee` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`,`colDT`), UNIQUE KEY `ux_date_dd` (`colDT`,`dd`), KEY `dd` (`dd`), KEY `cc` (`cc`) ) ENGINE=InnoDB AUTO_INCREMENT=1078720 DEFAULT CHARSET=latin1 /*!50500 PARTITION BY RANGE COLUMNS(colDT) (PARTITION p20190601 VALUES LESS THAN ('2019-07-01') ENGINE = InnoDB, PARTITION p20190701 VALUES LESS THAN ('2019-08-01') ENGINE = InnoDB, PARTITION p20190801 VALUES LESS THAN ('2019-09-01') ENGINE = InnoDB, PARTITION p20190901 VALUES LESS THAN ('2019-10-01') ENGINE = InnoDB */
閱讀器出現問題,重新啟動後問題消失了。