Skip to content

Commit 99ed295

Browse files
authored
Merge pull request #4641 from weiznich/prepare/diesel_2.2.11
Prepare/diesel 2.2.11
2 parents 2a6752b + 44897e4 commit 99ed295

32 files changed

+407
-53
lines changed

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extend-ignore-re = [
2323
"big_sur",
2424
# That's Spanish for "type" (used in a unit-test)
2525
"tipe",
26+
# we use this often in place of the reserved type identifier
27+
"tpe",
2628
]
2729

2830
[type.md]

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ Increasing the minimal supported Rust version will always be coupled at least wi
1010

1111
## Unreleased
1212

13+
## [2.2.11] 2025-06-12
14+
15+
## Fixed
16+
17+
* Disallow mixing aggregate and non-aggregate expressions in `DISTINCT ON` clauses
18+
* Fixed an item referenced by a non-absolute path in `#[derive(MultiConnection)]`
19+
* Improved compiler errors in some cases
20+
* Improved the documentation for creating SqliteConnections for concurrent applications
21+
1322
## [2.2.10] 2025-04-25
1423

1524
## Fixed
@@ -2206,3 +2215,4 @@ queries or set `PIPES_AS_CONCAT` manually.
22062215
[2.2.8]: https://github.com/diesel-rs/diesel/compare/v2.2.7...v2.2.8
22072216
[2.2.9]: https://github.com/diesel-rs/diesel/compare/v2.2.8...v2.2.9
22082217
[2.2.10]: https://github.com/diesel-rs/diesel/compare/v2.2.9...v2.2.10
2218+
[2.2.11]: https://github.com/diesel-rs/diesel/compare/v2.2.10...v2.2.11

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,50 @@ for useful information about setting up Diesel locally, coding style and common
263263
Unless you explicitly state otherwise, any contribution you intentionally submit
264264
for inclusion in the work, as defined in the Apache-2.0 license, shall be
265265
dual-licensed as above, without any additional terms or conditions.
266+
267+
### Notable Sponsors and Supporters
268+
269+
We would like to thank all of the sponsors supporting the work on Diesel. Notable large sponsors are:
270+
271+
272+
<p align="center">
273+
<a href="https://nlnet.nl/project/Diesel/">
274+
<img src="https://diesel.rs/assets/images/nl_net_foundation_logo.svg" width="50%"/>
275+
<br/>
276+
NLNet Foundation
277+
</a>
278+
</p>
279+
280+
<p align="center">
281+
<a href="https://nlnet.nl/project/Diesel/">
282+
<img src="https://diesel.rs/assets/images/NGI0Core_tag.svg" width="50%"/>
283+
<br/>
284+
NGI Zero Core
285+
</a>
286+
</p>
287+
288+
<p align="center">
289+
<a href="https://www.prototypefund.de/projects/diesel-databaseviews">
290+
<img src="https://diesel.rs/assets/images/PrototypeFund_logo_dark.png" width="50%"/>
291+
<br/>
292+
Prototype Fund
293+
</a>
294+
</p>
295+
296+
<p align="center">
297+
<a href="https://www.prototypefund.de/projects/diesel-databaseviews">
298+
<img src="https://diesel.rs/assets/images/bmbf_logo.jpg" width="50%"/>
299+
<br/>
300+
Federal Ministry of Research, Technology and Space (Germany)
301+
</a>
302+
</p>
303+
304+
<p align="center">
305+
<a href="https://giga-infosystems.com/">
306+
<img src="https://diesel.rs/assets/images/logo_giga.svg" width="35%"/>
307+
<br/>
308+
GiGa Infosystems GmbH
309+
</a>
310+
</p>
311+
312+
Additionally we would like to thank all persons sponsoring the project on [GitHub](https://github.com/sponsors/weiznich#sponsors). Without them developing Diesel wouldn't be possible.

diesel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diesel"
3-
version = "2.2.10"
3+
version = "2.2.11"
44
license = "MIT OR Apache-2.0"
55
description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL"
66
readme = "README.md"

diesel/src/expression/grouped.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use crate::result::QueryResult;
55
use crate::sql_types::DieselNumericOps;
66

77
#[derive(Debug, Copy, Clone, QueryId, Default, DieselNumericOps, ValidGrouping)]
8-
pub struct Grouped<T>(pub T);
8+
#[doc(hidden)]
9+
pub struct Grouped<T>(pub(crate) T);
910

1011
impl<T: Expression> Expression for Grouped<T> {
1112
type SqlType = T::SqlType;

diesel/src/expression/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,11 @@ impl<T: ValidGrouping<GB> + ?Sized, GB> ValidGrouping<GB> for &T {
706706
pub use diesel_derives::ValidGrouping;
707707

708708
#[doc(hidden)]
709+
#[diagnostic::on_unimplemented(
710+
note = "if your query contains columns from several tables in your group by or select \
711+
clause make sure to call `allow_columns_to_appear_in_same_group_by_clause!` \
712+
with these columns"
713+
)]
709714
pub trait IsContainedInGroupBy<T> {
710715
type Output;
711716
}

diesel/src/mysql/query_builder/query_fragment_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ where
149149
}
150150

