Repository navigation
Closed
Labels
Milestone
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
1.2-dev
Commit ID
Other Environment Information
- Hardware parameters: 8c 16g
- OS type: All Linux and Mac Distrubutions
- Others: allActual Behavior
- In MO
github@test0-10-222-4-0:/data/mo/1.2-dev/matrixone$ mo_ctl connect
2024-06-04 14:18:55.439 UTC+0800 [INFO] Checking connectivity
2024-06-04 14:18:55.529 UTC+0800 [INFO] Ok, connecting for user ...
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4662
Server version: 8.0.30-MatrixOne-v3688943 MatrixOne
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test;
Query OK, 1 row affected (0.02 sec)
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> create table t1(id int);
Query OK, 0 rows affected (0.03 sec)
mysql> select * from t1 limit 0, 18446744073709551615;
ERROR 1149 (HY000): SQL syntax error: only int64 support in limit/offset clause
mysql> select git_version();
+---------------+
| git_version() |
+---------------+
| d36f88943 |
+---------------+
1 row in set (0.00 sec)- In MySQL
5.7.42
root@mo-sz-0:~# mysql57
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42 MySQL Community Server (GPL)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
mysql> use test;
Database changed
mysql> create table t1(id int);
Query OK, 0 rows affected (0.01 sec)
mysql> select * from t1 limit 0, 18446744073709551615;
Empty set (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.42 |
+-----------+
1 row in set (0.00 sec)- In MySQL
8.0.31
root@mo-sz-0:~# mysql80
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.31 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> drop table t1;
Query OK, 0 rows affected (0.02 sec)
mysql> create table t1(id int);
Query OK, 0 rows affected (0.03 sec)
mysql> select * from t1 limit 0, 18446744073709551615;
Empty set (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.31 |
+-----------+
1 row in set (0.00 sec)Expected Behavior
MO behaves the same as what MySQL does.
Steps to Reproduce
create database if not exists test;
use test;
drop table if exists t1;
create table t1(id int);
select * from t1 limit 0, 18446744073709551615;Additional information
As per https://dev.mysql.com/doc/refman/8.4/en/select.html, limit can take up to 2 parameters (Offset, Limit) , and the limit value can be set to a very large one in order to retrieve all rows from a table(in case you don't know the number of rows in that table).
To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:
SELECT * FROM tbl LIMIT 95,18446744073709551615;
Activity
daviszhen commentedon Jun 4, 2024
数值越界
aronchanisme commentedon Jun 4, 2024
2^64 = 18446744073709551616which is exactly1larger than the given limit number18446744073709551615.In MySQL 8.0.31, it seems like only limit number less than or equal to
18446744073709551615is allowed, otherwise mysql will thows ansyntax errorexpection.Corresponding mo source code:
matrixone/pkg/sql/plan/limit_binder.go
Line 88 in b076d9c
daviszhen commentedon Jun 5, 2024
pr中
daviszhen commentedon Jun 6, 2024
pr中
daviszhen commentedon Jun 7, 2024
pr中
aronchanisme commentedon Jun 9, 2024
Fixed in
main(1790d7e63) and1.2-dev(4d3b371e4). Bvt cases are also added. Closing it as completed.main1.2-dev