Repository navigation
Description
Bug Report
DBMS_UTILITY.FORMAT_ERROR_BACKTRACE and FORMAT_CALL_STACK produce incorrect frame names in two scenarios:
Bug 1 — Package members lose the package component
When a package procedure or function appears in the backtrace, its frame is rendered as "SCHEMA.ROUTINE" instead of the correct "SCHEMA.PACKAGE.ROUTINE". The package name is silently dropped, making the frame indistinguishable from a top-level routine of the same name.
Bug 2 — Schema-qualified standalone routines get a spurious PUBLIC. prefix
When a routine is invoked with an explicit schema (e.g. test_schema.schema_caller()), the backtrace prefixes the already-qualified name with PUBLIC., producing "PUBLIC.TEST_SCHEMA.SCHEMA_ERROR" instead of "TEST_SCHEMA.SCHEMA_ERROR".
IvorySQL Version
Latest master head
OS Version (uname -a)
Linux, Mac
Configuration options ( config.status --config )
Current Behavior
-- Bug 1:
ORA-06512: at "PUBLIC.PKG_ERROR", line 3
ORA-06512: at "PUBLIC.PKG_CALLER", line 8
-- Bug 2:
ORA-06512: at "PUBLIC.TEST_SCHEMA.SCHEMA_ERROR", line 2
ORA-06512: at "PUBLIC.TEST_SCHEMA.SCHEMA_CALLER", line 3
Expected behavior/code
-- Bug 1:
ORA-06512: at "PUBLIC.TEST_PKG.PKG_ERROR", line 3
ORA-06512: at "PUBLIC.TEST_PKG.PKG_CALLER", line 8
-- Bug 2:
ORA-06512: at "TEST_SCHEMA.SCHEMA_ERROR", line 2
ORA-06512: at "TEST_SCHEMA.SCHEMA_CALLER", line 3
Step to reproduce
-- FORMAT_CALL_STACK - Package procedure. The frame for a package
-- member must carry the exact owning-schema/package/routine triple. The
-- package lives in a dedicated non-public schema so the assertion can pin
-- the schema name; a wildcard-only prefix would let a wrong or missing
-- schema qualifier pass silently.
CREATE SCHEMA callstack_ns;
CREATE OR REPLACE PACKAGE callstack_ns.test_call_stack_pkg IS
PROCEDURE stack_caller;
END test_call_stack_pkg;
/
CREATE OR REPLACE PACKAGE BODY callstack_ns.test_call_stack_pkg IS
PROCEDURE stack_caller IS
v_stack VARCHAR2(4000);
BEGIN
v_stack := DBMS_UTILITY.FORMAT_CALL_STACK;
IF v_stack LIKE '%CALLSTACK_NS.TEST_CALL_STACK_PKG.STACK_CALLER%' THEN
RAISE INFO 'Call stack is package-qualified: OK';
ELSE
RAISE INFO 'Call stack is package-qualified: FAILED (got: %)', v_stack;
END IF;
END stack_caller;
END test_call_stack_pkg;
/
CALL callstack_ns.test_call_stack_pkg.stack_caller();
DROP PACKAGE callstack_ns.test_call_stack_pkg;
DROP SCHEMA callstack_ns;
-- FORMAT_ERROR_BACKTRACE - Schema-qualified routine must not acquire a
-- spurious PUBLIC prefix. Regression: before fix, schema_error() appeared as
-- PUBLIC.SCHEMA_ERROR instead of BUG_SCHEMA.SCHEMA_ERROR.
CREATE SCHEMA bug_schema;
CREATE OR REPLACE PROCEDURE bug_schema.schema_error IS
BEGIN
RAISE EXCEPTION 'boom';
END;
/
CREATE OR REPLACE PROCEDURE bug_schema.schema_caller IS
v_backtrace VARCHAR2(4000);
BEGIN
bug_schema.schema_error();
EXCEPTION
WHEN OTHERS THEN
v_backtrace := DBMS_UTILITY.FORMAT_ERROR_BACKTRACE;
IF v_backtrace LIKE '%BUG_SCHEMA.SCHEMA_ERROR%' THEN
RAISE INFO 'Backtrace has correct schema qualifier: OK';
ELSE
RAISE INFO 'Backtrace has correct schema qualifier: FAILED (got: %)', v_backtrace;
END IF;
END;
/
CALL bug_schema.schema_caller();
DROP SCHEMA bug_schema CASCADE;
Activity
hanjianqiao commentedon Jul 29, 2026
Thanks so much for your work! Could you please complete the
Step to reproduceforBug 2. And please tell us which Oracle version you're using and paste the origin output if possible.db-nikhil commentedon Jul 29, 2026
@hanjianqiao I have added the steps to reproduce bug 2 above. Also, this is more of bug fixing and enhancement in our current DBMS_UTIL implementation in IvorySQL rather than any specific Oracle version equivalent.
hanjianqiao commentedon Jul 29, 2026
Thanks!