[MDEV-15615] Unexpected syntax error instead of "Unknown system variable" inside an SP Created: 2018-03-21  Updated: 2018-03-27  Resolved: 2018-03-27

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: 10.3.6

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15316 Assertion `(thd->lex)->var_list.is_em... Closed
relates to MDEV-15620 Crash when using "SET @@NEW.a=expr" i... Closed
Sprint: 10.3.6-1

 Description   

I run this script, it correctly returns an "Unknown system variable" error:

DELIMITER $$
BEGIN NOT ATOMIC
  SET GLOBAL a=10;
END;
$$
DELIMITER ;

ERROR 1193 (HY000): Unknown system variable 'a'

Now I modify the script slightly: additionally declare a local variable with name a:

DELIMITER $$
BEGIN NOT ATOMIC
  DECLARE a INT;
  SET GLOBAL a=10;
END;
$$
DELIMITER ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ';

The error message looks confusing. The expected error message would be to return "Unknown system variable".


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