From c72001644fa794b82fa88a7d2ecc20197b01b6f2 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Tue, 12 Dec 2023 16:07:31 +0000 Subject: Updated DatabaseFeatures.bare_select_suffix on Oracle 23c. https://docs.oracle.com/en/database/oracle/oracle-database/23/nfcoa/application-development.html#GUID-4EB70EB9-4EE3-4FE2-99C4-86F7AAC60F12 --- django/db/models/functions/text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'django/db/models/functions') diff --git a/django/db/models/functions/text.py b/django/db/models/functions/text.py index 500fbea194..392061880c 100644 --- a/django/db/models/functions/text.py +++ b/django/db/models/functions/text.py @@ -261,13 +261,14 @@ class Reverse(Transform): def as_oracle(self, compiler, connection, **extra_context): # REVERSE in Oracle is undocumented and doesn't support multi-byte # strings. Use a special subquery instead. + suffix = connection.features.bare_select_suffix sql, params = super().as_sql( compiler, connection, template=( "(SELECT LISTAGG(s) WITHIN GROUP (ORDER BY n DESC) FROM " - "(SELECT LEVEL n, SUBSTR(%(expressions)s, LEVEL, 1) s " - "FROM DUAL CONNECT BY LEVEL <= LENGTH(%(expressions)s)) " + f"(SELECT LEVEL n, SUBSTR(%(expressions)s, LEVEL, 1) s{suffix} " + "CONNECT BY LEVEL <= LENGTH(%(expressions)s)) " "GROUP BY %(expressions)s)" ), **extra_context, -- cgit v1.3