Copilot commented on code in PR #1136:
URL: 
https://github.com/apache/incubator-seata-go/pull/1136#discussion_r3538578516


##########
pkg/util/flagext/day_test.go:
##########
@@ -75,28 +76,19 @@ func TestDayValueYAML(t *testing.T) {
                if err != nil {
                        loc = time.FixedZone("UTC-8", -8*60*60)
                }
-
-               originalLocal := time.Local
-               time.Local = loc
-               defer func() {
-                       time.Local = originalLocal
-               }()
                type TestStruct struct {
                        Day *DayValue `yaml:"day"`
                }
-               var testStruct TestStruct
-               testStruct.Day = &DayValue{}
-               require.NoError(t, testStruct.Day.Set("1985-06-02"))
+               day := NewDayValue(model.TimeFromUnix(time.Date(1985, 6, 2, 12, 
0, 0, 0, loc).Unix()))
+               testStruct := TestStruct{
+                       Day: &day,
+               }
                expected := []byte(`day: "1985-06-02"
 `)
 
+               assert.Equal(t, "1985-06-02T00:00:00Z", testStruct.Day.String())
                actual, err := yaml.Marshal(testStruct)
                require.NoError(t, err)
                assert.Equal(t, expected, actual)

Review Comment:
   The western-timezone YAML serialization test no longer verifies YAML 
unmarshal round-trip. Adding an unmarshal assertion here helps ensure 
`UnmarshalYAML` remains consistent with the UTC-stable marshal behavior being 
tested.



##########
pkg/datasource/sql/exec/at/insert_executor.go:
##########
@@ -496,8 +496,8 @@ func (i *insertExecutor) getPkIndex(InsertStmt 
*ast.InsertStmt, meta types.Table
        if len(meta.Columns) > 0 {
                for paramIdx := 0; paramIdx < insertColumnsSize; paramIdx++ {
                        sqlColumnName := InsertStmt.Columns[paramIdx].Name.O
-                       if i.containPK(sqlColumnName, meta) {
-                               pkIndexMap[sqlColumnName] = paramIdx
+                       if pkColumnName, ok := 
i.matchPKColumnName(sqlColumnName, meta); ok {
+                               pkIndexMap[pkColumnName] = paramIdx
                        }
                }
                return pkIndexMap

Review Comment:
   `getPkIndex` returns an empty map when the INSERT statement omits an 
explicit column list (`INSERT INTO t VALUES (...)`). This causes 
`parsePkValuesFromStatement` to fail with "pkIndex is not found" for a valid 
SQL form, preventing after-image PK extraction. Consider mapping PKs to 
positions using `meta.ColumnNames` when `InsertStmt.Columns` is empty.



-- 
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: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to