Alexander Barkov
534a2bf1c6
MDEV-32275 getting error 'Illegal parameter data types row and bigint for operation '+' ' when using ITERATE in a FOR..DO
...
An "ITERATE innerLoop" did not work properly inside
a WHILE loop, which itself is inside an outer FOR loop:
outerLoop:
FOR
...
innerLoop:
WHILE
...
ITERATE innerLoop;
...
END WHILE;
...
END FOR;
It erroneously generated an integer increment code for the outer FOR loop.
There were two problems:
1. "ITERATE innerLoop" worked like "ITERATE outerLoop"
2. It was always integer increment, even in case of FOR cursor loops.
Background:
- A FOR loop automatically creates a dedicated sp_pcontext stack entry,
to put the iteration and bound variables on it.
- Other loop types (LOOP, WHILE, REPEAT), do not generate a dedicated
slack entry.
The old code erroneously assumed that sp_pcontext::m_for_loop
either describes the most inner loop (in case the inner loop is FOR),
or is empty (in case the inner loop is not FOR).
But in fact, sp_pcontext::m_for_loop is never empty inside a FOR loop:
it describes the closest FOR loop, even if this FOR loop has nested
non-FOR loops inside.
So when we're near the ITERATE statement in the above script,
sp_pcontext::m_for_loop is not empty - it stores information about
the FOR loop labeled as "outrLoop:".
Fix:
- Adding a new member sp_pcontext::Lex_for_loop::m_start_label,
to remember the explicit or the auto-generated label correspoding
to the start of the FOR body. It's used during generation
of "ITERATE loop_label" code to check if "loop_label" belongs
to the current FOR loop pointed by sp_pcontext::m_for_loop,
or belongs to a non-FOR nested loop.
- Adding LEX methods sp_for_loop_intrange_iterate() and
sp_for_loop_cursor_iterate() to reuse the code between
methods handling:
* ITERATE
* END FOR
- Adding a test for Lex_for_loop::is_for_loop_cursor()
and generate a code either a cursor fetch, or for an integer increment.
Before this change, it always erroneously generated an integer increment
version.
- Cleanup: Initialize Lex_for_loop_st::m_cursor_offset inside
Lex_for_loop_st::init(), to avoid not initialized members.
- Cleanup: Removing a redundant method:
Lex_for_loop_st::init(const Lex_for_loop_st &other)
Using Lex_for_loop_st::operator(const Lex_for_loop_st &other) instead.
2023-10-04 16:06:59 +04:00
..
2023-07-03 15:46:24 +02:00
2023-08-10 19:52:04 +02:00
2023-08-28 16:47:00 +07:00
2020-08-03 14:44:06 +02:00
2021-04-20 12:30:09 +03:00
2022-03-23 10:47:27 +11:00
2021-02-01 13:49:33 +01:00
2023-04-01 22:31:30 +02:00
2023-07-07 15:15:24 +07:00
2023-02-09 16:09:08 +02:00
2020-08-03 13:41:29 +02:00
2023-01-20 19:43:40 +01:00
2020-08-03 14:44:06 +02:00
2023-02-09 16:09:08 +02:00
2021-04-22 07:51:33 +03:00
2022-04-18 12:44:27 +03:00
2023-02-09 16:09:08 +02:00
2020-08-03 14:44:06 +02:00
2022-09-23 13:40:42 +03:00
2021-06-21 12:38:25 +03:00
2022-08-31 11:05:23 +03:00
2020-04-02 00:57:00 +04:00
2023-08-15 07:00:17 +04:00
2023-05-12 12:19:44 +04:00
2023-04-04 12:30:50 +04:00
2020-07-14 22:59:19 +03:00
2023-02-09 16:09:08 +02:00
2023-02-17 16:08:50 +02:00
2022-09-23 13:40:42 +03:00
2023-02-09 16:09:08 +02:00
2022-05-15 20:37:51 +02:00
2022-05-15 20:37:51 +02:00
2021-04-22 15:51:55 +02:00
2023-02-09 16:09:08 +02:00
2023-07-07 14:27:17 +02:00
2023-02-14 11:23:39 +03:00
2023-05-02 10:09:27 +02:00
2020-10-28 14:24:10 +01:00
2023-09-26 10:47:59 +05:30
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2023-07-20 13:10:02 +02:00
2023-04-26 16:15:29 +02:00
2023-06-07 15:08:29 +02:00
2023-05-03 17:28:12 +04:00
2023-09-28 15:05:44 +02:00
2023-07-19 09:07:12 +04:00
2023-02-09 16:09:08 +02:00
2021-03-31 09:47:14 +03:00
2023-02-09 16:09:08 +02:00
2023-01-05 13:12:24 +00:00
2023-02-14 12:03:28 +11:00
2020-03-30 14:50:23 +03:00
2023-07-19 11:18:16 +04:00
2023-01-20 11:40:01 +02:00
2023-05-08 11:42:24 -07:00
2023-02-09 16:09:08 +02:00
2023-03-02 07:51:33 -08:00
2023-02-09 16:09:08 +02:00
2023-10-04 08:51:48 +04:00
2020-10-29 13:38:38 +02:00
2021-10-13 12:03:32 +03:00
2021-05-05 23:03:01 +03:00
2022-02-10 20:39:13 +01:00
2020-07-31 18:09:08 +03:00
2023-06-26 11:03:15 +03:00
2023-09-20 11:05:34 +07:00
2023-04-26 16:15:29 +02:00
2023-04-04 12:30:50 +04:00
2020-11-03 14:49:17 +02:00
2021-06-30 18:41:46 +03:00
2022-08-31 11:05:23 +03:00
2020-08-31 18:45:14 +03:00
2023-09-06 22:38:41 +02:00
2023-04-10 12:18:16 +02:00
2023-09-29 12:54:04 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2020-11-02 15:48:47 +02:00
2021-04-21 07:25:48 +03:00
2020-03-17 02:16:48 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2020-02-11 14:40:35 +01:00
2020-11-03 14:49:17 +02:00
2021-11-09 12:06:49 +02:00
2023-02-09 16:09:08 +02:00
2023-01-28 18:22:55 +01:00
2021-12-25 12:13:03 +01:00
2023-09-13 20:17:29 +10:00
2023-06-06 08:11:38 -06:00
2022-09-23 17:37:52 +03:00
2020-02-19 21:29:49 +03:00
2020-05-30 11:04:27 +03:00
2023-07-31 22:46:47 +02:00
2023-02-09 16:09:08 +02:00
2023-06-07 15:08:29 +02:00
2023-05-08 11:42:24 -07:00
2022-06-09 11:53:46 +03:00
2021-03-20 13:04:36 +02:00
2023-02-09 16:09:08 +02:00
2020-03-09 14:53:35 +02:00
2020-04-02 11:50:47 +03:00
2020-03-09 13:52:40 +02:00
2022-09-30 12:11:37 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2022-12-02 16:19:13 +01:00
2023-02-09 16:09:08 +02:00
2022-01-30 09:46:52 +01:00
2023-02-09 16:09:08 +02:00
2019-11-27 20:50:06 +01:00
2022-02-10 20:23:56 +01:00
2020-08-10 18:40:57 +03:00
2023-09-25 15:13:07 +03:00
2023-09-25 15:13:07 +03:00
2020-09-03 09:26:54 +03:00
2023-08-08 03:25:56 +02:00
2023-07-04 22:18:31 +02:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2021-10-21 14:57:00 +03:00
2021-10-21 14:57:00 +03:00
2023-09-07 14:40:05 +02:00
2023-07-12 09:41:32 +02:00
2022-09-23 13:40:42 +03:00
2023-09-28 19:28:25 +02:00
2020-11-12 15:39:02 +05:30
2020-03-26 15:01:44 +03:00
2023-02-09 16:09:08 +02:00
2021-04-27 08:53:50 +03:00
2023-02-09 16:09:08 +02:00
2023-03-23 13:39:46 +01:00
2023-02-09 16:09:08 +02:00
2022-04-22 12:59:54 -06:00
2023-02-09 16:09:08 +02:00
2023-05-22 00:33:37 +02:00
2023-07-20 10:42:30 +02:00
2023-02-09 16:09:08 +02:00
2021-07-31 22:59:58 +02:00
2023-02-09 16:09:08 +02:00
2023-03-08 13:25:30 +00:00
2023-09-13 12:01:47 -06:00
2023-05-02 10:09:27 +02:00
2022-05-03 10:59:54 +02:00
2023-09-02 13:00:00 +07:00
2023-09-02 13:00:00 +07:00
2023-10-04 16:06:59 +04:00
2023-07-07 15:36:46 +02:00
2023-02-09 16:09:08 +02:00
2022-12-09 08:49:43 +11:00
2023-02-09 16:09:08 +02:00
2023-07-23 19:23:51 +02:00
2023-02-09 16:09:08 +02:00
2023-09-26 08:24:39 +02:00
2023-02-09 16:09:08 +02:00
2023-01-20 11:40:01 +02:00
2023-02-09 16:09:08 +02:00
2022-10-05 10:09:49 +03:00
2022-10-25 11:43:32 -07:00
2022-09-14 19:15:44 +02:00
2021-08-11 23:00:37 +04:00
2023-09-29 12:54:04 +02:00
2023-02-09 16:09:08 +02:00
2022-09-23 13:40:42 +03:00
2023-02-09 16:09:08 +02:00
2021-11-09 17:04:49 +02:00
2022-09-23 13:40:42 +03:00
2023-02-09 16:09:08 +02:00
2023-09-29 12:54:04 +02:00
2023-09-29 12:54:04 +02:00
2023-02-09 16:09:08 +02:00
2023-01-03 16:10:02 +02:00
2021-07-24 15:08:08 +02:00
2022-11-27 05:11:39 +10:00
2023-02-09 16:09:08 +02:00
2023-01-28 18:22:55 +01:00
2023-01-28 18:22:55 +01:00
2023-02-09 16:09:08 +02:00
2021-10-28 12:01:25 +02:00
2019-12-09 15:09:41 +01:00
2023-02-09 16:09:08 +02:00
2023-03-25 12:36:59 -07:00
2023-07-03 15:46:24 +02:00
2021-06-30 18:41:46 +03:00
2023-09-29 12:54:04 +02:00
2023-09-29 12:54:04 +02:00
2023-03-25 12:36:59 -07:00
2023-03-25 12:36:59 -07:00
2022-05-03 10:59:54 +02:00
2023-02-09 16:09:08 +02:00
2022-05-08 23:03:08 +02:00
2020-12-25 09:13:28 +01:00
2023-09-29 12:54:04 +02:00
2023-09-25 15:13:07 +03:00
2023-08-10 17:35:37 +03:00
2023-10-04 16:06:59 +04:00
2023-10-04 16:06:59 +04:00
2023-02-09 16:09:08 +02:00
2023-01-28 18:22:55 +01:00
2023-09-06 22:38:41 +02:00
2023-02-15 22:39:38 +11:00
2022-04-25 08:07:17 -06:00
2021-01-24 11:35:55 +01:00
2023-09-06 22:38:41 +02:00
2021-03-05 10:36:51 +02:00
2022-08-31 11:05:23 +03:00
2023-02-09 16:09:08 +02:00
2022-06-27 10:14:37 +03:00
2023-05-22 00:33:37 +02:00
2023-07-25 18:24:20 +10:00
2021-02-12 17:44:22 +01:00
2023-09-02 13:00:00 +07:00
2023-02-09 16:09:08 +02:00
2022-08-31 11:05:23 +03:00
2023-03-23 13:39:46 +01:00
2021-02-12 17:44:22 +01:00
2023-04-29 08:06:46 +04:00
2023-04-29 08:06:46 +04:00
2023-09-25 15:13:07 +03:00
2023-09-25 15:13:07 +03:00
2023-09-27 08:54:26 +02:00
2023-09-27 08:54:26 +02:00
2019-12-02 12:41:13 +02:00
2023-09-02 13:00:00 +07:00
2021-02-12 18:17:07 +01:00
2023-02-09 16:09:08 +02:00
2023-02-17 16:08:50 +02:00
2023-04-28 22:39:25 +03:00
2021-02-23 09:25:57 +01:00
2023-10-04 08:51:48 +04:00
2023-10-04 08:51:48 +04:00
2023-09-29 12:54:04 +02:00
2023-05-12 02:48:15 +02:00
2021-04-20 12:30:09 +03:00
2022-10-25 10:04:37 +03:00
2020-07-31 18:09:08 +03:00
2022-10-01 23:07:26 +02:00
2022-09-30 12:11:37 +02:00
2021-09-17 07:18:37 +03:00
2023-02-09 16:09:08 +02:00
2023-09-23 20:11:52 -07:00
2023-09-23 20:11:52 -07:00
2023-06-29 11:50:17 +04:00
2023-02-09 16:09:08 +02:00
2023-03-29 11:56:44 +04:00
2023-02-17 16:08:50 +02:00
2022-09-23 13:47:15 +03:00
2020-10-22 13:27:18 +03:00
2023-07-03 15:46:24 +02:00
2023-07-20 18:22:31 +03:00
2023-02-27 10:51:22 -08:00
2022-10-24 14:09:46 +02:00
2023-09-27 07:48:01 -07:00
2023-02-09 16:09:08 +02:00
2023-05-03 17:28:12 +04:00
2023-05-03 17:28:12 +04:00
2022-08-10 12:21:08 +02:00
2023-10-04 16:06:59 +04:00
2023-02-09 16:09:08 +02:00
2023-09-13 20:17:29 +10:00
2023-07-20 10:42:30 +02:00
2023-05-19 15:50:20 +03:00
2020-03-21 18:37:19 +04:00
2023-05-16 13:11:44 +02:00
2023-05-02 23:43:12 +03:00
2022-03-29 11:13:18 +03:00
2023-09-29 09:30:49 +02:00
2023-02-09 16:09:08 +02:00
2020-03-27 11:41:46 +04:00
2023-02-09 16:09:08 +02:00
2021-07-02 11:48:51 +03:00
2023-02-09 16:09:08 +02:00
2023-02-09 16:09:08 +02:00
2020-06-13 15:11:43 +03:00
2020-06-12 10:55:53 +03:00
2022-03-29 11:13:18 +03:00
2023-01-03 16:10:02 +02:00
2021-02-01 13:49:33 +01:00
2023-02-09 16:09:08 +02:00
2023-02-09 09:15:08 +01:00
2020-07-15 09:49:48 +02:00
2020-12-01 14:55:46 +02:00
2022-08-31 11:05:23 +03:00
2020-03-31 09:59:37 +03:00
2022-08-31 11:05:23 +03:00
2023-04-18 13:57:59 +02:00
2020-11-11 07:37:05 +02:00
2023-02-09 16:09:08 +02:00
2023-05-22 00:33:37 +02:00
2023-05-22 00:33:37 +02:00
2019-12-16 07:50:15 +02:00
2022-02-23 07:18:00 +02:00
2023-09-26 08:36:16 +02:00
2023-08-08 03:25:56 +02:00
2023-09-11 23:06:15 +02:00
2023-09-29 12:54:04 +02:00
2023-08-08 03:25:56 +02:00
2023-05-23 01:10:19 +02:00
2023-05-16 13:11:44 +02:00
2023-08-08 03:25:56 +02:00
2023-05-22 00:33:37 +02:00
2023-02-09 16:09:08 +02:00
2023-05-12 02:48:16 +02:00
2022-06-27 10:14:37 +03:00
2020-12-02 16:16:29 +02:00
2019-10-30 10:45:22 +02:00
2023-05-22 00:33:37 +02:00
2023-05-22 00:33:37 +02:00
2023-09-26 08:24:39 +02:00
2020-08-26 11:30:20 +03:00
2023-09-11 23:06:15 +02:00
2022-10-09 10:09:47 +03:00
2021-04-05 09:10:23 +03:00
2023-05-19 15:50:20 +03:00