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

FTS_DOC_ID check does not work upon ALTER .. ALGORITHM=COPY

    XMLWordPrintable

Details

    Description

      There is this fragment in innodb_fts.innodb-fts-fic which states that FTS_DOC_ID type is being checked deliberately upon ALTER:

      # We will check validity of FTS_DOC_ID, which must be of an UNSIGNED
      # NOT NULL bigint 
      CREATE TABLE wp(
         FTS_DOC_ID bigint PRIMARY KEY,
         title VARCHAR(255) NOT NULL DEFAULT '',
         text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
       
      ...
       
      --error ER_INNODB_FT_WRONG_DOCID_COLUMN
      CREATE FULLTEXT INDEX idx ON wp(title, text);
      

      However, this check is inconsistent. If the fulltext index is created with ALTER .. ALGORITHM=COPY, it doesn't fail.

      --source include/have_innodb.inc
       
      CREATE TABLE wp(
         FTS_DOC_ID bigint PRIMARY KEY,
         text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB;
       
      --error ER_INNODB_FT_WRONG_DOCID_COLUMN
      ALTER TABLE wp ADD FULLTEXT INDEX idx (text);
       
      ALTER TABLE wp ADD FULLTEXT INDEX idx (text), ALGORITHM=COPY;
      SHOW CREATE TABLE wp;
       
      DROP TABLE wp;
      

      10.4 ff3d4395

      ALTER TABLE wp ADD FULLTEXT INDEX idx (text);
      ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
      ALTER TABLE wp ADD FULLTEXT INDEX idx (text), ALGORITHM=COPY;
      SHOW CREATE TABLE wp;
      Table	Create Table
      wp	CREATE TABLE `wp` (
        `FTS_DOC_ID` bigint(20) NOT NULL,
        `text` mediumtext NOT NULL,
        PRIMARY KEY (`FTS_DOC_ID`),
        FULLTEXT KEY `idx` (`text`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
      

      In MySQL 5.7 both fail.

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            elenst Elena Stepanova
            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.