Description of problem: When clicking Distros -> All and then header of the table (like "OS Major Version"), the 500 error is returned to the browser. Logs on beaker side show (0.11.3 version): 2013-05-16 17:42:56,030 cherrypy.msg INFO HTTP: Page handler: <bound method Distros.index of <bkr.server.distro.Distros object at 0x7f7feae485d0>> Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 121, in _run self.main() File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 264, in main body = page_handler(*virtual_path, **self.params) File "<string>", line 3, in index File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 361, in expose *args, **kw) File "<generated code>", line 0, in run_with_transaction File "/usr/lib/python2.6/site-packages/peak/rules/core.py", line 153, in __call__ return self.body(*args, **kw) File "/usr/lib/python2.6/site-packages/turbogears/database.py", line 458, in sa_rwt retval = func(*args, **kw) File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 244, in _expose @abstract() File "<generated code>", line 0, in _expose File "/usr/lib/python2.6/site-packages/peak/rules/core.py", line 153, in __call__ return self.body(*args, **kw) File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 390, in <lambda> fragment, options, args, kw))) File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 425, in _execute_func output = errorhandling.try_call(func, *args, **kw) File "/usr/lib/python2.6/site-packages/turbogears/errorhandling.py", line 77, in try_call return func(self, *args, **kw) File "<string>", line 3, in index File "/usr/lib/python2.6/site-packages/turbogears/paginate.py", line 268, in decorated output[var_name] = var_data[offset:endpoint] File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 1560, in __getitem__ return list(res) File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 1721, in __iter__ return self._execute_and_instances(context) File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 1726, in _execute_and_instances mapper=self._mapper_zero_or_none()) File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 724, in execute clause, params or {}) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1191, in execute params) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1271, in _execute_clauseelement return self.__execute_context(context) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1302, in __execute_context context.parameters[0], context=context) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1401, in _cursor_execute context) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1394, in _cursor_execute context) File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/default.py", line 299, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute self.errorhandler(self, exc, value) File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (OperationalError) (1066, "Not unique table/alias: 'osversion'") 'SELECT distro.id AS distro_id, distro.name AS distro_name, distro.osversion_id AS distro_osversion_id, distro.date_created AS distro_date_created \nFROM distro INNER JOIN osversion ON osversion.id = distro.osversion_id INNER JOIN osmajor ON osmajor.id = osversion.osmajor_id LEFT OUTER JOIN osversion ON osversion.id = distro.osversion_id LEFT OUTER JOIN osmajor ON osmajor.id = osversion.osmajor_id \nWHERE EXISTS (SELECT 1 \nFROM distro_tree \nWHERE distro.id = distro_tree.distro_id AND (EXISTS (SELECT 1 \nFROM distro_tree_lab_controller_map \nWHERE distro_tree.id = distro_tree_lab_controller_map.distro_tree_id))) ORDER BY osmajor.osmajor ASC, distro.name ASC, distro.date_created DESC \n LIMIT 0, 50' () Version-Release number of selected component (if applicable): Logs from 0.11.3 Reproducible on 0.12.1 How reproducible: always Steps to Reproduce: 1. Click Distros -> All and try to sort by OS Major version 2. 3. Actual results: error 500 Expected results: sorted list in UI Additional info:
*** This bug has been marked as a duplicate of bug 972397 ***