From 2f0ded587750a8c3b7fbb989d010ba38fc30a55f Mon Sep 17 00:00:00 2001 From: Anderson Pierre Cardoso Date: Wed, 16 Nov 2011 21:33:41 -0200 Subject: [PATCH] This fixes this query for working with postgresql. The lack of quotes was creating trouble because of the mixed case in table names. --- revisions/managers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revisions/managers.py b/revisions/managers.py index e186e47..06cf2d4 100644 --- a/revisions/managers.py +++ b/revisions/managers.py @@ -39,7 +39,7 @@ def current(self): # to multiple queries or working entirely with raw SQL. comparator_name = base.get_comparator_name() comparator_table = get_table_for_field(qs.query.model, comparator_name) - where = '{comparator_table}.{comparator} = (SELECT MAX({comparator}) FROM {table} as sub WHERE {table}.cid = sub.cid)'.format( + where = '"{comparator_table}"."{comparator}" = (SELECT MAX("{comparator}") FROM "{table}" as sub WHERE "{table}".cid = sub.cid)'.format( table=base_table, comparator=comparator_name, comparator_table=comparator_table)