[MDEV-19548] If the variable name starts from underscore, the incorrect trigger body is retrieved from metadata. Created: 2019-05-22  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3.15, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Alena Subotina Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File Script.7z     PNG File image-2019-05-22-14-17-49-253.png    

 Description   

Preconditions: MariaDB 10.3.15 is installed from box.
Only information_schema, mysql and performance_schema are available after installation. No user databases are present.
All actions are performed with the user root.
Steps to reproduce:
1. Run the command line and execute the command:
"C:\Program Files\MariaDB 10.3\bin\mysql.exe" -u root -proot
2. Execute the script (see attachment) with the command: source D:/Script.sql
After the script is executed, the db1 database will be created
3. Execute two queries through the MySQL console

SELECT ACTION_STATEMENT FROM information_schema.triggers WHERE TRIGGER_SCHEMA = 'db1';
SHOW CREATE TRIGGER db1.trigger1;

4. The result is shown on the screenshot :



 Comments   
Comment by Alice Sherepa [ 2019-05-22 ]

Thanks a lot! Repeatable on 10.3,10.4

create table t1 (id int, a int);
create table t2 (id2 int);
 
delimiter $$;
create trigger tr after update on t2 for each row
begin
	declare _ym int(6) default null;
	select a into _ym from t1 where id = t2.id2;
end$$
 
delimiter ;$$
 
select action_statement from information_schema.triggers where trigger_schema = 'test';
drop table t1,t2;

MariaDB [test]> select action_statement from information_schema.triggers where trigger_schema = 'test';
+-----------------------------------------------------------------------------------+
| action_statement                                                                  |
+-----------------------------------------------------------------------------------+
| begin
declare  int(6) default null;
select a into  from t1 where id = t2.id2;
end |
+-----------------------------------------------------------------------------------+
1 row in set (0.003 sec)

Generated at Thu Feb 08 08:52:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.