#34544 closed Bug (fixed)
models.TextField with =None filter throws Error for Oracle — at Version 4
| Reported by: | Michael Smith | Owned by: | Jatin-tec |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 4.2 |
| Severity: | Release blocker | Keywords: | Oracle isnull lob |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Model contains
somefield = models.TextField(blank=True, null=True)
At 4.1.9:
print(MyModel.objects.filter(somefield=None).only('id').query)
SELECT "TNAME_MYMODEL"."ID" FROM "TNAME_MYMODEL" WHERE "TNAME_MYMODEL"."SOMEFIELD" IS NULL
works
At 4.2.0:
print(MyModel.objects.filter(somefield=None).only('id').query)
SELECT "TNAME_MYMODEL"."ID" FROM "TNAME_MYMODEL" WHERE DBMS_LOB.SUBSTR("TNAME_MYMODEL"."SOMEFIELD") IS NULL
DatabaseError: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1
Change History (4)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
the specific change was in django/db/models/lookups.py
from:
sql, params = compiler.compile(self.lhs)
to:
sql, params = self.process_lhs(compiler, connection):
comment:3 by , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:4 by , 2 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → needsinfo |
| Status: | assigned → closed |
Thanks for this ticket, however it works for me. I cannot reproduce ORA-06502 on Oracle 19c.
Please reopen the ticket if you can debug your issue and provide a small sample project that reproduces the issue.
Note:
See TracTickets
for help on using tickets.
This was introduced in this commit: https://github.com/django/django/commit/09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca