Repository navigation
dbms_utility: fix backtrace/call-stack qualification for package members - #1471
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPL/iSQL now resolves package ownership when formatting error contexts and call stacks. DBMS_UTILITY avoids adding ChangesPackage-qualified diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant test_call_stack_pkg
participant DBMS_UTILITY
participant plisql_get_call_stack
participant pg_package
test_call_stack_pkg->>DBMS_UTILITY: FORMAT_CALL_STACK
DBMS_UTILITY->>plisql_get_call_stack: format PL/iSQL frames
plisql_get_call_stack->>pg_package: resolve package metadata
pg_package-->>plisql_get_call_stack: schema and package names
plisql_get_call_stack-->>DBMS_UTILITY: qualified stack frames
DBMS_UTILITY-->>test_call_stack_pkg: formatted call stack
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contrib/ivorysql_ora/sql/dbms_utility.sql`:
- Around line 442-468: Update the Test 18 package-stack test around
test_call_stack_pkg to create and invoke the package under a dedicated
non-public schema, then require the exact schema-qualified prefix in the
FORMAT_CALL_STACK result instead of accepting any prefix. Adjust setup,
invocation, cleanup, and expected output to match the dedicated schema while
preserving the package qualification assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f6246d3-3669-476f-a77e-784634252007
📒 Files selected for processing (4)
contrib/ivorysql_ora/expected/dbms_utility.outcontrib/ivorysql_ora/sql/dbms_utility.sqlcontrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.csrc/pl/plisql/src/pl_exec.c
060bcf9 to
687d722
Compare
|
Thanks so much for the contribution! Could you add some more details in #1472. |
687d722 to
d5c3b8f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contrib/ivorysql_ora/sql/dbms_utility.sql`:
- Line 460: Strengthen the wildcard assertions in the relevant stack-validation
tests: update the Test 19 check around the
CALLSTACK_NS.TEST_CALL_STACK_PKG.STACK_CALLER frame to assert the complete
ORA-06512 frame, and update Test 18 around the BUG_SCHEMA.SCHEMA_ERROR check to
explicitly reject the PUBLIC.CALLSTACK_NS... prefixed form. Preserve the
existing valid-frame assertions while ensuring residual leading PUBLIC.
qualifiers fail.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 69f47c93-3afe-4ad3-9c56-51a2b0c7e668
📒 Files selected for processing (6)
contrib/ivorysql_ora/expected/dbms_utility.outcontrib/ivorysql_ora/expected/utl_encode.outcontrib/ivorysql_ora/expected/utl_file.outcontrib/ivorysql_ora/sql/dbms_utility.sqlcontrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.csrc/pl/plisql/src/pl_exec.c
🚧 Files skipped from review as they are similar to previous changes (2)
- contrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.c
- src/pl/plisql/src/pl_exec.c
676690f to
2773838
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pl/plisql/src/pl_exec.c`:
- Around line 10222-10227: Update the current line selection in the call-stack
formatting path to match plisql_exec_error_callback(): check estate->err_var
before estate->err_stmt, preserving the existing fallback behavior when either
field is unavailable.
- Around line 1450-1460: Update plisql_exec_error_callback() and
plisql_get_call_stack() in src/pl/plisql/src/pl_exec.c at lines 1486-1488 and
10235-10237 to store plisql_package_qualified_signature() results in temporary
variables, then pfree() them after errcontext() formatting and
appendStringInfo() insertion. In plisql_package_qualified_signature() at lines
1450-1460, ensure the intermediate nspname and pkgqual allocations are freed
before returning the final signature while preserving the existing returned
string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 354c8449-b2d2-4691-bfe4-b1f85b9e5637
📒 Files selected for processing (6)
contrib/ivorysql_ora/expected/dbms_utility.outcontrib/ivorysql_ora/expected/utl_encode.outcontrib/ivorysql_ora/expected/utl_file.outcontrib/ivorysql_ora/sql/dbms_utility.sqlcontrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.csrc/pl/plisql/src/pl_exec.c
🚧 Files skipped from review as they are similar to previous changes (5)
- contrib/ivorysql_ora/expected/utl_file.out
- contrib/ivorysql_ora/expected/utl_encode.out
- contrib/ivorysql_ora/sql/dbms_utility.sql
- contrib/ivorysql_ora/src/builtin_packages/dbms_utility/dbms_utility.c
- contrib/ivorysql_ora/expected/dbms_utility.out
da52181 to
9298c08
Compare
9298c08 to
1ef6f2b
Compare
|
@db-nikhil I found an obvious mistake: INTERCHANGE mode doesn't actually mean uppercase — see the docs for details: https://docs.ivorysql.org/en/ivorysql-doc/master/oracle_compatibility/compat_case_conversion Either way works for me — would you prefer to fix this within this PR, or track it in a follow-up PR? Thanks! |
1ef6f2b to
f4703af
Compare
@hanjianqiao thanks for the pointer to the documentation! I have updated this PR based on it. |
FORMAT_ERROR_BACKTRACE unconditionally prepended a hardcoded "PUBLIC." prefix to every frame name, including package member frames whose context line already carries the full schema.package.routine path produced by plisql_package_qualified_signature(). Two bugs resulted: Package members lost the package component: "PUBLIC.PKG_ERROR" instead of "PUBLIC.TEST_PKG.PKG_ERROR". Schema-qualified standalone routines got an extra prefix: "PUBLIC. TEST_SCHEMA.SCHEMA_ERROR" instead of "TEST_SCHEMA.SCHEMA_ERROR". Add test 18 to dbms_utility.sql to cover FORMAT_CALL_STACK from inside a package procedure and assert the frame is schema/package-qualified.
f4703af to
a0b521e
Compare
|
is there anything else pending here from my side? |
|
@db-nikhil Thanks again for the contribution, and sorry for the slow turnaround! This looks good to me. It still needs to clear our internal review process, though, and we've had a high volume of PRs come in recently, so things are moving slower than usual — I'd expect to have an update for you within the next week. |
…_fix dbms_utility: fix backtrace/call-stack qualification for package members (cherry picked from commit b7d9f4e)
…_fix dbms_utility: fix backtrace/call-stack qualification for package members (cherry picked from commit b7d9f4e)
Fixes #1472
FORMAT_ERROR_BACKTRACE unconditionally prepended a hardcoded "PUBLIC." prefix to every frame name, including package member frames whose context line already carries the full schema.package.routine path produced by plisql_package_qualified_signature(). Two bugs resulted:
Package members lost the package component: "PUBLIC.PKG_ERROR" instead of "PUBLIC.TEST_PKG.PKG_ERROR". Schema-qualified standalone routines got an extra prefix: "PUBLIC. TEST_SCHEMA.SCHEMA_ERROR" instead of "TEST_SCHEMA.SCHEMA_ERROR".
Add test 18 to dbms_utility.sql to cover FORMAT_CALL_STACK from inside a package procedure and assert the frame is schema/package-qualified.
Summary by CodeRabbit
Summary
Bug Fixes
DBMS_UTILITYformatting forFORMAT_ERROR_BACKTRACEandFORMAT_CALL_STACKso schema/package-qualified routine names render correctly, and eliminates unintendedPUBLIC.prefixes in frames/lines.Tests
FORMAT_CALL_STACKusing a package procedure.FORMAT_ERROR_BACKTRACEusing schema-qualified routines.utl_encodeandutl_filecontext lines to reflect fully qualified routine names.