Generating correct LIMIT and OFFSET field names#209
Merged
kyleconroy merged 1 commit intosqlc-dev:masterfrom Dec 22, 2019
dominikbraun:issue/201
Merged
Generating correct LIMIT and OFFSET field names#209kyleconroy merged 1 commit intosqlc-dev:masterfrom dominikbraun:issue/201
kyleconroy merged 1 commit intosqlc-dev:masterfrom
dominikbraun:issue/201
Conversation
Collaborator
|
@dominikbraun Thanks for the pull request. I think the existing limit / offset code needs to be totally rewritten. For example I don't think the following query will compile correctly: -- name: GetFoo :one
WITH cte as (
SELECT foo FROM bar LIMIT $1
)
SELECT
foo
FROM cte
OFFSET $2; |
Contributor
Author
|
Yap, and while You may merge this PR as a temporary hotfix, or just rewrite the affected code from scratch. |
Collaborator
Since I'm not sure about the long-term fix, adding a hot fix seems like a fine approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #201.
A query like this caused incorrect field names for
LIMITandOFFSET:The generated struct used to look like this:
This happened because
LIMITandOFFSETarenilfor the subquery but they've been assigned to theparamSearchthough.