diff options
| author | Devin Cox <dcox@surefyre.co> | 2024-08-09 13:56:56 -0700 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-08-12 15:35:19 +0200 |
| commit | e03083917db03757e48f8edac4c8491b72c8a3c4 (patch) | |
| tree | 9b96fb24ab403cc56d5510e74d23a70eeab207fa /docs | |
| parent | 228128618bd895ecad235d2215f4ad4e3232595d (diff) | |
Fixed #35586 -- Added support for set-returning database functions.
Aggregation optimization didn't account for not referenced set-returning annotations on Postgres.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/expressions.txt | 10 | ||||
| -rw-r--r-- | docs/releases/5.2.txt | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt index 1b6a208d01..7833580ac1 100644 --- a/docs/ref/models/expressions.txt +++ b/docs/ref/models/expressions.txt @@ -1095,6 +1095,16 @@ calling the appropriate methods on the wrapped expression. :py:data:`NotImplemented` which forces the expression to be computed on the database. + .. attribute:: set_returning + + .. versionadded:: 5.2 + + Tells Django that this expression contains a set-returning function, + enforcing subquery evaluation. It's used, for example, to allow some + Postgres set-returning functions (e.g. ``JSONB_PATH_QUERY``, + ``UNNEST``, etc.) to skip optimization and be properly evaluated when + annotations spawn rows themselves. Defaults to ``False``. + .. method:: resolve_expression(query=None, allow_joins=True, reuse=None, summarize=False, for_save=False) Provides the chance to do any preprocessing or validation of diff --git a/docs/releases/5.2.txt b/docs/releases/5.2.txt index 02a068e5af..a15e669205 100644 --- a/docs/releases/5.2.txt +++ b/docs/releases/5.2.txt @@ -218,6 +218,10 @@ Models * Added support for validation of model constraints which use a :class:`~django.db.models.GeneratedField`. +* The new :attr:`.Expression.set_returning` attribute specifies that the + expression contains a set-returning function, enforcing subquery evaluation. + This is necessary for many Postgres set-returning functions. + Requests and Responses ~~~~~~~~~~~~~~~~~~~~~~ |
