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: allow LIMIT 0 for SELECT queries #918

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ygabuev
Copy link
Contributor

@ygabuev ygabuev commented Oct 19, 2023

This PR enables the correct queries of form SELECT ... LIMIT 0.
Before that, the limit-clause wasn't applied to the query.

Closes #801

@ygabuev ygabuev force-pushed the master branch 9 times, most recently from 690f449 to a7b3e02 Compare October 19, 2023 13:41
This commit enables the correct queries of type `SELECT ... LIMIT 0`.
Before that, the limit-clause wasn't applied to the query.
@ygabuev
Copy link
Contributor Author

ygabuev commented Oct 20, 2023

The new tests fail for mssql, I've checked and they also fail for current master. Given that there were no tests for the LIMIT clause, I have a felling that the implementation for LIMIT and/or OFFSET is broken for mssql.

If this is true, it might be a better idea to fix those in a separate PR.

UPD: this ticket seems related #811

@ygabuev ygabuev marked this pull request as ready for review October 20, 2023 09:58
@@ -31,7 +31,7 @@ type SelectQuery struct {
group []schema.QueryWithArgs
having []schema.QueryWithArgs
order []schema.QueryWithArgs
limit int32
limit *int32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use sql.NullInt32 here

@vmihailenco
Copy link
Member

@ygabuev this looks good, but I can't merge a PR that breaks the build....

@CL-Jeremy
Copy link
Contributor

The new tests fail for mssql, I've checked and they also fail for current master. Given that there were no tests for the LIMIT clause, I have a felling that the implementation for LIMIT and/or OFFSET is broken for mssql.

If this is true, it might be a better idea to fix those in a separate PR.

UPD: this ticket seems related #811

Hi, I just implemented a fix for that problem in #1009. Could you please test if this workaround fixes your problem?

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.

Limit 0 returns all row set instead of empty set
3 participants