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

confusing error message for SET ROLE INVALID

    XMLWordPrintable

Details

    Description

      execute immediate set role via script

      MariaDB [(none)]> select version();
      +-----------------+
      | version()       |
      +-----------------+
      | 10.2.34-MariaDB |
      +-----------------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> drop role mariadb_dump_import_role;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [(none)]> Bye
      [dan@linux build-mariadb-server-10.2]$ mc -u superbob -p < /dev/shm/var_auto_Ptio/tmp/dump1.sql
      Enter password: 
      ERROR 1193 (HY000) at line 5: Unknown system variable 'ROLE'
       
      [dan@linux build-mariadb-server-10.2]$ cat /dev/shm/var_auto_Ptio/tmp/dump1.sql
      SELECT COALESCE(QUOTE(CURRENT_ROLE()),'NONE') into @current_role;
      CREATE ROLE mariadb_dump_import_role;
      SET ROLE mariadb_dump_import_role;
      SET ROLE NONE;
      EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role);
      

      on tty ok

      [dan@linux build-mariadb-server-10.2]$ mc -u superbob
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 19
      Server version: 10.2.34-MariaDB Source distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> 
      MariaDB [(none)]> set @current_role='mariadb_dump_import_role';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [(none)]> EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role);
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [(none)]> select current_role();
      +--------------------------+
      | current_role()           |
      +--------------------------+
      | mariadb_dump_import_role |
      +--------------------------+
      1 row in set (0.00 sec)
      
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            danblack Daniel Black
            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.