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

A division in an indexed virtual column corrupts the table on @@dev_precision_increment change

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4, 11.5(EOL)
    • 10.5
    • Data types, Virtual Columns
    • None

    Description

      These scripts demonstrate the problem:

      SET @@div_precision_increment=4;
      CREATE OR REPLACE TABLE t1 (
        a INT,
        v INT GENERATED ALWAYS AS (LENGTH(a/3)),
        KEY(v)
      ) ENGINE=MyISAM;
      INSERT INTO t1 (a) VALUES (1);
      SELECT * FROM t1;
      FLUSH TABLES;
      SET @@div_precision_increment=8;
      SELECT * FROM t1;
      CHECK TABLE t1;
      

      +---------+-------+----------+---------------------------------------------------------+
      | Table   | Op    | Msg_type | Msg_text                                                |
      +---------+-------+----------+---------------------------------------------------------+
      | test.t1 | check | error    | Checksum for key:  1 doesn't match checksum for records |
      | test.t1 | check | error    | Corrupt                                                 |
      +---------+-------+----------+---------------------------------------------------------+
      

      SET @@div_precision_increment=4;
      CREATE OR REPLACE TABLE t1 (
        a INT,
        v VARCHAR(100) GENERATED ALWAYS AS (a/3.000),
        KEY(v)
      ) ENGINE=MyISAM;
      INSERT INTO t1 (a) VALUES (1);
      SELECT * FROM t1;
      FLUSH TABLES;
      SET @@div_precision_increment=8;
      SELECT * FROM t1;
      CHECK TABLE t1;
      

      +---------+-------+----------+---------------------------------------------------------+
      | Table   | Op    | Msg_type | Msg_text                                                |
      +---------+-------+----------+---------------------------------------------------------+
      | test.t1 | check | error    | Checksum for key:  1 doesn't match checksum for records |
      | test.t1 | check | error    | Corrupt                                                 |
      +---------+-------+----------+---------------------------------------------------------+
      

      SET @@div_precision_increment=4;
      CREATE OR REPLACE TABLE t1 (
        a INT,
        v DECIMAL(48,30) GENERATED ALWAYS AS (a/3.000),
        KEY(v)
      ) ENGINE=MyISAM;
      INSERT INTO t1 (a) VALUES (1);
      SELECT * FROM t1;
      FLUSH TABLES;
      SET @@div_precision_increment=8;
      SELECT * FROM t1;
      CHECK TABLE t1;
      

      +---------+-------+----------+---------------------------------------------------------+
      | Table   | Op    | Msg_type | Msg_text                                                |
      +---------+-------+----------+---------------------------------------------------------+
      | test.t1 | check | error    | Checksum for key:  1 doesn't match checksum for records |
      | test.t1 | check | error    | Corrupt                                                 |
      +---------+-------+----------+---------------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.