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

the result of prepare execute is incorrect #23290

Closed
aytrack opened this issue Mar 12, 2021 · 1 comment · Fixed by #23238
Closed

the result of prepare execute is incorrect #23290

aytrack opened this issue Mar 12, 2021 · 1 comment · Fixed by #23238
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Mar 12, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t (  `COL102` mediumint(25) DEFAULT NULL,  `COL103` mediumint(25) DEFAULT NULL,  `COL1` mediumint(25) GENERATED ALWAYS AS (`COL102` / 10) STORED NOT NULL,  `COL2` varchar(20) DEFAULT NULL,  `COL4` datetime DEFAULT NULL,  `COL3` bigint(20) DEFAULT NULL,  `COL5` float DEFAULT NULL,  PRIMARY KEY (`COL1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

insert into t (COL102,COL103,COL2,COL4,COL3,COL5) values(11,19,"abcd","9289\-01\-03\ 22:36:43",-7766341800212896104,2.335516840459477e+38); 
insert into t (COL102,COL103,COL2,COL4,COL3,COL5) values(22,12,"abcd","0335\-11\-19\ 22:51:03",-4154892179550291056,-3.23035740051128e+38); 
insert into t (COL102,COL103,COL2,COL4,COL3,COL5) values(33,9,"abcd","5703\-06\-21\ 10:01:55",-8469066621231379353,1.478085071191862e+38);    
prepare stmt from 'select col1, col2 from t where col1 between ? and ?;';
set @a=1, @b=1;
execute stmt using@a,@b;
set @a=1, @b=10;
execute stmt using@a,@b;

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

mysql > set @a=1, @b=1;
Query OK, 0 rows affected
Time: 0.044s
mysql > execute stmt using@a,@b;
+------+------+
| col1 | col2 |
+------+------+
| 1    | abcd |
+------+------+

1 row in set
Time: 0.054s
mysql > set @a=1, @b=10;
Query OK, 0 rows affected
Time: 0.053s
mysql > execute stmt using@a,@b;
+------+------+
| col1 | col2 |
+------+------+
| 1    | abcd |
| 2    | abcd |
| 3    | abcd |
+------+------+

3. What did you see instead (Required)

mysql > prepare stmt from 'select col1, col2 from t where col1 between ? and ?;';
Query OK, 0 rows affected
Time: 0.001s
mysql > set @a=1, @b=1;
Query OK, 0 rows affected
Time: 0.001s
mysql > execute stmt using@a,@b;
+------+------+
| col1 | col2 |
+------+------+
| 1    | abcd |
+------+------+

1 row in set
Time: 0.008s
mysql > set @a=1, @b=10;
Query OK, 0 rows affected
Time: 0.001s
mysql root@127.0.0.1:test> execute stmt using@a,@b;
+--------+--------+
| COL102 | COL103 |
+--------+--------+
| 1      | abcd   |
+--------+--------+

4. What is your TiDB version? (Required)

release-4.0: 122ee4d
master: b42a6f4
5.0-rc: fd4437d

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
3 participants