|
| 1 | +error[E0277]: mixing aggregate and not aggregate expressions is not allowed in SQL |
| 2 | + --> tests/fail/cannot_mix_aggregate_and_non_aggregate_in_order_by.rs:17:44 |
| 3 | + | |
| 4 | + LL | let _ = users.select(max(id)).order_by(name); |
| 5 | + | -------- ^^^^ unsatisfied trait bound |
| 6 | + | | |
| 7 | + | required by a bound introduced by this call |
| 8 | + | |
| 9 | + = help: the trait `MixedAggregates<diesel::expression::is_aggregate::No>` is not implemented for `diesel::expression::is_aggregate::Yes` |
| 10 | + = note: you tried to combine expressions that aggregate over a certain column with expressions that don't aggregate over that column |
| 11 | + = note: try to either use aggregate functions like `min`/`max`/… for this column or add the column to your `GROUP BY` clause |
| 12 | + = note: also there are clauses like `WHERE` or `RETURNING` that does not accept aggregate expressions at all |
| 13 | +help: the following other types implement trait `MixedAggregates<Other>` |
| 14 | + --> DIESEL/diesel/diesel/src/expression/mod.rs |
| 15 | + | |
| 16 | +LL | impl MixedAggregates<Yes> for Yes { |
| 17 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::Yes` implements `MixedAggregates<diesel::expression::is_aggregate::Yes>` |
| 18 | +... |
| 19 | +LL | impl MixedAggregates<Never> for Yes { |
| 20 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::Yes` implements `MixedAggregates<diesel::expression::is_aggregate::Never>` |
| 21 | + = note: required for `SelectStatement<FromClause<table>, ...>` to implement `OrderDsl<columns::name>` |
| 22 | +note: required by a bound in `order_by` |
| 23 | + --> DIESEL/diesel/diesel/src/query_dsl/mod.rs |
| 24 | + | |
| 25 | +LL | fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr> |
| 26 | + | -------- required by a bound in this associated function |
| 27 | +... |
| 28 | +LL | Self: methods::OrderDsl<Expr>, |
| 29 | + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `QueryDsl::order_by` |
| 30 | + |
| 31 | + |
| 32 | +error[E0277]: mixing aggregate and not aggregate expressions is not allowed in SQL |
| 33 | + --> tests/fail/cannot_mix_aggregate_and_non_aggregate_in_order_by.rs:21:39 |
| 34 | + | |
| 35 | + LL | let _ = users.select(id).order_by(max(id)); |
| 36 | + | -------- ^^^^^^^ unsatisfied trait bound |
| 37 | + | | |
| 38 | + | required by a bound introduced by this call |
| 39 | + | |
| 40 | + = help: the trait `MixedAggregates<diesel::expression::is_aggregate::Yes>` is not implemented for `diesel::expression::is_aggregate::No` |
| 41 | + = note: you tried to combine expressions that aggregate over a certain column with expressions that don't aggregate over that column |
| 42 | + = note: try to either use aggregate functions like `min`/`max`/… for this column or add the column to your `GROUP BY` clause |
| 43 | + = note: also there are clauses like `WHERE` or `RETURNING` that does not accept aggregate expressions at all |
| 44 | +help: the following other types implement trait `MixedAggregates<Other>` |
| 45 | + --> DIESEL/diesel/diesel/src/expression/mod.rs |
| 46 | + | |
| 47 | +LL | impl MixedAggregates<No> for No { |
| 48 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::No` implements `MixedAggregates<diesel::expression::is_aggregate::No>` |
| 49 | +... |
| 50 | +LL | impl MixedAggregates<Never> for No { |
| 51 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::No` implements `MixedAggregates<diesel::expression::is_aggregate::Never>` |
| 52 | + = note: required for `SelectStatement<FromClause<table>, ...>` to implement `OrderDsl<max<Integer, id>>` |
| 53 | +note: required by a bound in `order_by` |
| 54 | + --> DIESEL/diesel/diesel/src/query_dsl/mod.rs |
| 55 | + | |
| 56 | +LL | fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr> |
| 57 | + | -------- required by a bound in this associated function |
| 58 | +... |
| 59 | +LL | Self: methods::OrderDsl<Expr>, |
| 60 | + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `QueryDsl::order_by` |
| 61 | + |
| 62 | + |
| 63 | +error[E0277]: mixing aggregate and not aggregate expressions is not allowed in SQL |
| 64 | + --> tests/fail/cannot_mix_aggregate_and_non_aggregate_in_order_by.rs:28:24 |
| 65 | + | |
| 66 | + LL | .then_order_by(name); |
| 67 | + | ------------- ^^^^ unsatisfied trait bound |
| 68 | + | | |
| 69 | + | required by a bound introduced by this call |
| 70 | + | |
| 71 | + = help: the trait `MixedAggregates<diesel::expression::is_aggregate::No>` is not implemented for `diesel::expression::is_aggregate::Yes` |
| 72 | + = note: you tried to combine expressions that aggregate over a certain column with expressions that don't aggregate over that column |
| 73 | + = note: try to either use aggregate functions like `min`/`max`/… for this column or add the column to your `GROUP BY` clause |
| 74 | + = note: also there are clauses like `WHERE` or `RETURNING` that does not accept aggregate expressions at all |
| 75 | +help: the following other types implement trait `MixedAggregates<Other>` |
| 76 | + --> DIESEL/diesel/diesel/src/expression/mod.rs |
| 77 | + | |
| 78 | +LL | impl MixedAggregates<Yes> for Yes { |
| 79 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::Yes` implements `MixedAggregates<diesel::expression::is_aggregate::Yes>` |
| 80 | +... |
| 81 | +LL | impl MixedAggregates<Never> for Yes { |
| 82 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `diesel::expression::is_aggregate::Yes` implements `MixedAggregates<diesel::expression::is_aggregate::Never>` |
| 83 | + = note: required for `SelectStatement<..., ..., ..., ..., ...>` to implement `ThenOrderDsl<columns::name>` |
| 84 | +note: required by a bound in `diesel::QueryDsl::then_order_by` |
| 85 | + --> DIESEL/diesel/diesel/src/query_dsl/mod.rs |
| 86 | + | |
| 87 | +LL | fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order> |
| 88 | + | ------------- required by a bound in this associated function |
| 89 | +LL | where |
| 90 | +LL | Self: methods::ThenOrderDsl<Order>, |
| 91 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `QueryDsl::then_order_by` |
| 92 | + |
| 93 | + For more information about this error, try `rustc --explain E0277`. |
0 commit comments