LinkinStars commented on PR #1315:
URL: https://github.com/apache/answer/pull/1315#issuecomment-2822997647

   First of all, thanks for the contribution. 
   
   And I found an error.
   
   ```
   ERROR        handler/handler.go:53   code: 500, reason: base.database_error, 
message: , error: Error 1093 (HY000): You can't specify target table 'tag_rel' 
for update in FROM clause
   internal/repo/tag/tag_rel_repo.go:220 
github.com/apache/answer/internal/repo/tag.(*tagRelRepo).MigrateTagObjects
   internal/service/tag_common/tag_common.go:943 
github.com/apache/answer/internal/service/tag_common.(*TagCommonService).MigrateTagQuestions
   internal/service/tag/tag_service.go:485 
github.com/apache/answer/internal/service/tag.(*TagService).MergeTag
   ```
   
   ```sql
   UPDATE `tag_rel` SET `tag_id` = ?, `updated_at` = ? WHERE (tag_id = ?) AND 
(object_id LIKE ?) AND object_id NOT IN (SELECT object_id FROM tag_rel WHERE 
tag_id=? AND object_id LIKE ?) [10030000000003699 2025-04-23 11:13:03 
10030000000003701 1001% 10030000000003699 1001%] - 1.244208ms
   ```
   
   - I think there is no need to use `questionPrefix` to handle the question's 
tag situation separately. Currently, only questions contain tags. If other 
objects want to have tags in the future, **the merge operation should be 
consistent**.
   - I understand that you want to deal with a situation where both source and 
target tags are included. I think it might be to deal with such a situation 
separately. 
   
   Deleting it may be a good choice. This keeps behaviour consistent. For 
example
   
   questions. init state: questions1(t1, t2, t3), question2(t2)
   - Your version `t2 -> t1: t2 becomes synonym of t1, questions1(t1, t2, t3), 
question2(t1)`
   - I think `t2 -> t1: t2 becomes synonym of t1, questions1(t1, t3), 
question2(t1)`
   
   The merged behaviour is the same in question 1 and question 2.


-- 
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: commits-unsubscr...@answer.apache.org

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

Reply via email to