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

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

    XMLWordPrintable

    Details

      Description

      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;
       
      --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): INSERT command denied to user 'foo'@'localhost' for column 'b' in table 't'
      

      Without RETURNING, the same INSERT works, so the INSERT privilege isn't really needed:

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

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: