Why the row affected still have no zero even field in column are not updated actually same value
func (repo *wasteTypeRepo) UpdateByID(ctx context.Context, payload model.WasteTypeUpdateWithVersionRequest) error {
fmt.Println(payload.SOURCEID)
queries := repo.pgxConfig.TrOrDB(ctx)
sql := --sql UPDATE waste_types SET "name" = 'bar'
result, err := queries.Exec(ctx, sql)
fmt.Println(result.RowsAffected())
return err
}
It's hard to understand what do you mean, but if I understand you correctly - you ask why do you get affected rows count greater than 0 even if you try to update column using the same value.
Actually its how does PostgreSQL MVCC works, nothing to do with pgx. When you update column in a row it doesn't matter was value actually changed or not - PostgreSQL will overwrite entire row (with some exception to TOASTed columns).
So there's no any bug with pgx.