#36890: Allow providing distinct=True to StringAgg on SQLite by specifying the
default delimiter
-------------------------------------+-------------------------------------
     Reporter:  AJ Slater            |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  6.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Aggregate, sqlite3,  |             Triage Stage:  Accepted
  StringAgg                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

 * keywords:  Aggregate, sqlite3 => Aggregate, sqlite3, StringAgg
 * stage:  Unreviewed => Accepted
 * summary:
     StringAgg doesn't allow DISTINCT in sqlite3 while native GROUP_CONCAT
     does
     =>
     Allow providing distinct=True to StringAgg on SQLite by specifying the
     default delimiter
 * type:  Uncategorized => New feature

Comment:

 Seems reasonable, we should be able to drop the delimiter if
 `self.delimiter.value == models.Value(",")` similar to what the MySQL code
 path does:

 {{{#!py
             # Drop the delimiter from the source expressions.
             c.source_expressions = c.source_expressions[:-1]
 }}}

 That should evade the check:
 {{{#!py
         if (
             self.distinct
             and not
 connection.features.supports_aggregate_distinct_multiple_argument
             and len(super().get_source_expressions()) > 1
         ):
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36890#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019c10760277-809d8e04-a044-4229-9a75-462dbd951bb1-000000%40eu-central-1.amazonses.com.

Reply via email to