Skip to content

limit! does not reset offset when passed nil #571

dlee opened this Issue Oct 23, 2012 · 2 comments

2 participants

dlee commented Oct 23, 2012

Passing nil to Dataset#limit! resets limit, but does not reset offset:

> ds = DB[:nodes]
 => #<Sequel::Postgres::Dataset: "SELECT * FROM \"nodes\""> 
> ds.limit! 5, 5
 => #<Sequel::Postgres::Dataset: "SELECT * FROM \"nodes\" LIMIT 5 OFFSET 5"> 
> ds.limit! nil, nil
 => #<Sequel::Postgres::Dataset: "SELECT * FROM \"nodes\" OFFSET 5"> 

This isn't specific to limit!, it applies to limit as well. But I agree that it is a bug that should be fixed, I'll take care of it shortly.


Note that for what you want, unlimited is a better method to call.

@jeremyevans jeremyevans added a commit that closed this issue Oct 23, 2012
@jeremyevans Make dataset.limit(nil, nil) reset offset as well as limit (Fixes #571)
Note that you should probably use unlimited instead of limit(nil,nil).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.