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

Unknown error when WHERE clause contains both "NOT" and "OR" operators #850

Closed
anitajjx opened this issue Sep 24, 2021 · 6 comments
Closed
Assignees
Labels
kind/bug Something isn't working kind/tech-request New feature or request priority/p1 Medium priority feature that should be implemented in this version severity/s1 High impact: Logical errors or data errors that must occur triage/accepted
Milestone

Comments

@anitajjx
Copy link
Contributor

Can be reproduced ?

Yes

Steps:

CREATE TABLE t1 (spID int,userID int,score smallint);
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t1 VALUES (2,2,2);
INSERT INTO t1 VALUES (2,1,4);
INSERT INTO t1 VALUES (3,3,3);
INSERT INTO t1 VALUES (1,1,5);
INSERT INTO t1 VALUES (4,6,10);
INSERT INTO t1 VALUES (5,11,99);

SELECT * FROM t1 where t1.userID<6 OR NOT t1.userID;
SELECT * FROM t1 where NOT t1.userID OR t1.userID<6;
SELECT * FROM t1 where NOT t1.userID || t1.userID<6;

Expected behavior:

mysql> SELECT * FROM t1 where NOT t1.userID || t1.userID<6;
+------+--------+-------+
| spID | userID | score |
+------+--------+-------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 2 | 1 | 4 |
| 3 | 3 | 3 |
| 1 | 1 | 5 |
+------+--------+-------+
5 rows in set, 1 warning (0.00 sec)

Actual behavior:

mysql> SELECT * FROM t1 where t1.userID<6 OR NOT t1.userID;
ERROR 1105 (HY000): unknown error:[42000][42000][42000]or not yet implemented for SEL, INT
mysql> SELECT * FROM t1 where NOT t1.userID OR t1.userID<6;
ERROR 1105 (HY000): unknown error:[42000][42000][42000]or not yet implemented for INT, SEL
mysql> SELECT * FROM t1 where NOT t1.userID || t1.userID<6;
ERROR 1105 (HY000): unknown error:[42000][42000][42000]or not yet implemented for INT, SEL

Environment:

  • Version or commit-id (e.g. v0.1.0 or 8b23a93):commit 3aebaf5
  • Hardware parameters:
  • OS type:
  • Others:

Configuration file:

Additional context:

  • Error message from client:
  • Server log:
  • Other information:
@anitajjx anitajjx added kind/bug Something isn't working needs-triage labels Sep 24, 2021
@anitajjx anitajjx added priority/p1 Medium priority feature that should be implemented in this version severity/s1 High impact: Logical errors or data errors that must occur labels Sep 24, 2021
@anitajjx anitajjx added this to the v0.1.0 milestone Sep 24, 2021
@nnsgmsone
Copy link
Contributor

This question is the same as issue782. The direct not attribute is not supported at this time

@anitajjx
Copy link
Contributor Author

But there is no error when querying with NOT and AND operators together, please see below:

mysql> SELECT * FROM t1 where NOT t1.userID AND t1.userID<6;
+------+--------+-------+
| spID | userID | score |
+------+--------+-------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 2 | 1 | 4 |
| 3 | 3 | 3 |
| 1 | 1 | 5 |
+------+--------+-------+
5 rows in set (0.01 sec)

@nnsgmsone
Copy link
Contributor

There is no handling of queries that directly treat columns as filter conditions, so the behavior may be odd.

@lignay lignay modified the milestones: v0.1.0, v0.2.0 Sep 24, 2021
@JinHai-CN JinHai-CN added the kind/tech-request New feature or request label Oct 14, 2021
@JinHai-CN JinHai-CN assigned m-schen and unassigned nnsgmsone Nov 11, 2021
@m-schen
Copy link
Contributor

m-schen commented Nov 11, 2021

support.

@m-schen
Copy link
Contributor

m-schen commented Dec 20, 2021

fixed. but there is a bug #1428 that.
you can verify this issue with where NOT userID || userID<6; instead of where NOT t1.userID || t1.userID<6;

@m-schen m-schen removed their assignment Dec 20, 2021
@lignay
Copy link
Contributor

lignay commented Dec 21, 2021

Fixed on dac6e12

@lignay lignay closed this as completed Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working kind/tech-request New feature or request priority/p1 Medium priority feature that should be implemented in this version severity/s1 High impact: Logical errors or data errors that must occur triage/accepted
Projects
None yet
Development

No branches or pull requests

5 participants