ipdevinfo crash: could not identify an ordering operator for type point

Bug #675543 reported by Morten Brekkevold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Morten Brekkevold

Bug Description

Trying to browse a router in NAV 3.7.x gave this error:
-----
Environment:

Request Method: GET
Request URL: http://nav.example.org/ipdevinfo/example-gw.example.org/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['nav.django']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.common.CommonMiddleware')

Traceback:
File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response
  86. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/nav/lib/python/nav/web/ipdevinfo/views.py" in ipdev_details
  347. netbox, port_view_perspective, activity_interval)
File "/usr/local/nav/lib/python/nav/web/ipdevinfo/views.py" in get_port_view
  250. module, perspective, activity_interval))
File "/usr/local/nav/lib/python/nav/web/ipdevinfo/utils.py" in get_module_view
  55. ports = module_object.get_gwports_sorted()
File "/usr/local/nav/lib/python/nav/models/manage.py" in get_gwports_sorted
  355. interface_names = [p.ifname for p in ports]
File "/var/lib/python-support/python2.5/django/db/models/query.py" in _result_iter
  185. self._fill_cache()
File "/var/lib/python-support/python2.5/django/db/models/query.py" in _fill_cache
  618. self._result_cache.append(self._iter.next())
File "/var/lib/python-support/python2.5/django/db/models/query.py" in iterator
  275. for row in self.query.results_iter():
File "/var/lib/python-support/python2.5/django/db/models/sql/query.py" in results_iter
  206. for rows in self.execute_sql(MULTI):
File "/var/lib/python-support/python2.5/django/db/models/sql/query.py" in execute_sql
  1734. cursor.execute(sql, params)
File "/var/lib/python-support/python2.5/django/db/backends/util.py" in execute
  19. return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /ipdevinfo/oslo-gw.uninett.no/
Exception Value: could not identify an ordering operator for type point
HINT: Use an explicit ordering operator or modify the query.

Tags: ipdevinfo
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :

This is caused by PostgreSQL because Django issues a query using DISTINCT and involving the room table. PostgreSQL has no default ordering behavior for the POINT data type, which causes problems when ordering of the new room.location column is needed.

Suggested fix is to define a bunch of ordering operator for the POINT data type in the NAV database. It's probably a lot simpler then to make sure Django never issues room-related queries where the location ordering matters to PostgreSQL.

Changed in nav:
assignee: nobody → Morten Brekkevold (mbrekkevold)
status: Confirmed → In Progress
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :
Changed in nav:
status: In Progress → Fix Committed
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :

On second thought, this will cause other problems. Only a superuser can create new operator classes, and db init stuff will run manage.sql w/friends as the nav database user. manage.sql will therefore fail.

Running manage.sql as the superuser isn't really an option either, since that would create everything owned by the superuser.

Changed in nav:
status: Fix Committed → In Progress
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :
Changed in nav:
status: In Progress → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.