[MDEV-11517] Confusing error message upon attempt to create an indexed virtual column with partially supported functions Created: 2016-12-09  Updated: 2017-01-02

Status: Open
Project: MariaDB Server
Component/s: Virtual Columns
Affects Version/s: 10.2
Fix Version/s: 10.2

Type: Bug Priority: Trivial
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-5800 indexes on virtual (not materialized)... Closed

 Description   

Note: I've seen from the tests that it's expected for now, but I think it could be improved.

This works

MariaDB [test]> create table t1 (a datetime as (now()) VIRTUAL);
Query OK, 0 rows affected (0.40 sec)

This does not work

MariaDB [test]> create table t2 (a datetime as (now()) VIRTUAL, INDEX(a));
ERROR 1901 (HY000): Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `a`

The problem is not that it doesn't work, but that it pretends that NOW cannot be used at all, while it's only so for indexed columns. Maybe we need a different error message if there is no suitable one.



 Comments   
Comment by Elena Stepanova [ 2017-01-02 ]

Also reproducible on bb-10.2-monty as of 349d69e2e

Generated at Thu Feb 08 07:50:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.