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

`eq_any(&[])` and `ne_any(&[])` generate invalid SQL #520

Closed
sgrif opened this Issue Dec 5, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@sgrif
Member

sgrif commented Dec 5, 2016

No description provided.

sgrif added a commit that referenced this issue Dec 6, 2016

Don't panic when calling `eq_any` or `ne_any` with an empty array
I had hoped to avoid introducing a new trait or methods for this.
However, the earliest point in the query builder that we can handle this
without introducing some new method is after the opening parenthesis has
been emitted. I had attempted to do something like emit `SELECT 1 WHERE
1=0` or `SELECT NULL WHERE 1=0` but both cases can cause type errors.

Still, due to the nature of how `In` is implemented, we can at least add
the required methods in an extremely contained fashion.

I have also added CHANGELOG entries for other "empty array causes
crashes" commits that had preceded this one, as I had forgotten to do so
earlier and this is the last case that I'm aware of.

Fixes #520.

sgrif added a commit that referenced this issue Dec 6, 2016

Don't panic when calling `eq_any` or `ne_any` with an empty array
I had hoped to avoid introducing a new trait or methods for this.
However, the earliest point in the query builder that we can handle this
without introducing some new method is after the opening parenthesis has
been emitted. I had attempted to do something like emit `SELECT 1 WHERE
1=0` or `SELECT NULL WHERE 1=0` but both cases can cause type errors.

Still, due to the nature of how `In` is implemented, we can at least add
the required methods in an extremely contained fashion.

I have also added CHANGELOG entries for other "empty array causes
crashes" commits that had preceded this one, as I had forgotten to do so
earlier and this is the last case that I'm aware of.

Fixes #520.

sgrif added a commit that referenced this issue Dec 6, 2016

Don't panic when calling `eq_any` or `ne_any` with an empty array
I had hoped to avoid introducing a new trait or methods for this.
However, the earliest point in the query builder that we can handle this
without introducing some new method is after the opening parenthesis has
been emitted. I had attempted to do something like emit `SELECT 1 WHERE
1=0` or `SELECT NULL WHERE 1=0` but both cases can cause type errors.

Still, due to the nature of how `In` is implemented, we can at least add
the required methods in an extremely contained fashion.

I have also added CHANGELOG entries for other "empty array causes
crashes" commits that had preceded this one, as I had forgotten to do so
earlier and this is the last case that I'm aware of.

Fixes #520.

@sgrif sgrif closed this in #526 Dec 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment