codegen: surface batch validation errors#1924
Closed
chrisyxlee wants to merge 1 commit intosqlc-dev:mainfrom
Closed
codegen: surface batch validation errors#1924chrisyxlee wants to merge 1 commit intosqlc-dev:mainfrom
chrisyxlee wants to merge 1 commit intosqlc-dev:mainfrom
Conversation
kyleconroy
reviewed
Nov 10, 2022
Collaborator
kyleconroy
left a comment
There was a problem hiding this comment.
@chrisyxlee Can you include an example in the comments of a query that will produce the error? I want to make sure we add a test case for this.
Collaborator
|
The validation code around parameters has changed a bit. |
Contributor
Author
|
Thank you! Apologies for forgetting about this PR -- and sounds good to me. 👍 |
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.
As a result of #1841 (letting named params contribute to param count), the call to
ParamRefwill actually fail for queries with mixed usage of numbered and named parameters.This PR mainly ensures that when the failure occurs, the error surfaced to the user makes it obvious what the issue is. Previously, the error would say
:batch* commands require parameterswhen the actual error is that the parameters are being mixed.Now it says
path/to/query.sql:1:1: could not determine data type of parameter $1orpath/to/query.sql:15:1: can not mix $1 format with ? formatWith this change, I believe mixed parameters are still allowed for non-batch queries, and I'm not sure if I should change that (please let me know through review).
#1625