paginate_query explodes when sort_keys contains a boolean column

Bug #1656947 reported by Kevin Benton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.db
Confirmed
Medium
Kevin Benton

Bug Description

The paginate_query function explodes if a marker is passed in and one of the sort_keys is a boolean column.

      File "neutron/db/db_base_plugin_v2.py", line 1333, in get_ports
        page_reverse=page_reverse)
      File "neutron/db/db_base_plugin_v2.py", line 1322, in _get_ports_query
        sort_dirs=sort_dirs)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/utils.py", line 235, in paginate_query
        crit_attrs.append((model_attr > marker_values[i]))
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line 318, in __gt__
        return self.operate(gt, other)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 175, in operate
        return op(self.comparator, *other, **kwargs)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line 318, in __gt__
        return self.operate(gt, other)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/properties.py", line 269, in operate
        return op(self.__clause_element__(), *other, **kwargs)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line 318, in __gt__
        return self.operate(gt, other)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 742, in operate
        return op(self.comparator, *other, **kwargs)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line 318, in __gt__
        return self.operate(gt, other)
      File "<string>", line 1, in <lambda>
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/type_api.py", line 60, in operate
        return o[0](self.expr, op, *(other + o[1:]), **kwargs)
      File "/opt/stack/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/default_comparator.py", line 53, in _boolean_compare
        "Only '=', '!=', 'is_()', 'isnot()' operators can "
    ArgumentError: Only '=', '!=', 'is_()', 'isnot()' operators can be used with None/True/False

Changed in oslo.db:
assignee: nobody → Kevin Benton (kevinbenton)
Changed in oslo.db:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.db 4.18.0

This issue was fixed in the openstack/oslo.db 4.18.0 release.

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.