matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: `\` is getting removed automatically by MO Parser

Open arjunsk opened this issue 1 year ago • 13 comments

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

arjunsk avatar Jan 09 '24 02:01 arjunsk

暂未处理

iamlinjunhong avatar Jan 12 '24 10:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Jan 17 '24 10:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Jan 22 '24 10:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Jan 26 '24 07:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Jan 26 '24 10:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Jan 31 '24 10:01 iamlinjunhong

暂未处理

iamlinjunhong avatar Feb 08 '24 11:02 iamlinjunhong

暂未处理

iamlinjunhong avatar Feb 21 '24 10:02 iamlinjunhong

暂未处理

iamlinjunhong avatar Feb 26 '24 10:02 iamlinjunhong

暂未处理

iamlinjunhong avatar Feb 29 '24 10:02 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 05 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 08 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 13 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 18 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 21 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 26 '24 10:03 iamlinjunhong

暂未处理

iamlinjunhong avatar Mar 29 '24 14:03 iamlinjunhong

I think we might not need this change.

MySQL skips \ values. However, postgres does not skip \ values.

image

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.

image

image

arjunsk avatar Apr 01 '24 07:04 arjunsk

mo 对 \ 处理是参照 mysql 的 https://dev.mysql.com/doc/refman/5.7/en/string-literals.html, 如果不想跳过 \ , 可以用 \

iamlinjunhong avatar Apr 01 '24 07:04 iamlinjunhong

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.

arjunsk avatar Apr 01 '24 08:04 arjunsk