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

Incorrect handling of UPDATE in PS mode in case a table's colum declared as NOT NULL

    XMLWordPrintable

Details

    Description

      Merge from 11.0 into 11.1 results in several failing tests
      The test main.ps is one of them.
      Simplified test case is below

      CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
      INSERT INTO t1 VALUES (20, 30);
      EXECUTE IMMEDIATE 'UPDATE t1 SET b=?' USING DEFAULT;
      SELECT * FROM t1;
      DROP TABLE t1;
      

      Up to 11.0 the query from t1 after UPDATE has been executed produces the value NULL for the column 'b'. After merge the value 0 is fetched by the query.

      It seems that the issue caused by commits for the following two bug reports that conflicts each other:

      Author: Igor Babaev <igor@askmonty.org>
      MDEV-28883 Re-design the upper level of handling UPDATE and DELETE statements

      Author: Dmitry Shulga <dmitry.shulga@mariadb.com>
      MDEV-15703: Crash in EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)' USING DEFAULT

      Further investigation shows that the following test case produces incorrect result starting from 10.4 and up

      CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
      CREATE TABLE t2 (a INT DEFAULT 10, c INT DEFAULT NULL);
      INSERT INTO t1 VALUES (20, 30);
      INSERT INTO t2 VALUES (20, 30);
      EXECUTE IMMEDIATE 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT;
      SELECT * FROM t1;
      a	b
      20	0
      DROP TABLE t1;
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.