Y-sir opened a new issue, #29306:
URL: https://github.com/apache/shardingsphere/issues/29306

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   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.4.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy  and    postgresql 14.2 
   ### Expected behavior
   
![image](https://github.com/apache/shardingsphere/assets/62044303/cdce6e44-de0d-4560-8843-803357c17ca9)
   It is hoped that the encrypted cno field query will have the same results as 
the unencrypted one.
   ### Actual behavior
   
![image](https://github.com/apache/shardingsphere/assets/62044303/14993d33-c02c-4d40-88de-a061870ae017)
   After encryption, the cno field conditions become invalid and all queries 
are found.
   ### Reason analyze (If you can)
   The guess is that the SQL parsing is abnormal and the cno field is not 
matched normally. Conditional encryption is performed before transmission.
   The picture below shows the sql conditional field parsed normally by the != 
statement. If it is an encrypted field, it will be conditionally encrypted.
   
![image](https://github.com/apache/shardingsphere/assets/62044303/5344aa98-ae9c-4b9d-a81e-a7989597a7c1)
   The picture below shows the not = statement. SQL is not parsed normally. The 
conditional fields are not encrypted and conditional encryption is not 
performed.
   
![image](https://github.com/apache/shardingsphere/assets/62044303/fcb9ea20-b9b2-4d66-8b96-55c86472d748)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   --------------------------Create table 
statement------------------------------
   DROP TABLE IF EXISTS "public"."sc";
   CREATE TABLE "public"."sc" (
     "cno" "pg_catalog"."text" COLLATE "pg_catalog"."default",
     "grade" "pg_catalog"."text" COLLATE "pg_catalog"."default",
     "sno" "pg_catalog"."text" COLLATE "pg_catalog"."default" NOT NULL
   )
   ;
   COMMENT ON COLUMN "public"."sc"."cno" IS '课程号';
   COMMENT ON COLUMN "public"."sc"."grade" IS '成绩';
   COMMENT ON COLUMN "public"."sc"."sno" IS '学号';
   
   -- ----------------------------
   -- Records of sc
   -- ----------------------------
   INSERT INTO "public"."sc" VALUES ('201215123', '94', '1');
   INSERT INTO "public"."sc" VALUES ('201215121', '92', '1');
   INSERT INTO "public"."sc" VALUES ('201215122', '90', '2');
   INSERT INTO "public"."sc" VALUES ('201215121', '85', '2');
   INSERT INTO "public"."sc" VALUES ('201215125', '95', '2');
   INSERT INTO "public"."sc" VALUES ('201215121', '88', '3');
   INSERT INTO "public"."sc" VALUES ('201215122', '80', '3');
   ---------------------------not = statement 
-------------------------------------
   SELECT * FROM sc WHERE NOT cno = '201215121' ;
   ----------------------------!= statement 
----------------------------------------
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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-unsubscr...@shardingsphere.apache.org.apache.org

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

Reply via email to