﻿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
30988	Deprecate the barely documented InvalidQuery exception.	Simon Charette	Simon Charette	"The `django.db.models.query.InvalidQuery` exception is [https://docs.djangoproject.com/en/2.2/topics/db/sql/#deferring-model-fields only mentioned once by name in the documentation] without reference to its defining module.

It's used for the documented `QuerySet.raw` usage and [https://github.com/django/django/blob/4527d5db0f0a939439b9373f7a9a4eee3386afff/django/db/models/query_utils.py#L23 abused] for [https://github.com/django/django/blob/4527d5db0f0a939439b9373f7a9a4eee3386afff/django/db/models/query_utils.py#L221-L254 field deferring select related misuse].

I suggest we replace the documented usage by raising `FieldDoesNotExist` instead and the latter undocumented abuse by raising `FieldError` while providing a deprecation shim to warn on usages of `except InvalidQuery`."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
