vapor-community / pagination

Simple Vapor 3 Pagination
MIT License
64 stars 15 forks source link

Pagination fails when sorting #26

Open LinusGeffarth opened 4 years ago

LinusGeffarth commented 4 years ago

I'm trying to make a query with pagination, filtering and sorting. My query looks like this:

try Space.query(on: req).filter(\.isFeatured == true).sort(\.updatedAt, .descending)
    .paginate(for: req).flatMap { (paginated) in
        try paginated.data.relationals(req: req)
}

It worked fine before adding the .sort(...) call. But after, I get this message:

column "spaces.createdAt" must appear in the GROUP BY clause or be used in an aggregate function

What do I need to do? (btw I'm using PSQL)

perhaps related to #20