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

sql_mode allows creation of illedal stored generated column

    XMLWordPrintable

Details

    Description

      MariaDB [test]> CREATE TABLE t1 (a int unsigned  AS ( CAST(0 AS UNSIGNED)  -1) STORED);
      ERROR 1901 (HY000): Function or expression 'cast(0 as unsigned) - 1' cannot be used in the GENERATED ALWAYS AS clause of `a`
      MariaDB [test]> set sql_mode=no_unsigned_subtraction;
      Query OK, 0 rows affected (0.000 sec)
      MariaDB [test]> CREATE TABLE t1 (a int unsigned  AS ( CAST(0 AS UNSIGNED)  -1) STORED);
      Query OK, 0 rows affected (0.014 sec)
      

      there are other sql modes that affect other functions and expressions. may be they're also affected, I didn't check that

      Attachments

        Activity

          People

            bar Alexander Barkov
            serg Sergei Golubchik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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