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
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
When using the *CURDATE()* function as part of a VIRTUAL column, the column becomes unselectable.
Ways to reproduce: {code:mysql} -- 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 {code} |
When using the *CURDATE()* function as part of a VIRTUAL column, the column becomes unselectable.
Ways to reproduce: {code:mysql} -- 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 {code} As a workaround, using CURRENT_TIMESTAMP() will work without errors. |
Component/s | N/A [ 14411 ] | |
Fix Version/s | N/A [ 14700 ] | |
Resolution | Duplicate [ 3 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Link |
This issue duplicates |
Link |
This issue duplicates |
Workflow | MariaDB v3 [ 125092 ] | MariaDB v4 [ 159690 ] |
Thanks!
This is the same problem as
MDEV-25772(MDEV-26437), I will add the testcase there