Revert "Protect against non-determinstic sort"
This reverts commit 175bfe0482
.
The change causes the following error if you're
unlucky enough to have such a marker column.
ArgumentError: Only '=', '!=', 'is_()', 'isnot()' operators can be used with None/True/False
I saw test_floatingip_list_with_pagination failing,
where fixed_port_id of the marker was None.
Closes-Bug: #1656262
Change-Id: I6c32949d789f25d877d329ef0ae9d8650cb81acf
This commit is contained in:
parent
eb1dd050f1
commit
e74b45d0eb
@ -222,21 +222,6 @@ class CommonDbMixin(object):
|
|||||||
if sorts:
|
if sorts:
|
||||||
sort_keys = db_utils.get_and_validate_sort_keys(sorts, model)
|
sort_keys = db_utils.get_and_validate_sort_keys(sorts, model)
|
||||||
sort_dirs = db_utils.get_sort_dirs(sorts, page_reverse)
|
sort_dirs = db_utils.get_sort_dirs(sorts, page_reverse)
|
||||||
# we always want deterministic results for subqueries so add pks
|
|
||||||
# to sorting when present.
|
|
||||||
# (http://docs.sqlalchemy.org/en/latest/orm/
|
|
||||||
# loading_relationships.html#subqueryload-ordering)
|
|
||||||
# (http://docs.sqlalchemy.org/en/latest/faq/
|
|
||||||
# ormconfiguration.html#faq-subqueryload-limit-sort)
|
|
||||||
uk_sets = sa_utils.get_unique_keys(model)
|
|
||||||
if uk_sets and limit:
|
|
||||||
# just grab first set of unique keys and use them.
|
|
||||||
# if model has no unqiue sets, 'paginate_query' will
|
|
||||||
# warn if sorting is unstable
|
|
||||||
for k in uk_sets[0]:
|
|
||||||
if k not in sort_keys:
|
|
||||||
sort_keys.append(k)
|
|
||||||
sort_dirs.append('asc')
|
|
||||||
collection = sa_utils.paginate_query(collection, model, limit,
|
collection = sa_utils.paginate_query(collection, model, limit,
|
||||||
marker=marker_obj,
|
marker=marker_obj,
|
||||||
sort_keys=sort_keys,
|
sort_keys=sort_keys,
|
||||||
|
Loading…
Reference in New Issue
Block a user