Skip to content

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

@tsuba3

Description

@tsuba3

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions