matrixone
matrixone copied to clipboard
[Bug]: `\` is getting removed automatically by MO Parser
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Branch Name
main, 1.1-dev, 1.0-dev
Commit ID
ff71417e313eb30171e754e98f291f8da5a475b0
Other Environment Information
- Hardware parameters:
- OS type:
- Others:
Actual Behavior
mysql> select substring("\abc",2);
+-------------------+
| substring(abc, 2) |
+-------------------+
| bc |
+-------------------+
1 row in set (0.01 sec)
Expected Behavior
mysql> SELECT SUBSTRING('\abc' FROM 2);
+-------------------+
| substring(abc, 2) |
+-------------------+
| abc |
+-------------------+
1 row in set (0.01 sec)
Steps to Reproduce
1. Run a query that accepts a string argument
2. MO Parser automatically skips `\`
Additional information
No response
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
暂未处理
I think we might not need this change.
MySQL skips \
values. However, postgres does not skip \
values.
Previously encode/decode was built based on Postgres API and hence during the testing of encode/decode
the skipping of \
was creating a discrepancy in actual vs expected output.
https://github.com/matrixorigin/matrixone/issues/13825#issuecomment-1870166351
However, we are planning to refactor the current encode/decode
to corresponding MySQL functions (hex(), base64()).
https://github.com/matrixorigin/matrixone/issues/15027
In that case, we don't have an issue with \
being skipped.
mo 对 \ 处理是参照 mysql 的 https://dev.mysql.com/doc/refman/5.7/en/string-literals.html, 如果不想跳过 \ , 可以用 \
Closing this issue for now, since it is following MySQL syntax. If we have any other use case that requires \
to be escaped, we can reopen it then.