Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3
Description
Both the following example show that NOT FOUND condition does not occur.
This is a different problem than MDEV-16305. In that report, I shows HANDLERs which are never triggered even if the condition occurs. Here I show that a condition doesn't occur at all.
Realistic test:
CREATE AGGREGATE FUNCTION test1(p_value TEXT) |
RETURNS BOOL |
BEGIN
|
DECLARE CONTINUE HANDLER |
FOR NOT FOUND |
BEGIN |
RETURN FALSE; |
END; |
FETCH GROUP NEXT ROW; |
RETURN TRUE; |
END; |
|
CREATE TABLE t_empty ( |
a INT |
) ENGINE InnoDB;
|
|
MariaDB [test]> SELECT test1(n) FROM t; |
+----------+ |
| test1(n) |
|
+----------+ |
| 1 |
|
+----------+ |
1 row in set (0.000 sec) |
Trivial test to prove that the problem is not HANDLER:
CREATE AGGREGATE FUNCTION test2(p_value TEXT) |
RETURNS BOOL |
BEGIN
|
FETCH GROUP NEXT ROW; |
FETCH GROUP NEXT ROW; |
FETCH GROUP NEXT ROW; |
RETURN TRUE; |
END; |
|
MariaDB [test]> SELECT test2(n) FROM t; |
+----------+ |
| test2(n) |
|
+----------+ |
| NULL | |
+----------+ |
1 row in set (0.001 sec) |
|
MariaDB [test]> SHOW WARNINGS;
|
Empty set (0.000 sec) |