Description

We spotted weird SQL statements when gorm upgraded to v1.22.5 such as:

-UPDATE "products" SET "deleted_at"=$1 WHERE "products"."id" = $2 AND "products"."deleted_at" IS NULL
+UPDATE "products" SET "deleted_at"=$1 WHERE "products"."id" = $2 AND "products"."id" = $3 AND "products"."deleted_at" IS NULL

with this test https://github.com/DataDog/dd-trace-go/blob/v1/contrib/gorm.io/gorm.v1/gorm_test.go#L221

and

-UPDATE "products" SET "price"=$1,"updated_at"=$2 WHERE "id" = $3
+UPDATE "products" SET "price"=$1,"updated_at"=$2 WHERE "id" = $3 AND "products"."deleted_at" IS NULL

with this test https://github.com/DataDog/dd-trace-go/blob/v1/contrib/gorm.io/gorm.v1/gorm_test.go#L197

Given how the first one looks like, having twice the product.id clause, it felt like a regression to me and wanted to confirm it.

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: Julio-Guerra

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

ok

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking