﻿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
36773	ManyToMany related manager .count() returns 0 while .all().count() returns correct value (Django 5.2.9 and 6.0.0)	Daniel Davtyan		"Environment

Django: 5.2.9

Python: 3.12.x

Database: PostgreSQL

OS: (e.g. Ubuntu 22.04 – fill in)

The same code previously worked correctly on Django 4.x. After upgrading to Django 5.x (now 6.0), I see a discrepancy between ManyToMany related manager .count() and .all().count() in tests.

This looks similar to the regression tracked as #36197, which was fixed for ManyToManyField related managers using a through model with to_field, but I am still seeing the same symptom on Django 5.2.9.


"	Bug	new	Database layer (models, ORM)	6.0	Release blocker		count, django, orm	Daniel Davtyan	Unreviewed	0	0	0	0	0	0
