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

db.Not method when used with multiple Where conditions has changed unexpectedly #6845

Closed
tsuba3 opened this issue Feb 22, 2024 · 0 comments · Fixed by #6844
Closed

db.Not method when used with multiple Where conditions has changed unexpectedly #6845

tsuba3 opened this issue Feb 22, 2024 · 0 comments · Fixed by #6844
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@tsuba3
Copy link
Contributor

tsuba3 commented Feb 22, 2024

GORM Playground Link

Description

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.

I created PR (#6844) to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants