Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.2.34
-
None
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)
|
|