RD-14898: SqlCompiler crashes when running 'hover' against a query that has two statements #516
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.
What happens is specific to LSP and
hover
.:iata
, we need to perform some code semantic analysis to compute the type of the argument. This involves passing the query to postgres to let it do its own inference and checks (sometimes the type is totally inferred by postgres).The bug we hit is that the parsed tree contains references to arguments like
:iata
when they're located in the second statement, and when we try to construct the postgres query (the one that contains?
in place of those), we get references to arguments that are in portions of code we don't have (since it was cut).I could work a first fix where the processing is careful with arguments and ignores those that are outside the code, but that is a little dangerous, there were several places to fix. I thought the parser could just skip those when they wouldn't belong to the first statement.