You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "FinnTew (via GitHub)" <gi...@apache.org> on 2025/10/01 14:01:08 UTC

[PR] fix: duplicate images due to `` wrapping the primary key [incubator-seata-go]

FinnTew opened a new pull request, #927:
URL: https://github.com/apache/incubator-seata-go/pull/927

   … when executing SQL statements
   
   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #702 
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   
   ```


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix: duplicate images due to `` wrapping the primary key [incubator-seata-go]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #927:
URL: https://github.com/apache/incubator-seata-go/pull/927#discussion_r2394876877


##########
pkg/datasource/sql/undo/builder/mysql_insert_undo_log_builder.go:
##########
@@ -241,8 +241,13 @@ func (u *MySQLInsertUndoLogBuilder) getPkIndex(InsertStmt *ast.InsertStmt, meta
 	if len(meta.Columns) > 0 {
 		for paramIdx := 0; paramIdx < insertColumnsSize; paramIdx++ {
 			sqlColumnName := InsertStmt.Columns[paramIdx].Name.O
-			if u.containPK(sqlColumnName, meta) {
-				pkIndexMap[sqlColumnName] = paramIdx
+			normalizedColumnName := executor.DelEscape(sqlColumnName, types.DBTypeMySQL)

Review Comment:
   The reference to `executor.DelEscape` appears incorrect. Based on the context and the similar fix in insert_executor.go which uses `DelEscape` directly, this should likely be `DelEscape(sqlColumnName, types.DBTypeMySQL)` without the `executor.` prefix.



##########
pkg/datasource/sql/undo/builder/mysql_insert_undo_log_builder.go:
##########
@@ -241,8 +241,13 @@ func (u *MySQLInsertUndoLogBuilder) getPkIndex(InsertStmt *ast.InsertStmt, meta
 	if len(meta.Columns) > 0 {
 		for paramIdx := 0; paramIdx < insertColumnsSize; paramIdx++ {
 			sqlColumnName := InsertStmt.Columns[paramIdx].Name.O
-			if u.containPK(sqlColumnName, meta) {
-				pkIndexMap[sqlColumnName] = paramIdx
+			normalizedColumnName := executor.DelEscape(sqlColumnName, types.DBTypeMySQL)
+			pkColumnNameList := meta.GetPrimaryKeyOnlyName()
+			for _, pkName := range pkColumnNameList {
+				if strings.EqualFold(pkName, normalizedColumnName) {
+					pkIndexMap[pkName] = paramIdx
+					break
+				}
 			}

Review Comment:
   This code removes the original logic that checked `u.containPK(sqlColumnName, meta)` but doesn't handle the case where there are no primary key columns. The original code had a safety check through the `containPK` method, but this new implementation assumes primary keys exist. Consider adding a check to ensure `pkColumnNameList` is not empty before processing.



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix: duplicate images due to `` wrapping the primary key [incubator-seata-go]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #927:
URL: https://github.com/apache/incubator-seata-go/pull/927#issuecomment-3356511503

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/927?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 38.23%. Comparing base ([`a1c3764`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/a1c37641f95f42572c4a300c83f6ca64d4e269c9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4bd89f5`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/4bd89f5379e863df959014166ec6072ea95dc695?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #927      +/-   ##
   ==========================================
   + Coverage   38.17%   38.23%   +0.05%     
   ==========================================
     Files         188      188              
     Lines       11417    11425       +8     
   ==========================================
   + Hits         4359     4368       +9     
   + Misses       6628     6627       -1     
     Partials      430      430              
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-seata-go/pull/927?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix: duplicate images due to `` wrapping the primary key [incubator-seata-go]

Posted by "Code-Fight (via GitHub)" <gi...@apache.org>.
Code-Fight commented on PR #927:
URL: https://github.com/apache/incubator-seata-go/pull/927#issuecomment-3506526434

   	1.	Resolve conflicts
   	2.	The PR contains many file changes unrelated to the issue and they need to be removed


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org