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

Function is accepted for default in CREATE TABLE but makes ALTER fail

    XMLWordPrintable

Details

    Description

      In the test case below, CREATE TABLE succeeds, but the following ALTER fails with ER_INVALID_DEFAULT.
      I could only reproduce the error with "special" character sets (utf16, utf32, ucs2), although maybe if the test case is changed in a right way, it will show up elsewhere.

      create table t (a VARBINARY(33000) DEFAULT REPEAT('a',33000)) CHARACTER SET ucs2;
      alter table t force;
      show create table t;
       
      # Cleanup
      drop table t;
      

      10.3 92be8d20

      CURRENT_TEST: bug.t2
      mysqltest: At line 2: query 'alter table t force' failed: 1067: Invalid default value for 'a'
      

      However, this (same default value but from a variable instead of a function) works all right, no errors:

      SET @a= REPEAT('a',33000);
       
      create table t (a VARBINARY(33000) DEFAULT @a) CHARACTER SET ucs2;
      alter table t force;
      show create table t;
      drop table t;
      

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.