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

Invalid results using BETWEEN...AND... with type conversion #11177

Closed
SunRunAway opened this issue Jul 10, 2019 · 7 comments · Fixed by #19820
Closed

Invalid results using BETWEEN...AND... with type conversion #11177

SunRunAway opened this issue Jul 10, 2019 · 7 comments · Fixed by #19820
Labels
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jul 10, 2019

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

Invalid results using BETWEEN...AND... with type conversation.

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
SELECT 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0;
  1. What did you expect to see?
mysql> SELECT 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0;
+-----------------------------------------------+
| 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0 |
+-----------------------------------------------+
|                                             0 |
+-----------------------------------------------+
1 row in set, 2 warnings (0.00 sec)

mysql> show warnings;
+---------+------+---------------------------------------------------------+
| Level   | Code | Message                                                 |
+---------+------+---------------------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'lvuleck'             |
| Warning | 1292 | Truncated incorrect DOUBLE value: '2008-09-16 22:23:50' |
+---------+------+---------------------------------------------------------+
2 rows in set (0.00 sec)
  1. What did you see instead?
mysql> SELECT 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 38.8;
+--------------------------------------------------+
| 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 38.8 |
+--------------------------------------------------+
|                                                1 |
+--------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------+
| Level   | Code | Message        |
+---------+------+----------------+
| Warning | 1265 | Data Truncated |
+---------+------+----------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

SIG slack channel

#sig-exec

Score

  • 300

Mentor

@SunRunAway SunRunAway added type/bug The issue is confirmed as a bug. component/expression and removed component/expression labels Jul 10, 2019
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@ghost
Copy link

ghost commented Jul 11, 2020

Confirming this can still be reproduced:

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-745-g2b0b34b88
Edition: Community
Git Commit Hash: 2b0b34b88e43ad20f4e5ab1a0b5daf7ae6ff6046
Git Branch: master
UTC Build Time: 2020-07-09 10:12:32
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

mysql> SELECT 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0;
+-----------------------------------------------+
| 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0 |
+-----------------------------------------------+
|                                             1 |
+-----------------------------------------------+
1 row in set, 1 warning (0.01 sec)

@ghost ghost changed the title Invalid results using BETWEEN...AND... with type conversation. Invalid results using BETWEEN...AND... with type conversion Jul 11, 2020
@xiongjiwei
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@xiongjiwei You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Nov 11, 2020
@xiongjiwei
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@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
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants