Changes between Initial Version and Version 1 of Ticket #26898
- Timestamp:
- Jul 14, 2016, 12:08:06 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26898 – Description
initial v1 1 1 Minimal repro: https://github.com/sonoflilit/django-count-bug 2 2 3 ```python 3 {{{ 4 4 def test_bug(self): 5 5 a = A.objects.create() … … 12 12 # 2?! It's clearly 1! 13 13 self.assertEquals(1, a.c_count) 14 ``` 14 }}} 15 15 16 ```sql 16 {{{ 17 17 SELECT "bug_a"."id", 18 18 Count("bug_b"."id") AS "b_count", … … 24 24 ON ( "bug_a"."id" = "bug_c"."a_id" ) 25 25 GROUP BY "bug_a"."id" 26 ``` 26 }}} 27 27 28 28 I think it should be: 29 29 30 ```sql 30 {{{ 31 31 SELECT "bug_a"."id", 32 32 Count(distinct "bug_b"."id") AS "b_count", … … 38 38 ON ( "bug_a"."id" = "bug_c"."a_id" ) 39 39 GROUP BY "bug_a"."id" 40 ``` 40 }}} 41 41 42 42 Reproduces on `sqlite3` as well as heroku-hosted `postgresql`.