#34606: Right() function on Oracle and SQLite returns improper value when the
length is zero.
-------------------------------------+-------------------------------------
Reporter: Kacper Wolkiewicz | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle right substr | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. SQLite is also affected. As far as I'm aware, it's
enough to pass a substring length, e.g.:
{{{#!diff
diff --git a/django/db/models/functions/text.py
b/django/db/models/functions/text.py
index fba2840c4b..f717213636 100644
--- a/django/db/models/functions/text.py
+++ b/django/db/models/functions/text.py
@@ -276,7 +276,7 @@ class Right(Left):
def get_substr(self):
return Substr(
- self.source_expressions[0], self.source_expressions[1] *
Value(-1)
+ self.source_expressions[0], self.source_expressions[1] *
Value(-1), self.source_expressions[1],
)
}}}
Would you like to prepare a patch? (a regression test is required.)
--
Ticket URL: <https://code.djangoproject.com/ticket/34606#comment:1>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/010701886bdff30b-a365133b-d6d9-4a9a-b475-3867ae223ad6-000000%40eu-central-1.amazonses.com.