I am trying to create a table with a timestamp column and a virtual (calculated) column that holds a helper key for grouping the rows with timestamps of the same hour. For that I am using the following command in MariaDB / MySql:
CREATE TABLE mytable(t TIMESTAMP, u INT AS (UNIX_TIMESTAMP(t) DIV 3600);
Which returns the following error:
ERROR 1901 (HY000): Function or expression is not allowed for column 'u'
According to the documentation i don't see a reason this should not work. Any ideas?