diff options
| author | varunkasyap <varunkasyap@hotmail.com> | 2026-02-02 13:50:16 +0530 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-10 16:47:44 -0500 |
| commit | 3282d9f4edbe5d341a0fa2a8c62b435b3885ab64 (patch) | |
| tree | 391e2c4601b4c25fbacad492f677d2cc383c77e9 /tests/aggregation | |
| parent | 977345f70df64a1d524e185e05b956e57c612110 (diff) | |
Fixed #36890 -- Supported StringAgg(distinct=True) on SQLite with the default delimiter.
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/tests.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index bf6bf27031..0a975dcb52 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -3,6 +3,7 @@ import math import re from decimal import Decimal from itertools import chain +from unittest import skipUnless from django.core.exceptions import FieldError from django.db import NotSupportedError, connection @@ -579,6 +580,16 @@ class AggregateTestCase(TestCase): ) self.assertCountEqual(books["ratings"].split(","), ["3", "4", "4.5", "5"]) + @skipUnless(connection.vendor == "sqlite", "Special default case for SQLite.") + def test_distinct_on_stringagg_sqlite_special_case(self): + """ + Value(",") is the only delimiter usable on SQLite with distinct=True. + """ + books = Book.objects.aggregate( + ratings=StringAgg(Cast(F("rating"), CharField()), Value(","), distinct=True) + ) + self.assertCountEqual(books["ratings"].split(","), ["3.0", "4.0", "4.5", "5.0"]) + @skipIfDBFeature("supports_aggregate_distinct_multiple_argument") def test_raises_error_on_multiple_argument_distinct(self): message = ( @@ -589,7 +600,7 @@ class AggregateTestCase(TestCase): Book.objects.aggregate( ratings=StringAgg( Cast(F("rating"), CharField()), - Value(","), + Value(";"), distinct=True, ) ) |
