Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6.10, 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL)
Description
Was looking to upgrade to 10.6 but ran into a very specific bug that is blocking us:
CREATE OR REPLACE FUNCTION bug_demo()
|
RETURNS BOOL CONTAINS SQL DETERMINISTIC
|
RETURN (WITH RECURSIVE cte1 AS (SELECT 0 AS num),
|
cte2 AS (SELECT JSON_EXTRACT('[{"foo": "bar"}]', '$[0].foo') AS value FROM cte1),
|
cte3 AS (SELECT value = '"bar"' AS baz FROM cte2) SELECT baz FROM cte3);
|
SELECT bug_demo(), bug_demo(), bug_demo();
|
 |
+------------+------------+------------+
|
| bug_demo() | bug_demo() | bug_demo() |
|
+------------+------------+------------+
|
| 1 | 0 | 0 |
|
+------------+------------+------------+
|
|
The first returned value (1) is correct but then returns an incorrect value (0) on any further calls. Re-creating the function repeats the pattern.
Works correctly in 10.4