﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29108	"QuerySet.distinct().order_by()[slice].count() crashes with ""TypeError: can only concatenate tuple (not ""list"") to tuple"""	Stephen Brooks	Simon Charette	"Seen in django version 2.0.2
A model query triggers line 1448 in the file django/db/models/sql/compiler.py to raise a TypeError:

`params = params + self.query.sub_params`

''TypeError exception: can only concatenate tuple (not ""list"") to tuple''

This line is in the `as_sql` method of the `SQLAggregateCompiler` class.

How to reproduce:
Issue a query on a model which is related to another model, and include distinct, order_by (on a string field in the related model), a slice and a call to count().

e.g.
   `Post.objects.distinct().order_by('author__last_name')[:20].count()`

The presence of `distinct()` above, you could argue, is not needed, however, the above represents a simplification of the more complex query with which I originally saw the problem, and there the `distinct()` followed a more complex cross-table filter.

"	Bug	closed	Database layer (models, ORM)	2.0	Release blocker	fixed	TypeError list tuple	Mariusz Felisiak	Accepted	1	0	0	0	0	0
