1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly

This commit is contained in:
Alexander Barkov
2018-11-13 18:02:08 +04:00
parent 573c4db57a
commit 2a0b6de41b
12 changed files with 169 additions and 59 deletions

View File

@ -579,8 +579,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@2 0
1 set i@3 1
2 set [upper_bound]@4 a@0
3 jump_if_not 9(9) i@3 <= [upper_bound]@4
2 set [target_bound]@4 a@0
3 jump_if_not 9(9) i@3 <= [target_bound]@4
4 set total@2 total@2 + i@3
5 jump_if_not 7(7) i@3 = b@1
6 jump 9
@ -598,7 +598,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT
AS
total INT := 0;
BEGIN
FOR i IN REVERSE a..1
FOR i IN REVERSE 1..a
LOOP
total:= total + i;
IF i = b THEN
@ -612,8 +612,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@2 0
1 set i@3 a@0
2 set [upper_bound]@4 1
3 jump_if_not 9(9) i@3 >= [upper_bound]@4
2 set [target_bound]@4 1
3 jump_if_not 9(9) i@3 >= [target_bound]@4
4 set total@2 total@2 + i@3
5 jump_if_not 7(7) i@3 = b@1
6 jump 9
@ -651,12 +651,12 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@4 0
1 set ia@5 1
2 set [upper_bound]@6 a@0
3 jump_if_not 17(17) ia@5 <= [upper_bound]@6
2 set [target_bound]@6 a@0
3 jump_if_not 17(17) ia@5 <= [target_bound]@6
4 set total@4 total@4 + 1000
5 set ib@7 1
6 set [upper_bound]@8 b@2
7 jump_if_not 15(15) ib@7 <= [upper_bound]@8
6 set [target_bound]@8 b@2
7 jump_if_not 15(15) ib@7 <= [target_bound]@8
8 set total@4 total@4 + 1
9 jump_if_not 11(0) ib@7 = limitb@3
10 jump 15
@ -698,8 +698,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
2 set [upper_bound]@3 a@0
3 jump_if_not 11(11) i@2 <= [upper_bound]@3
2 set [target_bound]@3 a@0
3 jump_if_not 11(11) i@2 <= [target_bound]@3
4 set total@1 total@1 + 1000
5 jump_if_not 8(8) i@2 = 5
6 set i@2 i@2 + 1
@ -735,11 +735,11 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
2 set [upper_bound]@3 a@0
3 jump_if_not 16(16) i@2 <= [upper_bound]@3
2 set [target_bound]@3 a@0
3 jump_if_not 16(16) i@2 <= [target_bound]@3
4 set j@4 1
5 set [upper_bound]@5 2
6 jump_if_not 14(14) j@4 <= [upper_bound]@5
5 set [target_bound]@5 2
6 jump_if_not 14(14) j@4 <= [target_bound]@5
7 set total@1 total@1 + 1000
8 jump_if_not 11(11) i@2 = 5
9 set i@2 i@2 + 1
@ -778,11 +778,11 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set j@2 1
2 set [upper_bound]@3 2
3 jump_if_not 16(16) j@2 <= [upper_bound]@3
2 set [target_bound]@3 2
3 jump_if_not 16(16) j@2 <= [target_bound]@3
4 set i@4 1
5 set [upper_bound]@5 a@0
6 jump_if_not 14(14) i@4 <= [upper_bound]@5
5 set [target_bound]@5 a@0
6 jump_if_not 14(14) i@4 <= [target_bound]@5
7 set total@1 total@1 + 1000
8 jump_if_not 11(11) i@4 = 5
9 set i@4 i@4 + 1
@ -814,8 +814,8 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
2 set [upper_bound]@3 a@0
3 jump_if_not 10(10) i@2 <= [upper_bound]@3
2 set [target_bound]@3 a@0
3 jump_if_not 10(10) i@2 <= [target_bound]@3
4 jump_if_not 7(0) i@2 = 5
5 set i@2 i@2 + 1
6 jump 3