Skip to content

Commit

Permalink
Merge pull request #8 from sgoll/backport-4076-4116-4398
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich authored Feb 17, 2025
2 parents 5291e99 + 8c56ba2 commit f3cdbaf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Increasing the minimal supported Rust version will always be coupled at least wi
* Adjust a custom compile error message
* Fix a bug that restricted the number of allowed columns in `COPY FROM` statements to 12
* Expose some SqliteValue helper functions
* Use consistent whitespace in `ASC`/`DESC`, `DISTINCT ON`, and `DELETE FROM` clauses

## [2.2.7] 2025-01-31

Expand Down
4 changes: 2 additions & 2 deletions diesel/src/expression/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,12 @@ postfix_operator!(IsNull, " IS NULL");
postfix_operator!(IsNotNull, " IS NOT NULL");
postfix_operator!(
Asc,
" ASC ",
" ASC",
crate::expression::expression_types::NotSelectable
);
postfix_operator!(
Desc,
" DESC ",
" DESC",
crate::expression::expression_types::NotSelectable
);

Expand Down
2 changes: 1 addition & 1 deletion diesel/src/pg/query_builder/distinct_on.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ where
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, Pg>) -> QueryResult<()> {
out.push_sql("DISTINCT ON (");
self.0.walk_ast(out.reborrow())?;
out.push_sql(")");
out.push_sql(") ");
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_builder/delete_statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ where
Ret: QueryFragment<DB>,
{
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
out.push_sql("DELETE ");
out.push_sql("DELETE");
self.from_clause.walk_ast(out.reborrow())?;
self.where_clause.walk_ast(out.reborrow())?;
self.returning.walk_ast(out.reborrow())?;
Expand Down
6 changes: 3 additions & 3 deletions examples/mysql/all_about_inserts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ fn examine_sql_from_insert_get_results_batch() {
`users`.`hair_color`, `users`.`created_at`, \
`users`.`updated_at` \
FROM `users` \
ORDER BY `users`.`id` DESC \
ORDER BY `users`.`id` DESC \
-- binds: []";
assert_eq!(load_sql, debug_query::<Mysql, _>(&load_query).to_string());
}
Expand Down Expand Up @@ -372,7 +372,7 @@ fn examine_sql_from_insert_get_result() {
`users`.`hair_color`, `users`.`created_at`, \
`users`.`updated_at` \
FROM `users` \
ORDER BY `users`.`id` DESC \
ORDER BY `users`.`id` DESC \
-- binds: []";
assert_eq!(load_sql, debug_query::<Mysql, _>(&load_query).to_string());
}
Expand All @@ -399,7 +399,7 @@ fn examine_sql_from_explicit_returning() {
debug_query::<Mysql, _>(&insert_query).to_string()
);
let load_query = users.select(id).order(id.desc());
let load_sql = "SELECT `users`.`id` FROM `users` ORDER BY `users`.`id` DESC -- binds: []";
let load_sql = "SELECT `users`.`id` FROM `users` ORDER BY `users`.`id` DESC -- binds: []";
assert_eq!(load_sql, debug_query::<Mysql, _>(&load_query).to_string());
}

Expand Down

0 comments on commit f3cdbaf

Please sign in to comment.