Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined variable assignment in select using functions is not getting reassigned in TiDB #35348

Open
ramanich1 opened this issue Jun 14, 2022 · 1 comment
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 affects-6.4 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@ramanich1
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1,t2;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3); 
create table t2 (a int, key(a), b int);
insert into t2 values (1,1),(2,2);

set @cnt= 1; 
set @str="update t2 set b=1 where a not in (";
select count(*) from (
  select @str:=concat(@str, @cnt:=@cnt+1, ",") 
  from t1 A, t1 B, t1 C, t1 D) Z;
select @str;

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

 update t2 set b=1 where a not in (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,.......)

3. What did you see instead (Required)

mysql> select @str;
+------------------------------------+
| @str                               |
+------------------------------------+
| update t2 set b=1 where a not in ( |
+------------------------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

mysql> select version();
+-----------------------------------------------+
| version()                                     |
+-----------------------------------------------+
| 5.7.25-TiDB-v6.1.0-alpha-482-g81a852077-dirty |
+-----------------------------------------------+
1 row in set (0.00 sec)
@ramanich1 ramanich1 added the type/bug The issue is confirmed as a bug. label Jun 14, 2022
@ChenPeng2013 ChenPeng2013 added sig/execution SIG execution severity/major affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 labels Jun 14, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Jun 14, 2022
@zanmato1984
Copy link
Contributor

This is not a very common use. I'm adjusting it to moderate.

@ramanich1 ramanich1 changed the title User defined variable assignment in select is not getting reassigned in TiDB User defined variable assignment in select using functions is not getting reassigned in TiDB Jun 17, 2022
@zanmato1984 zanmato1984 added sig/planner SIG: Planner and removed sig/execution SIG execution labels Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 affects-6.3 affects-6.4 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants