Macro diesel::allow_tables_to_appear_in_same_query [] [src]

macro_rules! allow_tables_to_appear_in_same_query {
    ($left_mod:ident, $($right_mod:ident),+ $(,)*) => { ... };
    ($last_table:ident,) => { ... };
    () => { ... };

Allow two or more tables which are otherwise unrelated to be used together in a query.

This macro must be invoked any time two tables need to appear in the same query either because they are being joined together, or because one appears in a subselect. When this macro is invoked with more than 2 tables, every combination of those tables will be allowed to appear together.

If you are using infer_schema! or diesel print-schema, an invocation of this macro will be generated for you for all tables in your schema.


This example is not tested
// This would be required to do `users.inner_join(posts.inner_join(comments))`
allow_tables_to_appear_in_same_query!(comments, posts, users);

When more than two tables are passed, the relevant code is generated for every combination of those tables. This code would be equivalent to the previous example.

This example is not tested
allow_tables_to_appear_in_same_query!(comments, posts);
allow_tables_to_appear_in_same_query!(comments, users);
allow_tables_to_appear_in_same_query!(posts, users);