Changes between Version 1 and Version 2 of Ticket #34262, comment 15
- Timestamp:
- Feb 9, 2025, 9:09:13 AM (3 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34262, comment 15
v1 v2 9 9 > Just thinking out loud here. If option 2 is the path forward, 10 10 11 I think that raising awareness is the way to go here but I don't think that the proposed implementation of capturing errors and emitting warning is the way to go here. First because it'sbrittle given we don't know the extent of this problem and the MySQL implementation could change and secondly because it's not an approach we've taken with this class of problems.11 I think that raising awareness is the way to go here but I don't think that the proposed implementation of capturing errors and emitting warning is how we should do it. First because it would be brittle given we don't know the extent of this problem and the MySQL implementation could change and secondly because it's not an approach we've taken with this class of problems. 12 12 13 13 IMO this problem is very similar to how we let inappropriate casting errors bubble through and expect users to use `CAST` where necessary from the error messages over trying to detect such errors and point them directly at `django.db.models.functions.Cast`. In other words I think that it's better to have the user go through the following chain of thoughts … … 17 17 - Search for Django `CAST` / `ANY_VALUE` and endup on the `Cast` / `AnyValue` docs 18 18 19 than committing to building a bullet proof solution that hides away these details from users. For all we know MySQL could finally implement functional dependency detection properly and all of our efforts (and bugs trying to get it right but failing) would be wasted efforts.19 than committing to building a bullet proof solution that hides away these details from users. For all we know MySQL could finally implement functional dependency detection properly and all of our efforts (and bugs trying to get it right but failing) would be wasted. 20 20 21 For these reasons I believe that ''raising awareness'' is effectively the way to go but I think the way to do so is21 For these reasons I believe that the proper way of ''raising awareness'' here is to 22 22 23 23 1. Introduce an `AnyValue(Aggregate)` 24 24 2. Make sure the documentation mentions that its usage might be necessary on MySQL when mixing aggregate and non-aggregate functions when `sql_mode=only_full_group_by` in a `.. note` 25 3. Link to `AnyValue` documentation from the [https://docs.djangoproject.com/en/5.1/topics/db/aggregation/#aggregating-annotations aggregating annotations] section of the docs 25 3. Link to `AnyValue` documentation from the [https://docs.djangoproject.com/en/5.1/topics/db/aggregation/#aggregating-annotations aggregating annotations] section of the docs.