DROP TABLE IF EXISTS `test_table`;
DROP VIEW IF EXISTS `test_view`;


-- Works with InnoDB engine.
CREATE TABLE `test_table` (
`dt` datetime DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE VIEW `test_view` AS SELECT * FROM `test_table`;

SELECT date(`test_view`.`dt`) AS `dt`
FROM `test_view`
GROUP BY date(`test_view`.`dt`);


-- Columnstore
DROP TABLE `test_table`;
DROP VIEW `test_view`;

CREATE TABLE `test_table` (
`dt` datetime DEFAULT NULL) ENGINE=Columnstore DEFAULT CHARSET=utf8;

CREATE VIEW `test_view` AS SELECT * FROM `test_table`;

SELECT date(`test_table`.`dt`) AS `dt`
FROM `test_table`
GROUP BY date(`test_table`.`dt`);


-- This produces an error
SELECT date(`test_view`.`dt`) AS `dt`
FROM `test_view`
GROUP BY date(`test_view`.`dt`);

