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: limit(0).offset(b) return all data, where b <= 0 #6191

Merged
merged 1 commit into from Apr 11, 2023

Conversation

Hanwn
Copy link
Contributor

@Hanwn Hanwn commented Mar 27, 2023

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

What did this pull request do?

fix for issue #6188 (comment)

User Case Description

when execute db.Limit(0).Offset(0).Where("id > ?", 10).Find(&users), it will return all data satified where condition. Namely, sql generated is select * from users where id > 10, but not select * from users where id > 10 limit 0, which is diff from sql semantics.

@Hanwn Hanwn changed the title fix: limit(0).offset(0) return all data fix: limit(0).offset(0) return all data (https://github.com/go-gorm/gorm/issues/6188#issue-1641432003) Mar 27, 2023
@Hanwn Hanwn changed the title fix: limit(0).offset(0) return all data (https://github.com/go-gorm/gorm/issues/6188#issue-1641432003) fix: limit(0).offset(0) return all data https://github.com/go-gorm/gorm/issues/6188#issue-1641432003 Mar 27, 2023
@Hanwn Hanwn changed the title fix: limit(0).offset(0) return all data https://github.com/go-gorm/gorm/issues/6188#issue-1641432003 fix: limit(0).offset(0) return all data Mar 27, 2023
@Hanwn Hanwn changed the title fix: limit(0).offset(0) return all data fix: limit(0).offset(b) return all data, where b >= 0 Mar 28, 2023
@Hanwn Hanwn changed the title fix: limit(0).offset(b) return all data, where b >= 0 fix: limit(0).offset(b) return all data, where b <= 0 Mar 28, 2023
@jinzhu jinzhu merged commit 59ca46d into go-gorm:master Apr 11, 2023
26 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.

None yet

3 participants