[MDEV-6900] cannot set session gtid_domain_id in stored procedure (SECURITY DEFINER) Created: 2014-10-21  Updated: 2014-10-22  Due: 2014-10-28  Resolved: 2014-10-22

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0.14
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

wheezy x86_64



 Description   

CREATE PROCEDURE setdomain() DETERMINISTIC SQL SECURITY DEFINER
BEGIN
set @gtid_domain_id=59;
END
 
set global init_connect='call  mysql.setdomain();';

non-priv user:

mysql>  select @gtid_domain_id;
+-----------------+
| @gtid_domain_id |
+-----------------+
|              59 |
+-----------------+
1 row in set (0.00 sec)
 
mysql> show session variables like 'gtid_domain_id';
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| gtid_domain_id | 0     |
+----------------+-------+
1 row in set (0.00 sec)

Binary events logged as this user use gtid_domain_id =0 instead of 59.



 Comments   
Comment by Daniel Black [ 2014-10-21 ]

non-priv user

mysql> select @last_gtid
    -> ;
+------------+
| @last_gtid |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)
 
mysql> use db;
Database changed
mysql> update users set login='user_disabled'  where id=14;
Query OK, 0 rows affected (0.11 sec)
Rows matched: 1  Changed: 0  Warnings: 0
 
mysql> select @@last_gtid
    -> ;
+-----------------+
| @@last_gtid     |
+-----------------+
| 0-12301-1050230 |
+-----------------+
 
mysql> show session variables like 'gtid_domain_id';
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| gtid_domain_id | 0     |
+----------------+-------+
1 row in set (0.00 sec)
 
mysql> select @gtid_domain_id;
+-----------------+
| @gtid_domain_id |
+-----------------+
|              59 |
+-----------------+
1 row in set (0.00 sec)

Comment by Elena Stepanova [ 2014-10-21 ]

Hi Daniel,

I'm not sure I quite understand your point, could you please clarify?
You set @var (a user-defined variable), but you expect @@var to be updated (a session environment variable). I don't think it works for any variable, gtid or not, do you have a reason to expect that it would?

Comment by Daniel Black [ 2014-10-22 ]

quite right. I've mixed up those concepts. session variable Gtid_domain_id is able to be set in a procedure.

bug invalid

Generated at Thu Feb 08 07:15:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.