Skip to content

fix: make NotConditions obey De Morgan's laws#7371

Closed
molon wants to merge 2 commits intogo-gorm:masterfrom
molon:fix-not-conditions
Closed

fix: make NotConditions obey De Morgan's laws#7371
molon wants to merge 2 commits intogo-gorm:masterfrom
molon:fix-not-conditions

Conversation

@molon
Copy link
Copy Markdown
Contributor

@molon molon commented Feb 16, 2025

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

What did this pull request do?

Resolve this issue: #7294

This should be a breaking change, but I think the previous logic is a bug.
Or is it because I don't understand the role of this condition?

User Case Description

@molon molon changed the title make NotConditions obey De Morgan's laws fix: make NotConditions obey De Morgan's laws Apr 23, 2025
@jinzhu
Copy link
Copy Markdown
Member

jinzhu commented May 22, 2025

This change does make sense, but since it is a long-standing behavior, we’d prefer to keep things as they are to avoid breaking existing user systems. Thank you for your PR!

@ezk84
Copy link
Copy Markdown
Contributor

ezk84 commented Jul 16, 2025

@jinzhu this was a bug introduced in gorm in 1.25.6 (released Jan 12, 2024).

Testing against 1.25.5 (released Oct 10, 2023) returns the correct condition and expected rows in the included tests (see go-gorm/playground#767).

This doesn't seem like designed behaviour, and it's only been one year and a half that it's been in this faulty state.

I've had to stay at 1.25.6 in my system because I rely on the previous correct logic for negating expressions. I just don't see how the comment about not breaking existing systems makes any sense.

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.

3 participants