Bug #89003 Dropping Index on JSON virtual column with default sql_mode is not working
| Submitted: | 21 Dec 2017 9:45 | Modified: | 21 Dec 2017 11:22 |
|---|---|---|---|
| Reporter: | Oli Sennhauser | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
| Version: | 5.7.20 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | INDEX, json, SQL_MODE, virtual column | ||
[21 Dec 2017 9:45]
Oli Sennhauser
[21 Dec 2017 11:22]
MySQL Verification Team
Hello Oli, Thank you for the report and test case. Thanks, Umesh
[2 Jan 2018 15:36]
Knut Anders Hatlen
Posted by developer: Changing bug category since the bug can be reproduced without using JSON: mysql> CREATE TABLE t(x INT, ts TIMESTAMP AS (NULL)); Query OK, 0 rows affected (0,01 sec) mysql> ALTER TABLE t ADD INDEX idx (x); ERROR 1067 (42000): Invalid default value for 'ts' mysql> SET SESSION sql_mode='NO_ZERO_IN_DATE,NO_ZERO_DATE'; Query OK, 0 rows affected, 2 warnings (0,00 sec) mysql> ALTER TABLE t ADD INDEX idx (x); Query OK, 0 rows affected, 1 warning (0,00 sec) Records: 0 Duplicates: 0 Warnings: 1 mysql> SET SESSION sql_mode=DEFAULT; Query OK, 0 rows affected (0,00 sec) mysql> ALTER TABLE t DROP INDEX idx; ERROR 1067 (42000): Invalid default value for 'ts' The problem does not seem to be reproducible when the server is started with --explicit-defaults-for-timestamp=ON, which is the default from MySQL 8.0.2.
[3 Jan 2018 8:11]
Knut Anders Hatlen
Posted by developer: Also reproducible without a generated column. For example like this with MySQL 5.7: mysql> SET sql_mode=''; Query OK, 0 rows affected, 1 warning (0,00 sec) mysql> CREATE TABLE t (x INT, ts TIMESTAMP DEFAULT '0000-00-00 00:00:00'); Query OK, 0 rows affected (0,01 sec) mysql> ALTER TABLE t ADD INDEX idx (x); Query OK, 0 rows affected (0,01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> SET sql_mode=DEFAULT; Query OK, 0 rows affected (0,00 sec) mysql> ALTER TABLE t DROP INDEX idx; ERROR 1067 (42000): Invalid default value for 'ts'
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.