﻿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
35972	Custom lookup example raises TypeError when looked up against a Subquery	Jacob Walls	Jacob Walls	"On the forum I [https://forum.djangoproject.com/t/advanced-postgresql-functions-like-json-to-recordset-json-jsonb-to-recordset-jsonb/35542/5 shared] the TypeError I was getting when registering a custom lookup for a `JSONField`:

{{{#!python
File models/lookups.py:13, in NotEqual.as_sql(self, compiler, connection)
     11 lhs, lhs_params = self.process_lhs(compiler, connection)
     12 rhs, rhs_params = self.process_rhs(compiler, connection)
---> 13 params = lhs_params + rhs_params
     14 return ""%s <> %s"" % (lhs, rhs), params

TypeError: can only concatenate list (not ""tuple"") to list
}}}

Since this problematic pattern is [https://docs.djangoproject.com/en/4.2/howto/custom-lookups/#a-lookup-example documented], we should either fix the documentation or fix the underlying reason it doesn't work. I haven't looked into whether there are backwards-compatible ways to do the latter.

Reproduction is just to follow the documented pattern and register it with a JSONField e.g. `@JSONField.register_lookup`, and then try to use it in an ORM query."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	regex, mysql		Ready for checkin	1	0	0	0	0	0
