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

INSERT ... SELECT with wrong result in derived_view.test

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.5
    • 11.4.7
    • OTHER
    • None

    Description

      in main/derived_view.test:
      Testcase for BUG#968720:

      CREATE TABLE t1 (a int, INDEX(a));
      INSERT INTO t1 VALUES (1);
       
      CREATE TABLE t2 (a int, INDEX(a));
      INSERT INTO t2 VALUES (1), (2);
       
      INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
      t2 AS s2;
      SELECT * FROM t1;
       
      DELETE FROM t1;
      INSERT INTO t1 VALUES (1);
      

      then

      PREPARE stmt FROM "
      INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
      t2 AS s2;
      ";
      EXECUTE stmt;
      SELECT * FROM t1;
      a
      1
      1
      

      Makes sense, one row was there and one got inserted.
      Then it runs the same again:

      EXECUTE stmt;
      SELECT * FROM t1;
      a
      1
      1
      

      Wrong. Why still two rows? It should have inserted two more.
      (To be verified: and I get that when trying with InnoDB tables. It's only MyISAM? Not sure why.)

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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