Closed smichaku closed 6 years ago
Using the Count SQL aggregator with postgres backend (and perhaps others) results in the following error:
count, err := database.transitions.Count(filter.All())
pq: column "*" does not exist
This may be fixed by replacing the "*" field with the collection's identity field:
diff --git a/backends/sql-aggregator.go b/backends/sql-aggregator.go index 4b1df58..4e2b362 100644 --- a/backends/sql-aggregator.go +++ b/backends/sql-aggregator.go @@ -18,7 +18,7 @@ func (self *SqlBackend) Sum(collection *dal.Collection, field string, f ...*filt } func (self *SqlBackend) Count(collection *dal.Collection, f ...*filter.Filter) (uint64, error) { - v, err := self.aggregateFloat(collection, filter.Count, `*`, f) + v, err := self.aggregateFloat(collection, filter.Count, collection.IdentityField, f) return uint64(v), err }
Good find, thank you!
Using the Count SQL aggregator with postgres backend (and perhaps others) results in the following error:
count, err := database.transitions.Count(filter.All())
This may be fixed by replacing the "*" field with the collection's identity field: