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

VIEWs and subqueries with FOR UPDATE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
    • Fix Version/s: 10.3
    • Component/s: Views
    • Labels:

      Description

      This is similar to MDEV-10035, but now FOR UPDATE is used inside a subquery:

      I run this script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (10);
      DROP VIEW IF EXISTS v1;
      CREATE VIEW v1 AS SELECT (SELECT a FROM t1 FOR UPDATE) FROM t1;
      START TRANSACTION;
      SELECT * FROM v1;
      

      Now I open a new session and run this script:

      START TRANSACTION;
      SELECT a FROM t1 FOR UPDATE;
      

      It immediately returns a result:

      +------+
      | a    |
      +------+
      |   10 |
      +------+
      

      This is wrong. Subselects with FOR UPDATE should be disallowed in VIEWs.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              bar Alexander Barkov
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.