You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "wangtiga (via GitHub)" <gi...@apache.org> on 2023/04/06 11:27:50 UTC

[GitHub] [shardingsphere] wangtiga commented on a diff in pull request #25033: Fix like query bug in PostgreSQLStatementSQLVisitor.java

wangtiga commented on code in PR #25033:
URL: https://github.com/apache/shardingsphere/pull/25033#discussion_r1159673657


##########
sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java:
##########
@@ -350,7 +350,7 @@ private Optional<String> findBinaryOperator(final AExprContext ctx) {
     }
     
     private BinaryOperationExpression createPatternMatchingOperationSegment(final AExprContext ctx) {
-        String operator = getOriginalText(ctx.patternMatchingOperator());
+        String operator = getOriginalText(ctx.patternMatchingOperator()).toUpperCase();

Review Comment:
   Do you mean to modify the code logic of the `EncryptPredicateRightValueTokenGenerator@getEncryptedValues` function to fix this bug? I don't think it will work because many code logics in the encrypt rewrite assume that these tokens are uppercase letters by default. If you make such modifications, it will deviate significantly from the previous code logic.
   
   https://github.com/apache/shardingsphere/blob/5.3.1/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGenerator.java#L98
   ```diff
   - if (encryptCondition instanceof EncryptBinaryCondition && "LIKE".equals(((EncryptBinaryCondition) encryptCondition).getOperator())) {
   + if (encryptCondition instanceof EncryptBinaryCondition && "LIKE".equalsIgnoreCase(((EncryptBinaryCondition) encryptCondition).getOperator())) {
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org