Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11517

Confusing error message upon attempt to create an indexed virtual column with partially supported functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 10.2
    • Fix Version/s: 10.2
    • Component/s: Virtual Columns
    • Labels:
      None

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: