Repository navigation
fix(oracle): re-run LOB queries after a failed define without ORA-01002 - #18
Merged
Merged
Conversation
FabioHAraujo
force-pushed
the
fix/oracle-clob-reexecute
branch
from
October 23, 2026 03:47
80feb44 to
a072083
Compare
FabioHAraujo
force-pushed
the
fix/oracle-clob-reexecute
branch
2 times, most recently
from
October 23, 2026 03:50
d559662 to
b45611f
Compare
A query with LOB columns is executed, then sent again to define them. When either step failed, the statement went back to the driver's cache still marked as needing a define: its next execution only sent the define and fetched from a cursor that was never executed (ORA-01002), and so did every later run of the same SQL in the session. The vendored driver now closes that cursor so the next run parses the statement again, and Show DDL uses the statement cache again. Closes #17
FabioHAraujo
force-pushed
the
fix/oracle-clob-reexecute
branch
from
October 23, 2026 03:58
b45611f to
62525d3
Compare
… again When the server parses a query again (statistics feedback, new statistics), it describes the columns again on the next execution, LOB columns as CLOB/BLOB, while the cursor keeps its define and returns them as LONG with the rows. The vendored driver took that as a new LOB column and sent a define after the rows were fetched (ORA-01002). Like python-oracledb's _adjust_metadata, such a column now keeps its LONG type. Refs #17
FabioHAraujo
force-pushed
the
fix/oracle-clob-reexecute
branch
from
October 23, 2026 04:07
62525d3 to
17d1c66
Compare
FabioHAraujo
marked this pull request as ready for review
October 23, 2026 04:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17
The first time a query with LOB columns runs, it takes two round trips: an execute that returns the column descriptions, then a second execute that defines the LOB columns (as text here). Temporary protocol traces on 23ai and 21c in CI (not part of this PR) showed two ways the vendored driver later sent a define-only execute on a cursor that had nothing left to fetch, which the server answers with ORA-01002 (fetch out of sequence):
_adjust_metadata. On a cursor that already ran, a column described as CLOB/BLOB whose previous type was string/LONG (or RAW/LONG RAW) keeps the LONG type and needs no define.get_dependent_ddlon a table without comments, or any error raised while the first rows are fetched). The statement went back to the cache still flagged as needing a define, so every later run sent only the define and failed. Fix: close that cursor so the next run parses again, as python-oracledb does after errors.Both fixes are in
src-tauri/vendor/oracledband recorded as patches 3 and 4 inLOWQUERY.md.first_texts(Show DDL) no longer usesexclude_from_cache().New test
oracle_clob_queries_run_repeatedlycovers:dbms_metadata.get_ddl,to_clob(...), and a table with CLOBs over 4000 characters (all rows, and the first row only with the cursor left open), 5 runs each, withdbms_stats.gather_table_stats(no_invalidate => false)before run 3 to force the re-describe; a CLOB query that fails with ORA-01476 twice, then succeeds 3 times; and Show DDL 5 times through the statement cache. Before the fixes it failed on both 23ai and 21c (run 3 after the invalidation, and run 2 after the failed define).CHANGELOG entry under [Unreleased]; it ships in 0.5.2 together with export/import.