class Meta:
constraints = [
models.CheckConstraint(
check=models.Q(metadata__stage="stable"),
name="only_stable_version",
),
]
}}}
Crashes with:
{{{
File "/django/django/db/backends/oracle/base.py", line 557, in execute
return self.cursor.execute(query, self._param_generator(params))
cx_Oracle.DatabaseError: ORA-00904: "DBMS_LOB"."SUBSTR": invalid
identifier
}}}
`DBMS_LOB.SUBSTR` is unnecessary in this case.
It's not a regression.
--
Ticket URL: <https://code.djangoproject.com/ticket/34060>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: David Sanders (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:2>
* owner: nobody => Aravind Swaminathan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:3>
Comment (by r4ge):
Hi, I may be wrong as this I am just new to this.
The issue seems to be here "/backends/oracle/operations.py"
{{{
def lookup_cast(self, lookup_type, internal_type=None):
if lookup_type in ("iexact", "icontains", "istartswith",
"iendswith"):
return "UPPER(%s)"
if internal_type == "JSONField" and lookup_type == "exact":
return "DBMS_LOB.SUBSTR(%s)"
return "%s"
}}}
The condition might be
{{{
if internal_type != "JSONField" and lookup_type == "exact": # if the type
is not JSONField
}}}
Can I pick this up?
Comment (by Mariusz Felisiak):
Replying to [comment:3 r4ge]:
> The condition might be
>
> {{{
> if internal_type != "JSONField" and lookup_type == "exact": # if the
type is not JSONField
> }}}
>
> Can I pick this up?
This is not a correct solution, as generally `DBMS_LOB.SUBSTR()` is
necessary for `JSONField`. Do you have an Oracle setup? Unfortunately, you
will not be able to work on this ticket without it.
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:4>
Comment (by r4ge):
No, Trying to setup the oracle once done will update if I found the
solution.
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:5>
Comment (by Amir Karimi):
Replying to [comment:5 r4ge]:
> No, Trying to setup the oracle once done will update if I found the
solution.
How's it going with this issue? Have you got it done?
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:6>
* owner: nobody => raydeal
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:7>
Comment (by raydeal):
This error is because JSON is stored in NCLOB database type but according
to Oracle documentation:
Oracle Database does not support constraints on columns or attributes
whose type is a LOB, with the following exception: NOT NULL constraints
are supported for a LOB column or attribute.
The exact check should be implemented differently to work with JSON in
LOB. I am working on it.
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:8>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34060#comment:9>