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

INSERT .. RETURNING requires SELECT privilege on columns which only participate in INSERT clause

    XMLWordPrintable

Details

    Description

      (this is the complementary to MDEV-23085, they should probably be fixed jointly)

      create database db;
      create table db.t (a int, b int);
      create user foo;
      grant insert (a) on db.t to foo;
      grant select (b) on db.t to foo;
      grant insert (b) on db.t to foo; -- Should not be needed, but otherwise we hit MDEV-23085
       
      --connect (con1,localhost,foo,,)
      insert into db.t (a) values (1) returning b;
       
      # Cleanup
      --disconnect con1
      --connection default
      drop database db;
      drop user foo;
      

      10.5 6cee9b1953

      MariaDB [test]> insert into db.t (a) values (1) returning b;
      ERROR 1143 (42000): SELECT command denied to user 'foo'@'localhost' for column 'a' in table 't'
      

      Without RETURNING, the same INSERT works. The value of a is never returned.

      MariaDB [test]> insert into db.t (a) values (1);
      Query OK, 1 row affected (0.017 sec)
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              Ángel Ángel
              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.