Opened 9 months ago

Closed 9 months ago

#35225 closed Cleanup/optimization (needsinfo)

Tests of ordering by JSON field fail in Oracle 21c

Reported by: raydeal Owned by: nobody
Component: Database layer (models, ORM) Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There are 2 tests that fail in Oracle 21c.

ERROR [0.011s]: test_order_by_key (db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_key)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests/django/tests/db_functions/comparison/test_json_object.py", line 100, in test_order_by_key
    self.assertQuerySetEqual(qs, Author.objects.order_by("alias"))
  File "/tests/django/django/test/testcases.py", line 1228, in assertQuerySetEqual
    return self.assertEqual(list(items), values, msg=msg)
                            ^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 400, in __iter__
    self._fetch_all()
  File "/tests/django/django/db/models/query.py", line 1928, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 123, in __iter__
    for row in compiler.results_iter(results):
  File "/tests/django/django/db/models/sql/compiler.py", line 1508, in apply_converters
    value = converter(value, expression, connection)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/backends/oracle/operations.py", line 246, in convert_textfield_value
    value = value.read()
            ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/oracledb/lob.py", line 130, in read
    return self._impl.read(offset, amount)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/oracledb/impl/thin/lob.pyx", line 254, in oracledb.thin_impl.ThinLobImpl.read
  File "src/oracledb/impl/thin/lob.pyx", line 197, in oracledb.thin_impl.ThinLobImpl._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 425, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 426, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 419, in oracledb.thin_impl.Protocol._process_message
oracledb.exceptions.DatabaseError: ORA-24826: value LOB no longer available
Help: https://docs.oracle.com/error-help/db/ora-24826/
ERROR [0.010s]: test_order_by_nested_key (db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_nested_key)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests/django/tests/db_functions/comparison/test_json_object.py", line 106, in test_order_by_nested_key
    self.assertQuerySetEqual(qs, Author.objects.order_by("-alias"))
  File "/tests/django/django/test/testcases.py", line 1228, in assertQuerySetEqual
    return self.assertEqual(list(items), values, msg=msg)
                            ^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 400, in __iter__
    self._fetch_all()
  File "/tests/django/django/db/models/query.py", line 1928, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 123, in __iter__
    for row in compiler.results_iter(results):
  File "/tests/django/django/db/models/sql/compiler.py", line 1508, in apply_converters
    value = converter(value, expression, connection)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/backends/oracle/operations.py", line 246, in convert_textfield_value
    value = value.read()
            ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/oracledb/lob.py", line 130, in read
    return self._impl.read(offset, amount)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/oracledb/impl/thin/lob.pyx", line 254, in oracledb.thin_impl.ThinLobImpl.read
  File "src/oracledb/impl/thin/lob.pyx", line 197, in oracledb.thin_impl.ThinLobImpl._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 425, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 426, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 419, in oracledb.thin_impl.Protocol._process_message
oracledb.exceptions.DatabaseError: ORA-24826: value LOB no longer available
Help: https://docs.oracle.com/error-help/db/ora-24826/

Change History (2)

comment:1 by Mariusz Felisiak, 9 months ago

Interesting they pass on Oracle 23c.

comment:2 by Mariusz Felisiak, 9 months ago

Resolution: needsinfo
Status: newclosed

I don't think you've explained the issue in enough detail to confirm a bug in Django. This looks like an issue in python-oracledb, some related library, your local installation, or a bug in Oracle 21c itself. As far as I'm aware, Django doesn't do anything specific to free LOBs. Please reopen the ticket if you can debug your issue and provide details about why and where Django is at fault.

Note: See TracTickets for help on using tickets.
Back to Top