﻿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
36722	MySQL backend raises error when selecting 0 using an expression targeting an autofield.	Clifford Gama	Clifford Gama	"In MySQL, Django currently raises a `ValueError` when trying to insert 0 into an `AutoField`, which is correct when saving because MySQL [https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html#sqlmode_no_auto_value_on_zero interprets 0 as auto-increment] unless `NO_AUTO_VALUE_ON_ZERO` is set.

However, the backend also raises an error when using expressions like Value(0, BigAutoField()) in select filters, which I believe is a bug.

Discovered in [https://djangoci.com/job/pull-requests-noble/database=mysql,label=noble-pr,python=python3.12/1000/testReport/junit/aggregation.tests/AggregateAnnotationPruningTests/test_aggregate_reference_lookup_rhs_iter/ these logs]."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	allows_auto_pk_0		Ready for checkin	1	0	0	0	0	0
