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

CREATE table privilege allows to see SHOW CREATE output, but not columns

    XMLWordPrintable

Details

    Description

      I'm setting it to minor, because it is apparently intentional. I can't find it in the KB, but at least the MySQL manual says:

      SHOW COLUMNS displays information only for those columns for which you have some privilege

      so one can say that CREATE grant doesn't give any column privileges, thus nothing is shown.

      It doesn't seem logical though, if I can see all the columns through SHOW CREATE TABLE anyway, why cannot I see them via SHOW COLUMNS or from INFORMATION_SCHEMA.COLUMNS.

      create database db;
      create table db.t (a int);
       
      create user u@localhost;
      grant create on db.t to u@localhost;
       
      --connect (con1,localhost,u,,db)
      show create table db.t;
      show columns in db.t;
      select table_name, column_name from information_schema.columns where table_name = 't';
       
      # Cleanup
      --disconnect con1
      --connection default
      drop user u@localhost;
      drop database db;
      

      Actual result, 10.4 b1c8ea83

      show create table db.t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
      show columns in db.t;
      Field	Type	Null	Key	Default	Extra
      select table_name, column_name from information_schema.columns where table_name = 't';
      table_name	column_name
      disconnect con1;
      

      Attachments

        Activity

          People

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