[MDEV-17557] Unexpected sytax error in "FOR system_time IN 1..3 DO" Created: 2018-10-26  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.4

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


 Description   

This script works fine:

DELIMITER $$
FOR i IN 1..3 DO
  SELECT i;
END FOR;
$$
DELIMITER ;

This script returns an error:

DELIMITER $$
FOR system_time IN 1..3 DO
  SELECT system_time;
END FOR;
$$
DELIMITER ;

ERROR 1064 (42000): You have an error in your SQL syntax...near 'system_time IN 1..3 DO

Looks wrong. It should work like the first script.
FOR SYSTEM_TIME should have a special meaning only in certain contexts.
In a FOR loop, SYSTEM_TIME should be treated like a normal index variable.


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