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

"Function or expression is not allowed for column 'fd2'" on VIRTUAL column

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.0.10
    • None
    • None
    • None
    • Darwin Mattui-MacBook-Pro.local 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64

    Description

      MariaDB knowledge said "User-defined functions and stored functions cannot be used (built-in functions can be used)" on https://mariadb.com/kb/en/virtual-columns/

      So I think we can use any built-in function on VIRTUAL column.
      But, MariaDB server complain about the function I used, Especially "NOW()". Without NOW() table created successfully.

      Is it expected ?
      And are there any document about what function we can use on VIRTUAL column ?

      MariaDB [test]> create table t_virtual (fd1 datetime, fd2 bigint as (DATEDIFF(now(), fd1)) VIRTUAL);
      ERROR 1901 (HY000): Function or expression is not allowed for column 'fd2'
       
      MariaDB [test]> create table t_virtual (fd1 datetime, fd2 bigint as (DATEDIFF(fd1, fd1)) VIRTUAL);
      Query OK, 0 rows affected (0.03 sec)

      Attachments

        Activity

          People

            Unassigned Unassigned
            Matt74 Seunguck Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.