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

Table-level privilege checks are bypassed for a global temporary table (GTT) created with the ON COMMIT PRESERVE ROWS option

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      MTR Test case

      MDEV-35915 CS 13.0.0 fcf14161a97ec5542a265d6f00a95264dbad4fa7 (Debug, Clang 18.1.3-11) Build 03/06/2026

      create user u@localhost;
      create global temporary table test.g (id int primary key, v int)
        on commit preserve rows;
      grant select, insert on test.g to u@localhost;
       
      --connect (c, localhost, u,,test)
      show grants;
      insert into g values (1,10);
      --echo # Actual : UPDATE without UPDATE privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR 
      update g set v = 999 where id = 1;
      --echo # Actual : DELETE without DELETE privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR 
      delete from g where id = 1;
      insert into g values (2,20);
      --echo # Actual : TRUNCATE without DROP privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR
      truncate g;
      --disconnect c
      

      Output

      create user u@localhost;
      create global temporary table test.g (id int primary key, v int)
      on commit preserve rows;
      grant select, insert on test.g to u@localhost;
      connect  c, localhost, u,,test;
      show grants;
      Grants for u@localhost
      GRANT USAGE ON *.* TO `u`@`localhost`
      GRANT SELECT, INSERT ON `test`.`g` TO `u`@`localhost`
      insert into g values (1,10);
      # Actual : UPDATE without UPDATE privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR
      update g set v = 999 where id = 1;
      # Actual : DELETE without DELETE privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR
      delete from g where id = 1;
      insert into g values (2,20);
      # Actual : TRUNCATE without DROP privilege succeeds. Expected ER_TABLEACCESS_DENIED_ERROR
      truncate g;
      disconnect c;
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.