Use type_owner for cross-schema type lookups#254
Open
yahonda wants to merge 3 commits intorsim:masterfrom
Open
Use type_owner for cross-schema type lookups#254yahonda wants to merge 3 commits intorsim:masterfrom
yahonda wants to merge 3 commits intorsim:masterfrom
Conversation
The get_field_definitions and get_element_definition methods used @schema_name when querying type metadata from ALL_PLSQL_TYPE_ATTRS, ALL_TAB_COLS, ALL_PLSQL_COLL_TYPES, and ALL_COLL_TYPES. This fails when a procedure parameter references a type owned by a different schema. Use argument_metadata[:type_owner] instead. Based on rsim#208 Co-Authored-By: Jochen Schug <4573581+joschug@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Grant create type, create procedure, and unlimited tablespace to the arunit user. Connect as arunit to create the type and grant execute, avoiding ORA-01749 (cannot grant to yourself). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes cross-schema PL/SQL type resolution by using the actual type owner from argument metadata when looking up composite type details, ensuring procedure/function parameters can reference types owned by other schemas.
Changes:
- Update composite type metadata queries to use
argument_metadata[:type_owner]instead of@schema_namefor type lookups. - Expand the secondary test user (arunit) privileges to support creating types/procedures needed by specs.
- Add an RSpec case that creates a type in a second schema, grants access, and validates cross-schema function discovery/execution.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| spec/support/create_arunit_user.sql | Grants additional privileges to the secondary schema user so cross-schema type tests can create required objects. |
| spec/plsql/procedure_spec.rb | Adds an integration spec covering cross-schema object type parameters and execution. |
| lib/plsql/procedure.rb | Fixes cross-schema composite type lookups by querying dictionary views using type_owner from all_arguments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
get_field_definitionsandget_element_definitionused@schema_namewhen querying type metadata, which fails when a procedure parameter references a type owned by a different schemaargument_metadata[:type_owner]instead, which contains the actual type ownerBased on #208
Test plan
testworkflow passes (Oracle 23c Free)test_11gworkflow passes (Oracle 11g XE)Co-Authored-By: Jochen Schug 4573581+joschug@users.noreply.github.com
Generated with Claude Code