Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in db.Not introduced in v1.25.6. #6844

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

tsuba3
Copy link
Contributor

@tsuba3 tsuba3 commented Feb 22, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Fix #6845

Address a regression introduced in Gorm v1.25.6, specifically in commit 940358e.

The behavior of the db.Not method when used with multiple Where conditions has changed unexpectedly. Prior to v1.25.6, the query db.Not(db.Where("a=1").Where("b=1")) would correctly translate to SQL as NOT (a=1 AND b=1). However, after the specified commit, the same query started translating to (NOT a=1 AND NOT b=1), which is a significant alteration in the logic.

This PR reverts the db.Not method's behavior back to its original state when *gorm.DB passed as arguments.

User Case Description

@tsuba3 tsuba3 marked this pull request as ready for review February 22, 2024 12:32
@jinzhu jinzhu merged commit 3e2c4fc into go-gorm:master Mar 5, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

db.Not method when used with multiple Where conditions has changed unexpectedly
3 participants