heqiao commented on issue #7703:
URL: https://github.com/apache/shardingsphere/issues/7703#issuecomment-736998272


   @strongduanmu Thank you for diving into it. @tristaZero My apologies that 
the proposed solution may not work as I originally agreed. The where clause 
doesn't contain the sharding key. 
   
   e.g. `update ACCOUNT_INFO set name=??, account_id=??, zip=??, version=?? 
where id = ??` was the generated sql with account_id being the sharding key. 
The `shardingValue` is empty in the code @strongduanmu posted 
(ShardingUpdateStatementValidator.java). 
   
   
![image](https://user-images.githubusercontent.com/3125184/100831541-d7d84100-341a-11eb-85d8-3336a726d57e.png)
   
   So the logic may be 
   ```
   if (no shardingKey in SET Clause)
       then PASS
   else if (no shardingKey in WHERE Clause)
       then append sharding column and value to WHERE Clause
   else if (the value of shardingKey in SET Clause == the value of shardingKey 
in WHERE Clause)
       then PASS
   else
       then an exception
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to