151151
/// This is a helper trait
152-
/// that provideds a fake `DO NOTHING` clause
152+
/// that provides a fake `DO NOTHING` clause
153153
/// based on reassigning the possible
154154
/// composite primary key to itself
155155
trait DoNothingClauseHelper {

diesel/src/pg/connection/copy.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Write for CopyFromSink<'_> {
2626
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
2727
self.conn
2828
.put_copy_data(buf)
29-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
29+
.map_err(std::io::Error::other)?;
3030
Ok(buf.len())
3131
}
3232

@@ -103,13 +103,12 @@ impl BufRead for CopyToBuffer<'_> {
103103
pq_sys::PQgetCopyData(self.conn.internal_connection.as_ptr(), &mut self.ptr, 0);
104104
match len {
105105
len if len >= 0 => {
106-
self.len = 1 + usize::try_from(len)
107-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?
106+
self.len = 1 + usize::try_from(len).map_err(std::io::Error::other)?
108107
}
109108
-1 => self.len = 0,
110109
_ => {
111110
let error = self.conn.last_error_message();
112-
return Err(std::io::Error::new(std::io::ErrorKind::Other, error));
111+
return Err(std::io::Error::other(error));
113112
}
114113
}
115114
self.offset = 0;

diesel/src/pg/query_builder/distinct_on.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use crate::expression::SelectableExpression;
1+
use crate::expression::{SelectableExpression, ValidGrouping};
22
use crate::pg::Pg;
3+
use crate::query_builder::group_by_clause::ValidGroupByClause;
34
use crate::query_builder::order_clause::NoOrderClause;
45
use crate::query_builder::{
5-
AstPass, FromClause, QueryFragment, QueryId, SelectQuery, SelectStatement,
6+
AstPass, FromClause, QueryFragment, QueryId, SelectClauseExpression, SelectQuery,
7+
SelectStatement,
68
};
9+
use crate::query_dsl::group_by_dsl::ValidDistinctForGroupBy;
710
use crate::query_dsl::methods::DistinctOnDsl;
811
use crate::query_dsl::order_dsl::ValidOrderingForDistinct;
912
use crate::result::QueryResult;
@@ -20,6 +23,8 @@ impl<T> ValidOrderingForDistinct<DistinctOnClause<T>> for NoOrderClause {}
2023
impl<T> ValidOrderingForDistinct<DistinctOnClause<T>> for OrderClause<(T,)> {}
2124
impl<T> ValidOrderingForDistinct<DistinctOnClause<T>> for OrderClause<T> where T: crate::Expression {}
2225

26+
impl<S, G, D> ValidDistinctForGroupBy<S, G> for DistinctOnClause<D> where (D, S): ValidGrouping<G> {}
27+
2328
impl<T> ValidOrderingForDistinct<DistinctOnClause<T>>
2429
for OrderClause<crate::expression::operators::Asc<T>>
2530
where
@@ -279,12 +284,15 @@ where
279284
impl<ST, F, S, D, W, O, LOf, G, H, Selection> DistinctOnDsl<Selection>
280285
for SelectStatement<FromClause<F>, S, D, W, O, LOf, G, H>
281286
where
287+
G: ValidGroupByClause,
282288
F: QuerySource,
283289
Selection: SelectableExpression<F>,
284290
Self: SelectQuery<SqlType = ST>,
285291
O: ValidOrderingForDistinct<DistinctOnClause<Selection>>,
286292
SelectStatement<FromClause<F>, S, DistinctOnClause<Selection>, W, O, LOf, G, H>:
287293
SelectQuery<SqlType = ST>,
294+
S: SelectClauseExpression<FromClause<F>>,
295+
(Selection, S::Selection): ValidGrouping<G::Expressions>,
288296
{
289297
type Output = SelectStatement<FromClause<F>, S, DistinctOnClause<Selection>, W, O, LOf, G, H>;
290298

diesel/src/query_builder/distinct_clause.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::backend::DieselReserveSpecialization;
22
use crate::query_builder::*;
3+
use crate::query_dsl::group_by_dsl::ValidDistinctForGroupBy;
34
use crate::query_dsl::order_dsl::ValidOrderingForDistinct;
45

56
#[derive(Debug, Clone, Copy, QueryId)]
@@ -28,6 +29,8 @@ where
2829

2930
impl<O> ValidOrderingForDistinct<NoDistinctClause> for O {}
3031
impl<O> ValidOrderingForDistinct<DistinctClause> for O {}
32+
impl<S, G> ValidDistinctForGroupBy<S, G> for NoDistinctClause {}
33+
impl<S, G> ValidDistinctForGroupBy<S, G> for DistinctClause {}
3134

3235
// This is rexported from another location
3336
#[allow(unreachable_pub, unused_imports)]

0 commit comments

Comments
 (0)