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

Server silently accepts explicit inserts into generated columns of temporary tables instead of returning an error

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      Test case

      CREATE TEMPORARY TABLE t1 (a INT, v INT AS (a+1) VIRTUAL) ;
      INSERT INTO t1 (a, v) VALUES (1, 99);
      SELECT a, v, COUNT(*) AS t1_rows FROM t1;
      DROP TEMPORARY TABLE t1;
      

      10.11.19-opt>CREATE TEMPORARY TABLE t1 (a INT, v INT AS (a+1) VIRTUAL) ;
      Query OK, 0 rows affected (0.001 sec)
       
      10.11.19-opt>INSERT INTO t1 (a, v) VALUES (1, 99);
      Query OK, 1 row affected (0.000 sec)
       
      10.11.19-opt>SELECT a, v, COUNT(*) AS t1_rows FROM t1;
      +------+------+---------+
      | a    | v    | t1_rows |
      +------+------+---------+
      |    1 |    2 |       1 |
      +------+------+---------+
      1 row in set (0.000 sec)
       
      10.11.19-opt>DROP TEMPORARY TABLE t1;
      Query OK, 0 rows affected (0.000 sec)
       
      10.11.19-opt>
      

      INSERT statement fails when executed on the persistent table

      10.11.19-opt>CREATE TABLE bt (a INT, v INT AS (a+1) VIRTUAL);
      Query OK, 0 rows affected (0.032 sec)
       
      10.11.19-opt>INSERT INTO bt (a, v) VALUES (1, 99);
      ERROR 1906 (HY000): The value specified for generated column 'v' in table 'bt' has been ignored
      10.11.19-opt>
      

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5h
                0.5h

                Git Integration

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