Skip to content

Unexpected error in Mod function #59000

@curry-oss

Description

@curry-oss

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS t0;
DROP TABLE IF EXISTS t1;
CREATE TABLE t0(c0 INTEGER, c1 INTEGER);
INSERT IGNORE INTO t0 VALUES (1, 2);
INSERT IGNORE INTO t0 VALUES (4, 6);
SELECT MOD(3, 1 BETWEEN c0 AND c1) FROM t0;

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

see the following case:
I observed that the TiDB documentation includes references to the MySQL manual:https://docs.pingcap.com/zh/tidb/stable/numeric-functions-and-operators

3. What did you see instead (Required)

// MySQL 8.4.1
mysql> SELECT MOD(3, 1 BETWEEN c0 AND c1) FROM t0;
+-----------------------------+
| MOD(3, 1 BETWEEN c0 AND c1) |
+-----------------------------+
|                           0 |
|                        NULL |
+-----------------------------+
2 rows in set, 1 warning (0.01 sec)

// TiDB
mysql> SELECT MOD(3, 1 BETWEEN c0 AND c1) FROM t0;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 23 near "BETWEEN c0 AND c1) FROM t0"

4. What is your TiDB version? (Required)

mysql> select version();
+--------------------+
| version() |
+--------------------+
| 8.0.11-TiDB-v8.5.0 |
+--------------------+
1 row in set (0.04 sec)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions