Skip to content

overflow evaluating requirement error on inner_join #817

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

Closed

Conversation

natboehm
Copy link
Contributor

I'm currently working on issue #702, sorting crates by downloads in the past 90 days. I can't seem to get past the following error when doing an inner_join between crates::table and crate_downloads::table:

error[E0275]: overflow evaluating the requirement 
`<diesel::query_builder::BoxedSelectStatement<'_, ((diesel::types::Integer, diesel::types::Text, 
diesel::types::Timestamp, diesel::types::Timestamp, diesel::types::Integer, 
diesel::types::Nullable<diesel::types::Text>, diesel::types::Nullable<diesel::types::Text>, 
diesel::types::Nullable<diesel::types::Text>, diesel::types::Nullable<diesel::types::Text>, 
diesel::types::Nullable<diesel::types::Text>, diesel::types::Nullable<diesel::types::Text>, 
diesel::types::Nullable<diesel::types::Integer>), diesel::types::BigInt, diesel::types::Bool), 
schema::crates::table, _> as diesel::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>::Output`
      --> src/krate.rs:828:23
       |
   828 |         query = query.inner_join(crate_downloads::table)                                                             
       |                       ^^^^^^^^^^                                                                                    
       |

I am at a loss to understand what this error message actually means or what is provoking it. I thought that there might be something going wrong with the imports and the way crates is associated with crate_downloads, however after comparing to and replicating other places in which inner_join is called successfully I can't figure out what is being done differently in this case.

I read the Associations documentation as well as the BoxedDsl documentation and haven't found anything obviously awry.

I also went through the getting started tutorial listed on the diesel website in hopes of finding something fundamental that I'm missing, but most everything done there seems to be done in this case as well.

The inner_join seems to not error on a single isolated query:

let new_query = crates::table.inner_join(crate_downloads::table).select((ALL_COLUMNS));

This is still commented out in the code with a label of 'works'. Since this standalone query works (compiles), I didn't think that the problem could be due to the crates and crate_downloads tables being set up correctly to do the join. I thought that the problem might instead be coming from the into_boxed() function called when initializing query, as the error message mentions BoxedSelectStatement, however I cannot find any information that supports this.

I have some code for the rest of the query below the inner_join line, however the problem persists with or without the addition of this code. For simplicity I currently have it commented out.

Any help would be very much appreciated! @sgrif @carols10cents

@carols10cents
Copy link
Member

Yep, @sgrif, halp. I am out of ideas on this one :-/

@natboehm
Copy link
Contributor Author

I found this short description of the error message: https://manishearth.github.io/rust-internals-docs/error-index.html#E0275

@sgrif
Copy link
Contributor

sgrif commented Jun 30, 2017

You can't join a boxed query. The error should just say that the method doesn't exist, but it looks like there's an impl that rustc can't figure out doesn't apply hence the error vomit.

You need to call inner_join before you box the query

@natboehm
Copy link
Contributor Author

natboehm commented Jul 1, 2017

Okay thanks! I'll give that a go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants