Fix for get_resources with postgresql

Add max_ts and min_ts to GROUP BY in sub-query, since they need to be aggregated to SELECT them.

Closes-Bug: #1241526
Change-Id: Ifdd2bc661b5da31bd40d1c3fa1fc442d7417399f
This commit is contained in:
Thomas Maddox 2013-10-21 15:55:49 +00:00
parent 205f733dda
commit 0a98159bc9

View File

@ -349,7 +349,11 @@ class Connection(base.Connection):
).filter( ).filter(
Meter.resource_id == ts_subquery.c.resource_id, Meter.resource_id == ts_subquery.c.resource_id,
Meter.timestamp == ts_subquery.c.max_ts Meter.timestamp == ts_subquery.c.max_ts
).group_by(Meter.resource_id).subquery() ).group_by(
ts_subquery.c.resource_id,
ts_subquery.c.max_ts,
ts_subquery.c.min_ts
).subquery()
query = session.query( query = session.query(
Meter, Meter,