-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the 'like' operator to perform a fuzzy search on an encrypted column in version 5.3.0. #24337
Comments
Hi @wangleizone, thank you for your feedback. Encrypt like feature does not currently support functions. Are you interested in submitting PR for enhanced function support? |
@strongduanmu let me see how to fix it |
@gxxiong That's great, I will assign this issue to you. |
Hi @wangleizone, can you help test this enhancement on master branch? |
@strongduanmu @gxxiong |
@starldh Thank you for your feedback, I will check it. |
Hi @starldh, can you try it again? I modify the logic and add e2e test case for prepared statement. |
Hi @strongduanmu . I checked agaiin. And it works now. |
That's great, let's support more SQL statements for encrypt feature. |
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
5.3.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
I am using the new feature in version 5.3.0, which allows encryption on a column for a LIKE fuzzy search. I am also using the CHAR_DIGEST_LIKE algorithm to generate the likeQueryColumn.
But when I execute the following SQL for a fuzzy search, it throws an exception.
select * from sla_user_service_recorde where user_name like CONCAT('%', #{userName}, '%')
Cause: java.sql.SQLException: Unknown exception: null
; uncategorized SQLException; SQL state [HY000]; error code [30000]; Unknown exception: null; nested exception is java.sql.SQLException: Unknown exception: null
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
Caused by: java.sql.SQLException: Unknown exception: null
at org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:62)
I tried to remove the 'concat' function from the SQL statement and passed '%' as a part of the string parameter, and the query worked normally.
select * from sla_user_service_recorde where user_name like #{userName}
Reason analyze (If you can)
And I found that when using the '=' operator in the SQL query, the 'concat' function can be used normally. It is only when using the 'like' operator with the 'concat' function that an exception is thrown. I suspect this is a bug introduced in the new 5.3.0 version.
The text was updated successfully, but these errors were encountered: