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

New DEFAULT logic does not support use of some suitable functions

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.2
    • OTHER
    • None

    Description

      There seems to be no obvious good reason why

      • MONTHNAME(..)
      • DAYNAME(...)
      • DATE_FORMAT(...)
      • TIME_FORMAT(...)

      should not work in DEFAULT clause, so it's worth checking whether it was intended:

      MariaDB [test]> create table t1 (d datetime default current_timestamp, m varchar(16) default monthname(d));
      ERROR 1901 (HY000): Function or expression 'monthname()' cannot be used in the DEFAULT clause of `m`
      

      Especially since MONTH() works:

      MariaDB [test]> create or replace table t1 (d datetime default current_timestamp, m varchar(16) default month(d));
      Query OK, 0 rows affected (0.58 sec)
      

      Attachments

        Issue Links

          Activity

            This is tested in the default.test. Functions that depend on the session state (in particular, on @@lc_time_names variable) are not supported.

            serg Sergei Golubchik added a comment - This is tested in the default.test . Functions that depend on the session state (in particular, on @@lc_time_names variable) are not supported.

            VERSION() function is not allowed, which is strange, because @@version works. VERSION() is not in the default.test.

            elenst Elena Stepanova added a comment - VERSION() function is not allowed, which is strange, because @@version works. VERSION() is not in the default.test.

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              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.