Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Duplicate
-
10.4.21
-
Centos 7
Description
When using the CURDATE() function as part of a VIRTUAL column, the column becomes unselectable.
Ways to reproduce:
-- create table with virtual column using the curdate() function
|
CREATE TABLE `TestTable` (
|
`TestId` int(11) NOT NULL AUTO_INCREMENT,
|
`VirtualColumnTest` tinyint(4) GENERATED ALWAYS AS (if(curdate() between '2020-01-01' and '2020-01-02',1,0)) VIRTUAL,
|
PRIMARY KEY (`TestId`)
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
-- selecting with "*" works as expected
|
SELECT * FROM TestTable;
|
|
-- selecting directly by column triggers error
|
SELECT VirtualColumnTest FROM TestTable;
|
|
-- ERROR 2013 (HY000): Lost connection to MySQL server during query
|
As a workaround, using CURRENT_TIMESTAMP() will work without errors.
Attachments
Issue Links
- duplicates
-
MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if()
- Closed
-
MDEV-25772 Virtual Column with CURDATE function cause suddenly entire MariaDB crash
- Closed