Commit 3b17f1a
POC: resolve describe() via DBMS_UTILITY.NAME_RESOLVE
Per the suggestion in
rsim#2521 (comment),
replace the UNION ALL query against all_tables / all_views / all_synonyms
with a single DBMS_UTILITY.NAME_RESOLVE call. The package resolves private
and public synonyms internally, so the manual synonym recursion is removed.
DBMS_UTILITY.NAME_RESOLVE is documented for Oracle 8i (released 1999),
so version support is not a concern for any software being written in
2026. See the Oracle8i Supplied PL/SQL Packages Reference, Release 2
(8.1.6), A76936-01:
https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a76936/dbms_uti.htm
OUT-bind plumbing is added on both the OCI8 path (anonymous PL/SQL block
with named binds) and the JDBC path (CallableStatement + registerOutParameter)
so the POC can be exercised on both MRI and JRuby.
Two subtleties the spec suite surfaced:
1. NAME_RESOLVE's context parameter matters. context=1 is PL/SQL objects
only and raises ORA-04047 for tables / views; context=0 covers
tables, views, and synonyms (verified empirically against Oracle 23ai).
2. NAME_RESOLVE uppercases unquoted input, so case-preserving (quoted)
identifiers like "test_Mixed_Comments" failed with ORA-06564. Each
dotted part of the name is wrapped in double quotes when the
original identifier was not upcase-normalized by valid_table_name?.
With those in place the full rspec suite is green on CRuby 4.0.2 and
JRuby 10.0.5.0 (423 examples, 0 failures, 6 pending on both).
The regression test and PUBLIC SYNONYM grants from PR rsim#2521 are included
as the acceptance bar.
Open questions this POC exists to answer:
- Readability: anonymous PL/SQL block vs. SQL against all_* dictionaries.
- Consistency: the rest of the adapter reads from all_* dictionaries;
a PL/SQL call is a style break.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f5c0ba5 commit 3b17f1a
5 files changed
Lines changed: 77 additions & 40 deletions
File tree
- lib/active_record/connection_adapters/oracle_enhanced
- spec
- active_record/connection_adapters/oracle_enhanced
- support
Lines changed: 14 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 30 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 31 | + | |
| 32 | + | |
64 | 33 | | |
65 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
66 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
67 | 43 | | |
68 | 44 | | |
69 | 45 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
325 | 342 | | |
326 | 343 | | |
327 | 344 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
104 | 129 | | |
105 | 130 | | |
106 | 131 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
602 | 619 | | |
603 | 620 | | |
604 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
0 commit comments