[MDEV-16558] Parenthesized expression does not work as a lower FOR loop bound Created: 2018-06-25  Updated: 2023-04-27

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

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

Issue Links:
Relates
relates to MDEV-15944 Subquery is not allowed as the lower ... Open

 Description   

This script works fine in Oracle:

BEGIN
FOR i IN (1)..(2)
LOOP
  NULL;
END LOOP;
END;
/

An equivalent script in MariaDB fails on error:

SET sql_mode=ORACLE;
DELIMITER /
BEGIN
FOR i IN (1)..(2)
LOOP
  NULL;
END LOOP;
END;
/

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 '1)..(2)



 Comments   
Comment by Alexander Barkov [ 2018-06-25 ]

Another example script that works in Oracle but an equivalent script fails in MariaDB:

BEGIN
  FOR a IN (1)+1..3
  LOOP
    NULL;
  END LOOP;
END;
/

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