You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/23 00:59:27 UTC

[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #13591: Support not nested subquery (from SetAssignment and Expression) on UpdateStatement

strongduanmu commented on a change in pull request #13591:
URL: https://github.com/apache/shardingsphere/pull/13591#discussion_r754740652



##########
File path: shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/update_for_query_with_cipher.xml
##########
@@ -36,4 +36,14 @@
         <input sql="UPDATE t_account_bak SET account_id = 1, certificate_number = '111X', password = 'aaa', amount = 1000, status = 'OK' WHERE account_id = 1 AND certificate_number = '111X' AND password = 'aaa' AND amount = 1000 AND status = 'OK'" />
         <output sql="UPDATE t_account_bak SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', plain_certificate_number = '111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', plain_password = 'aaa', cipher_amount = 'encrypt_1000', plain_amount = 1000, status = 'OK' WHERE account_id = 1 AND assisted_query_certificate_number = 'assisted_query_111X' AND assisted_query_password = 'assisted_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK'" />
     </rewrite-assertion>
+
+    <rewrite-assertion id="update_subquery_projections" db-types="MySQL">
+        <input sql="UPDATE t_account_bak SET account_id = 1, certificate_number = (select certificate_number from t_account where certificate_number='111X'), password = 'aaa', amount = 1000, status = 'OK' WHERE account_id = 1 AND certificate_number = '111X' AND password = 'aaa' AND amount = 1000 AND status = 'OK'" />

Review comment:
       @cheese8 This PR does not seem to be able to perfectly support the subqueries contained in the update statement. In this case, the rewritten sql should report an error when executed on the database.




-- 
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