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 db19e7b commit 7e24aa6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.2.0-alpha.9

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

## v0.2.0-alpha.8

- AVG and SUM implementations

## v0.2.0-alpha.7
Expand Down Expand Up @@ -37,6 +43,10 @@ Breaking changes ahead
- Unique/null constr error should be multi-column (https://github.com/prisma/quaint/pull/62)
- Add optional serde support (https://github.com/prisma/quaint/pull/63)

## 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
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 7e24aa6

Please sign in to comment.