diff src/pgsql_storage.py @ 378:22832c1d2827

storage (pgsql): don't specify table name in ORDER BY clause as it can cause troubles in some requests.
author Goffi <goffi@goffi.org>
date Sat, 12 Jan 2019 16:41:45 +0100
parents 9a787881b824
children aa3a464df605
line wrap: on
line diff
--- a/src/pgsql_storage.py	Thu Jan 10 08:42:49 2019 +0100
+++ b/src/pgsql_storage.py	Sat Jan 12 16:41:45 2019 +0100
@@ -843,16 +843,16 @@
         """
         keys = ext_data.get('order_by')
         if not keys:
-            return u'ORDER BY items.updated ' + direction
+            return u'ORDER BY updated ' + direction
         cols_statmnt = []
         for key in keys:
             if key == 'creation':
-                column = 'items.item_id'  # could work with items.created too
+                column = 'item_id'  # could work with items.created too
             elif key == 'modification':
-                column = 'items.updated'
+                column = 'updated'
             else:
                 log.msg(u"WARNING: Unknown order by key: {key}".format(key=key))
-                column = 'items.updated'
+                column = 'updated'
             cols_statmnt.append(column + u' ' + direction)
 
         return u"ORDER BY " + u",".join([col for col in cols_statmnt])