Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#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 Mariusz Felisiak)

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:2 by Michael Smith, 17 months 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 Jatin-tec, 17 months ago

Owner: changed from nobody to Jatin-tec
Status: newassigned

comment:4 by Mariusz Felisiak, 17 months ago

Description: modified (diff)
Resolution: needsinfo
Status: assignedclosed

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.
Back to Top