Describe the bug
When running utPLSQL on a PDB and user running the tests has access to DBA_SOURCE and the scope of coverage is set to include SYS or MDSYS schema, the test runs will fail because package bodies exist in both CDB and PDB and DBA_SOURCE shows one version for ORIGIN_CON_ID = 0 while another version for ORIGIN_CON_ID = SYS_CONTYEXT('USERENV','CON_ID')
So a duplicate source line is found and coverage reporting will fail with:
[debug] Java API Version = 3.2.3
[info] Enabled dbms_output.
[info] utPLSQL Version = v3.2.01.4373
[info] Invoking TestRunner with: /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/src/test/target
[info] Writing report UT_DOCUMENTATION_REPORTER to Console
plsql
examples
TEST_PKG_TEST_ME
Checking if function ('1') returns 1 [.005 sec]
Checking if function ('0') returns 0 [.002 sec]
Checking if function (NULL) returns NULL [.002 sec]
Checking if procedure (NULL) insert [.004 sec]
Checking if procedure (NOT NULL) insert [.006 sec]
Checking if procedure (NOT NULL) insert while existing [.002 sec]
Demonstrating the use of cursor [.015 sec]
Warnings:
1) plsql.examples.test_pkg_test_me
Unable to perform automatic rollback after test suite. An implicit or explicit commit/rollback occurred in procedures:
app.test_pkg_test_me.test_pr_test_me_not_null
app.test_pkg_test_me.test_pr_test_me_exists
app.test_pkg_test_me.test_pr_test_me_cursor
Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.
at org.utplsql.api.testRunner.DynamicTestRunnerStatement.execute(DynamicTestRunnerStatement.java:90)
at org.utplsql.api.TestRunner.run(TestRunner.java:245)
at org.utplsql.maven.plugin.UtPlsqlMojo.execute(UtPlsqlMojo.java:210)
... 3 more
Caused by: Error : 1, Position : 0, SQL = BEGIN ut_runner.run(a_paths => :1 , a_reporters => :2 , a_color_console => (case :3 when 1 then true else false end), a_fail_on_errors => (case :4 when 1 then true else false end), a_client_character_set => :5 , a_random_test_order => (case :6 when 1 then true else false end), a_include_schema_expr => :7 );END;, Original SQL = BEGIN ut_runner.run(a_paths => ?, a_reporters => ?, a_color_console => (case ? when 1 then true else false end), a_fail_on_errors => (case ? when 1 then true else false end), a_client_character_set => ?, a_random_test_order => (case ? when 1 then true else false end), a_include_schema_expr => ?);END;, Error Message = ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated
ORA-06512: at "UT3.UT_RUNNER", line 151
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 212
ORA-06512: at "UT3.UT_COVERAGE", line 271
ORA-06512: at "UT3.UT_COVERAGE_SONAR_REPORTER", line 95
ORA-06512: at "UT3.UT_REPORTER_BASE", line 195
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 66
ORA-06512: at "UT3.UT_SUITE_ITEM", line 50
ORA-06512: at "UT3.UT_RUNNER", line 144
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:723)
... 20 more
[INFO]
[INFO] Results:
[INFO]
Error: Errors:
Error: UtPlsqlMojoTest.include_object_expr:371 » MojoExecution ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated
ORA-06512: at "UT3.UT_RUNNER", line 151
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 212
ORA-06512: at "UT3.UT_COVERAGE", line 271
ORA-06512: at "UT3.UT_COVERAGE_SONAR_REPORTER", line 95
ORA-06512: at "UT3.UT_REPORTER_BASE", line 195
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 66
ORA-06512: at "UT3.UT_SUITE_ITEM", line 50
ORA-06512: at "UT3.UT_RUNNER", line 144
ORA-06512: at line 1
https://docs.oracle.com/error-help/db/ora-00001/
Error: UtPlsqlMojoTest.include_schema_expr:406 » MojoExecution ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated
ORA-06512: at "UT3.UT_RUNNER", line 151
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 212
ORA-06512: at "UT3.UT_COVERAGE", line 271
ORA-06512: at "UT3.UT_COVERAGE_SONAR_REPORTER", line 95
ORA-06512: at "UT3.UT_REPORTER_BASE", line 195
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 66
ORA-06512: at "UT3.UT_SUITE_ITEM", line 50
ORA-06512: at "UT3.UT_RUNNER", line 144
ORA-06512: at line 1
https://docs.oracle.com/error-help/db/ora-00001/
[INFO]
Error: Tests run: 31, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping utPLSQL Maven Plugin
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.517 s
[INFO] Finished at: 2026-04-23T15:50:37Z
[INFO] ------------------------------------------------------------------------
Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.5:test (default-test) on project utplsql-maven-plugin:
Error:
Error: See /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/target/surefire-reports for the individual test results.
Error: See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
Error: -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Error: Process completed with exit code 1.
You can see this in test runs here:
https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/runs/24844825275/job/72729154909
Provide version info
Information about utPLSQL and Database version,
[debug] Java API Version = 3.2.3
[info] Enabled dbms_output.
[info] utPLSQL Version = v3.2.01.4373
DB: Oracle 21 Free
Image: gvenzl/oracle-xe:21-slim
Information about client software
Azure Pipeline
To Reproduce
Run mvn clean verify for the utplsql maven plugin project.
Expected behavior
utPLSQL should not read DBA_SOURCE without filtering CON_ID.
A filter AND ORIGIN_CON_ID = SYS_CONTEXT('USERENV', 'CON_ID') should be added to queries on DBA_SOURCE
Example code
create user APP identified by pass quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view to APP;
grant select any dictionary to APP;
-- auto-generated definition
create table TO_TEST_ME
(
SNAME VARCHAR2(10)
)
/
create PACKAGE PKG_TEST_ME AS
FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER;
PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2);
END PKG_TEST_ME;
/
create PACKAGE BODY PKG_TEST_ME IS
--
-- This
--
FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER IS
BEGIN
IF PPARAM1 IS NULL THEN
RETURN NULL;
ELSIF PPARAM1 = '1' THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END FC_TEST_ME;
PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2) IS
BEGIN
IF PSNAME IS NULL THEN
NULL;
ELSE
INSERT INTO TO_TEST_ME (SNAME) VALUES (PSNAME);
COMMIT;
END IF;
END PR_TEST_ME;
END PKG_TEST_ME;
/
connect APP/pass;
begin
ut.run('APP', a_reporter=> UT_COVERALLS_REPORTER(), a_include_schema_expr =>'*');
end;
/
Results in error:
ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated on table UT3.UT_COVERAGE_SOURCES_TMP columns (OWNER, NAME, TYPE, LINE)
ORA-06512: at "UT3.UT_RUNNER", line 151
ORA-03301: (ORA-00001 details) row with column values (OWNER:'MDSYS', NAME:'SDO_OLS_DIRECTORY', TYPE:'PACKAGE BODY', LINE:1) already exists
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 212
ORA-06512: at "UT3.UT_COVERAGE", line 271
ORA-06512: at "UT3.UT_COVERALLS_REPORTER", line 89
ORA-06512: at "UT3.UT_REPORTER_BASE", line 195
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 66
ORA-06512: at "UT3.UT_SUITE_ITEM", line 50
ORA-06512: at "UT3.UT_RUNNER", line 144
ORA-06512: at "UT3.UT", line 143
ORA-06512: at "UT3.UT", line 577
ORA-06512: at "UT3.UT", line 744
ORA-06512: at line 2
Describe the bug
When running utPLSQL on a PDB and user running the tests has access to DBA_SOURCE and the scope of coverage is set to include SYS or MDSYS schema, the test runs will fail because package bodies exist in both CDB and PDB and DBA_SOURCE shows one version for ORIGIN_CON_ID = 0 while another version for ORIGIN_CON_ID = SYS_CONTYEXT('USERENV','CON_ID')
So a duplicate source line is found and coverage reporting will fail with:
You can see this in test runs here:
https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/runs/24844825275/job/72729154909
Provide version info
Information about utPLSQL and Database version,
[debug] Java API Version = 3.2.3
[info] Enabled dbms_output.
[info] utPLSQL Version = v3.2.01.4373
DB: Oracle 21 Free
Image: gvenzl/oracle-xe:21-slim
Information about client software
Azure Pipeline
To Reproduce
Run mvn clean verify for the utplsql maven plugin project.
Expected behavior
utPLSQL should not read DBA_SOURCE without filtering CON_ID.
A filter
AND ORIGIN_CON_ID = SYS_CONTEXT('USERENV', 'CON_ID')should be added to queries on DBA_SOURCEExample code
Results in error: