Fixes: https://pagure.io/koji/issue/2270
orderCol = self.colsByAlias.get(order) if orderCol: # use alias as order orderCol = order elif order in self.columns: # use column as order orderCol = order
The problem with this is that we have two different forms of aliases here.
QueryProcessor
Consider the case with query_processor where we pass
query_processor
field = 'EXTRACT(EPOCH FROM ev1.time) AS create_ts'
alias = 'create_ts'
Here the alias after the AS in the field definition matches the alias for the dict given to QueryProcessor, but:
AS
I think in most cases, this is going to work because we mostly use sane aliases, but we'd need to check to be sure.
I suppose we could have QueryProcessor add the AS clauses, but we'd also have to do a lot of checking there (and have the invocations stop including them in the field).
And if we do get to a point where we can always use the literal alias in the order, then the code should probably be something more like:
# only allow sane order values if order not in self.columns and order not in self.aliases: raise Exception('invalid order: ' + order) order_exprs.append(order + direction)
So, do you think, there is a sane way to order query_history by create_ts without touching QueryProcessor?
query_history
create_ts
rebased onto 9f543862795e6c6cddd74e33dc93d30884f027d1
updated to sort it client-side
Metadata Update from @tkopecek: - Pull-request tagged with: testing-ready
Metadata Update from @jcupova: - Pull-request untagged with: testing-ready - Pull-request tagged with: no_qe
Commit 272a7184 fixes this pull-request
Pull-Request has been merged by tkopecek
Fixes: https://pagure.io/koji/issue/2270