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

Inconsistent error codes returned on lack of access for EXPLAIN UPDATE with view

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.0.14, 10.1.1
    • 10.1(EOL)
    • OTHER

    Description

      CREATE DATABASE privtest_db;
       
      CREATE TABLE privtest_db.t1 (a INT);
      CREATE TABLE privtest_db.t2 (a INT);
      INSERT INTO privtest_db.t2 VALUES (1), (2), (3);
      CREATE VIEW privtest_db.v1 (a) AS SELECT a FROM privtest_db.t1;
       
      GRANT ALL    ON privtest_db.t1 TO 'privtest'@'localhost';
      GRANT ALL    ON privtest_db.t2 TO 'privtest'@'localhost';
      GRANT SELECT ON privtest_db.v1 TO 'privtest'@'localhost';

      connect(con1,localhost,privtest,,);
      USE privtest_db;
       
      # Single-table UPDATE, multi-table DELETE, multi-table UPDATE all return
      # the same ER_TABLEACCESS_DENIED_ERROR
      # because there is no UPDATE/DELETE grants on v1
       
      --error ER_TABLEACCESS_DENIED_ERROR
      UPDATE v1 SET v1.a = v1.a + 1 WHERE v1.a = 2;
      --error ER_TABLEACCESS_DENIED_ERROR
      DELETE v1 FROM v1, t2 WHERE v1.a = t2.a;
      --error ER_TABLEACCESS_DENIED_ERROR
      UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
       
      # But for EXPLAIN, it's different:
      # Single-table UPDATE and multi-table DELETE both return ER_TABLEACCESS_DENIED_ERROR
      # while the multi-table UPDATE returns ER_VIEW_NO_EXPLAIN
       
      --error ER_TABLEACCESS_DENIED_ERROR
      EXPLAIN UPDATE v1 SET v1.a = v1.a + 1 WHERE v1.a = 2;
      --error ER_TABLEACCESS_DENIED_ERROR
      EXPLAIN DELETE v1 FROM v1, t2 WHERE v1.a = t2.a;
       
      --error ER_TABLEACCESS_DENIED_ERROR
      EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.