databendlabs / databend

𝗗𝗮𝘁𝗮, 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 & 𝗔𝗜. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.88k stars 751 forks source link

bug: order by literal with limit return error #16914

Open b41sh opened 9 hours ago

b41sh commented 9 hours ago

Search before asking

Version

v1.2.662

What's Wrong?

order by literal with limit return error

we can ignore order by item if it is a scalar value

How to Reproduce?

MySQL [(none)]> create table tt(a int, b int);
Query OK, 0 rows affected (0.187 sec)

MySQL [(none)]> insert into tt values(1, 2),(3, 4);
Query OK, 2 rows affected (0.209 sec)

MySQL [(none)]> select eq(tt.a, b) FROM tt ORDER BY 'a' LIMIT 89, 7;
ERROR 1105 (HY000): BadArguments. Code: 1006, Text = Unable to get field named "0". Valid fields: ["4"].

Are you willing to submit PR?