oceanbase icon indicating copy to clipboard operation
oceanbase copied to clipboard

OceanBase can not use 'PS' as table alias

Open lenmore opened this issue 2 years ago • 1 comments

Please check the issue list for the same bug

  • [X] I have checked issue list and this bug is encountered for the first time.

Environment

3.1.3-OceanBase CE

Fast Reproduce Steps(Required)

SELECT * FROM oceanbase.gv$partition ps limit 1; SELECT * FROM oceanbase.gv$partition as ps limit 1;

Actual Behavior

MySQL [(none)]> SELECT * FROM oceanbase.gv$partition ps limit 1; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'ps limit 1' at line 1

Expected Behavior

No response

other information

文档中并未说ps是预留关键字:https://open.oceanbase.com/docs/observer-cn/V3.1.3/10000000000096661

lenmore avatar Apr 24 '22 11:04 lenmore

这个确实是个bug,应该把PS加到非预留关键字列表里面,改一下.y文件就行;你有兴趣的话,可以帮忙改一下,提交一个PR;

caifeizhi avatar May 05 '22 07:05 caifeizhi

在OceanBase 3.2.4企业版中,复现了这个问题,仍未解决

YoungGry avatar Apr 15 '24 09:04 YoungGry

最新版本已经解决该问题:

obclient [test]> select * from t ps, t t1;
+------+------+------+------+
| a    | b    | a    | b    |
+------+------+------+------+
|    1 | NULL |    1 | NULL |
|    1 | NULL |    2 | NULL |
obclient [test]> select version();
+---------------------------+
| version()                 |
+---------------------------+
| 5.7.25-OceanBase-v4.3.0.1 |
+---------------------------+

hnwyllmm avatar Apr 15 '24 09:04 hnwyllmm

在OceanBase 3.2.4企业版中,复现了这个问题,仍未解决

这个问题是在社区版 4.X和3.1.X 上完成修复的; 社区版和企业版在 4.x 上代码是同源的,所以企业版 4.x 也是修复了; 企业版 3.2.4 可能还没有Patch,如果需要可以给对应的企业版技术支持同学提这块的需求

caifeizhi avatar Apr 15 '24 09:04 caifeizhi