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

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

            shulga Dmitry Shulga created issue -
            shulga Dmitry Shulga made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            shulga Dmitry Shulga added a comment -

            Patch for review is available in the branch bb-10.4-MDEV-33549

            shulga Dmitry Shulga added a comment - Patch for review is available in the branch bb-10.4- MDEV-33549
            shulga Dmitry Shulga made changes -
            Assignee Dmitry Shulga [ JIRAUSER47315 ] Oleksandr Byelkin [ sanja ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Dmitry Shulga [ JIRAUSER47315 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            shulga Dmitry Shulga made changes -
            Assignee Dmitry Shulga [ JIRAUSER47315 ] Oleksandr Byelkin [ sanja ]
            Status Stalled [ 10000 ] In Review [ 10002 ]

            OK to push

            sanja Oleksandr Byelkin added a comment - OK to push
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Dmitry Shulga [ JIRAUSER47315 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            shulga Dmitry Shulga made changes -
            Component/s Prepared Statements [ 10804 ]
            Fix Version/s 10.4.34 [ 29625 ]
            Fix Version/s 10.5.25 [ 29626 ]
            Fix Version/s 10.6.18 [ 29627 ]
            Fix Version/s 10.11.8 [ 29630 ]
            Fix Version/s 11.0.6 [ 29628 ]
            Fix Version/s 11.1.5 [ 29629 ]
            Fix Version/s 11.2.4 [ 29631 ]
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.5.1 [ 29634 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]

            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.