Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Correct position for ORDER BY if having GROUP BY in the same clause
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius de Bruijn committed Feb 28, 2020
1 parent b7f4d2c commit 5d5d676
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.1.13

- Correct position for GROUP BY if having ORDER BY in the same clause

## v0.1.12

- Add a ParameterizedValue::Enum in order to support writing to native enum columns in Postgres
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quaint"
version = "0.1.12"
version = "0.1.13"
authors = [
"Julius de Bruijn <[email protected]>",
"Katharina Fey <[email protected]>",
Expand Down
8 changes: 4 additions & 4 deletions src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ pub trait Visitor<'a> {
self.write(" WHERE ")?;
self.visit_conditions(conditions)?;
}
if !select.ordering.is_empty() {
self.write(" ORDER BY ")?;
self.visit_ordering(select.ordering)?;
}
if !select.grouping.is_empty() {
self.write(" GROUP BY ")?;
self.visit_grouping(select.grouping)?;
Expand All @@ -168,6 +164,10 @@ pub trait Visitor<'a> {
self.write(" HAVING ")?;
self.visit_conditions(conditions)?;
}
if !select.ordering.is_empty() {
self.write(" ORDER BY ")?;
self.visit_ordering(select.ordering)?;
}

self.visit_limit_and_offset(select.limit, select.offset)?;
} else if select.columns.is_empty() {
Expand Down

0 comments on commit 5d5d676

Please sign in to comment.