stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

bug: SELECT from DATE type table with where query, return wrong result

Open davidshiz opened this issue 1 year ago • 5 comments

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • [X] I confirm there is no existing issue for this

Describe the problem

mysql> CREATE TABLE t1 ( a DATE );
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO t1 VALUES ('2009-09-22'), ('2009-09-22'), ('2009-09-22');
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> INSERT INTO t1 VALUES ('2009-09-23'), ('2009-09-23'), ('2009-09-23');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+------------+
| a          |
+------------+
| 2009-09-22 |
| 2009-09-22 |
| 2009-09-22 |
| 2009-09-23 |
| 2009-09-23 |
| 2009-09-23 |
+------------+
6 rows in set (0.00 sec)

mysql> SELECT * FROM t1 WHERE a >=  20090923;
+------------+
| a          |
+------------+
| 2009-09-22 |
| 2009-09-22 |
| 2009-09-22 |
| 2009-09-23 |
| 2009-09-23 |
| 2009-09-23 |
+------------+
6 rows in set (0.00 sec)

Expected behavior

mysql> SELECT * FROM t1 WHERE a >=  20090923;
+------------+
| a          |
+------------+
| 2009-09-23 |
| 2009-09-23 |
| 2009-09-23 |
+------------+
3 rows in set (0.00 sec)

How To Reproduce

No response

Environment

root@ub01:/stonedb57/install/bin# ./mysqld --version
./mysqld  Ver 5.7.36-StoneDB-v1.0.3 for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: d0665f9dc
        Last commit time: Date:   Wed Apr 12 10:52:39 2023 +0800
        Build time: Date: Wed Apr 12 19:37:30 CST 2023

Are you interested in submitting a PR to solve the problem?

  • [ ] Yes, I will!

davidshiz avatar Apr 14 '23 11:04 davidshiz