Is MYSQL UNIX_TIMESTAMP('02/05/2019') non-deterministic?

时间:2019-05-31 11:29:52

标签: mysql unix-timestamp deterministic

According to the definition given here at: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html

A function is deterministic if, given the same data in tables, multiple invocations produce the same result, independently of the connected user.

To my understanding, unix_timestamp() will always give the same result for the same input.

However, when I am trying to create a generated column using UNIX_TIMESTAMP(epochtime), it is giving an error as disallowed function.

ALTER TABLE `test_table` 
ADD COLUMN epoch_updated_at BIGINT(15)
AS  (UNIX_TIMESTAMP(updated_at)) STORED

enter image description here

Update: I found that MYSQL does consider unix_timestamp as non-deterministic at https://dev.mysql.com/doc/refman/8.0/en/replication-rbr-safe-unsafe.html#replication-rbr-safe-unsafe-not. I am not sure, why, though?

0 个答案:

没有答案