[MDEV-15123] Make multiple user variable assignment work similar in standalone query and in SP Created: 2018-01-30  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Stored routines, Variables
Fix Version/s: 10.4

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

Issue Links:
Relates
relates to MDEV-13417 UPDATE produces wrong values if an up... Closed
relates to MDEV-13418 Compatibility: The order of evaluatio... Stalled
relates to MDEV-15122 Simultaneous assignment for LOAD..SET Open
relates to MDEV-15124 Simultaneous assignment for INSERT ..... Open

 Description   

I run this script:

SET @a=10;
SET @a=20,@b=@a;
SELECT @a,@b;

+------+------+
| @a   | @b   |
+------+------+
|   20 |   10 |
+------+------+

No I wrap the same script into an anonymous SP block:

DELIMITER $$
BEGIN NOT ATOMIC
SET @a=10;
SET @a=20,@b=@a;
SELECT @a,@b;
END
$$

+------+------+
| @a   | @b   |
+------+------+
|   20 |   20 |
+------+------+

Notice:

  • in the standalone script @b was assigned to the initial value of @a
  • in the anonymous block @b was assigned to the new value of @a

We'll make multiple SET inside an SP work the same way with a standalone SET.

Note, multiple SET for SP variables should also work the same way.


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