tidb icon indicating copy to clipboard operation
tidb copied to clipboard

User defined variable in subquery is not getting assigned in tidb.

Open ramanich1 opened this issue 3 years ago • 1 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set @str1 = 100;
select count(*) from ( select @str1:=200) a;
select @str1;

2. What did you expect to see? (Required)

mysql> select @str1;
+-------+
| @str1 |
+-------+
|   200 |
+-------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select @str1;
+-------+
| @str1 |
+-------+
|   100 |
+-------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.4.0-alpha-264-g6efa36df6
Edition: Community
Git Commit Hash: 6efa36df6cff325106f67ecfe3d79816ba37ca6a
Git Branch: master
UTC Build Time: 2021-12-28 02:03:55
GoVersion: go1.17.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |

ramanich1 avatar Jan 06 '22 01:01 ramanich1

Handling to planner as this seems a problem during compile.

zanmato1984 avatar May 16 '22 07:05 zanmato1984