Report correct error for value lists in joins #156
Merged
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.
See #138
The wrong error was being thrown due to the third param in the source passed into
create_name
is only a binary when its a prefix, while other SQL syntax passes in other terms as the third parameter.JOIN VALUES((...),(...)) AS
clauses pass in a{values, index, number_of_values}
tuple as the third parameter, for instance.So this fix is in two parts: one fixes
quote_table
to account for this, the other introduces anassert_valid_join
that validates joins, generating consistent, clear errors as needed.Note: I did actually attempt to implement
VALUES()
joins .. however, while SQLITE does support theVALUES()
syntax, it does not work meaningfully in joins, as it does not support column aliases on tables, meaning there is no way to name the columns in the values list (as Ecto provides for), and as such no way to use a values list as a join table. I did get the actualVALUES
list to be accepted by sqlite's query parser, though ... but that turned out to be for not due to these other limitations in the engine. Ah well ...