You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Call params for test are not valid" for all tests in specific schema #885
Describe the bug
The error message happens for all tests in a specific schema
Provide version info
utPLSQL v3.1.6.2735, Database version 18.5.0.0.0
port_string: x86_64/Linux 2.4.xx
Information about client software
SQL Developer
CLI
To Reproduce
Steps to reproduce the behavior:
Create betwnstr/test_betweenstr packages from demo project
EXECUTE ut.run('SCHEMA.test_betwnstr');
See error
Between string function
Returns substring from start position to end position [,003 sec] (FAILED - 1)
Returns substring when start position is zero [,002 sec] (FAILED - 2)
Returns string until end if end position is greater than string length [,002 sec] (FAILED - 3)
Returns null for null input string value [,002 sec] (FAILED - 4)
A demo of test raising runtime exception [,002 sec] (FAILED - 5)
A demo of failing test [,002 sec] (FAILED - 6)
Demo of a disabled test [0 sec] (DISABLED)
Failures:
normal_case
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
zero_start_position
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
big_end_position
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
null_string
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
bad_params
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
bad_test
Call params for test are not valid: package does not exist or is invalid: SCHEMA.TEST_BETWNSTR
Finished in ,014138 seconds
7 tests, 0 failed, 6 errored, 1 disabled, 0 warning(s)
Expected behavior
Should be successfully run as in another schema in the same database.
Example code
betwnstr/test_betweenstr packages from demo project
Additional context
Maybe this is grant / object related (eg. duplicate system views in the schema or similar)
Hi @tkleiber
Who is the owner of the tests packages and who is executing the tests ?
Does the schema executing tests have execute on the tests packages ?
You mentioned duplicate system views in schema. Is this something that you have?
utPLSQL is based on access to some system views so if you have duplicated system views in SCHEMA that could be the problem.
Another possibility is that there are some changes in 18.5 to how dbms_sql / dynamic sql works.
Can you reproduce the same problem in any schema or is it only this one schema that is causing issues?
System views was only an idea, but I could not found any dba-, user- or all-views in the meantime. As already mentioned in another schema all runs fine.
Should I run them same selects and debug statement as in the last issue?
Hi @tkleiber
Is this still an issue for you?
Unfortunately I can't reproduce this issue on the DB versions I have at hand.
I'll add some extra debug info into 3.1.7-develop to help investigate the problem.
Two questions:
is this an issue related to 3.1.6 - do you have same issue with older versions of utPLSQL?
is this an issue related to DB version - do you see same issue on older versions of DB?
If you can help us narrow-down the problem - that will help a lot.
is this an issue related to 3.1.6 - do you have same issue with older versions of utPLSQL?
I have seen this before on 3.1.3, so therefore I have updated to 3.1.6 before I opened this issue to create it for the actual version.
is this an issue related to DB version - do you see same issue on older versions of DB?
This issue is not reproducable on 11.2.0.4 EE, we are on the way to migrate to 18.5.0.0 EE and running successfully the utPLSQL tests is the first step to verify this migration.
test package is not visible to user
The user ownes the package and so it is visible.
test package is not in valid state (spec)
Test package and body TEST_BETWNSTR and the function BETWNSTR are valid and owned by the calling user.
we have an issue inside utPLSQL with package state validation.
Seems that this remains!?
As already mentioned: If I call the same test from another user, to which is granted execute grants to the owner package and function, all run as expected.
Since I cannot reproduce it on any of DB's we have:
-11g, 12.1, 12.2, 18, 19, can you please check which part of the validation fails for you?
This could indicate an Oracle DB issue - maybe a bug in 18.5 version you have installed:
declare
function is_object_visible(a_object_name varchar2) return boolean is
l_invalid_object_name exception;
pragma exception_init(l_invalid_object_name,-44002);
begin
return dbms_assert.sql_object_name(a_object_name) is not null;
exception
when l_invalid_object_name then
return false;
end;
function get_dba_view(a_dba_view_name varchar2) return varchar2 is
l_result varchar2(128) :=lower(a_dba_view_name);
begin
if not is_object_visible(a_dba_view_name) then
l_result := replace(l_result,'dba_','all_');
end if;
return l_result;
end;
function get_objects_view_name return varchar2 is
begin
return get_dba_view('dba_objects');
end;
function form_name(a_owner_name varchar2, a_object varchar2, a_subprogram varchar2 default null) return varchar2 is
l_name varchar2(200);
begin
l_name :=trim(a_object);
if trim(a_owner_name) is not null then
l_name :=trim(a_owner_name) ||'.'|| l_name;
end if;
if trim(a_subprogram) is not null then
l_name := l_name ||'.'||trim(a_subprogram);
end if;
return l_name;
end form_name;
procedure do_resolve(a_fully_qualified_name invarchar2,a_context ininteger,a_owner out nocopy varchar2, a_object out nocopy varchar2,
a_procedure_name out nocopy varchar2) is
l_dblink varchar2(200);
l_part1_type number;
l_object_number number;
begindbms_utility.name_resolve(name => a_fully_qualified_name
,context => a_context
,schema => a_owner
,part1 => a_object
,part2 => a_procedure_name
,dblink => l_dblink
,part1_type => l_part1_type
,object_number => l_object_number);
end;
procedure do_resolve(a_owner in out nocopy varchar2, a_object in out nocopy varchar2, a_procedure_name in out nocopy varchar2) is
l_name varchar2(200);
l_context integer :=1; --plsqlbegin
l_name := form_name(a_owner, a_object, a_procedure_name);
do_resolve(l_name,l_context,a_owner,a_object, a_procedure_name);
end do_resolve;
function package_valid(a_owner_name varchar2, a_package_name invarchar2) return booleanas
l_cnt number;
l_schema varchar2(200);
l_package_name varchar2(200);
l_procedure_name varchar2(200);
l_view_name varchar2(200) := get_objects_view_name;
begin
l_schema := a_owner_name;
l_package_name := a_package_name;
do_resolve(l_schema, l_package_name, l_procedure_name);
execute immediate q'[select count(decode(status, 'VALID', 1, null)) / count(*) from ]'||l_view_name||q'[ where owner = :l_schema and object_name = :l_package_name and object_type in ('PACKAGE')]'
into l_cnt using l_schema, l_package_name;
-- expect both package and body to be valid
return l_cnt =1;
exception
when others then
dbms_output.put_line(dbms_utility.format_error_stack()||dbms_utility.format_error_backtrace());
return false;
end;
begin
if package_valid('SCHEMA','TEST_BETWNSTR') then
dbms_output.put_line('PACAKGE VALID');
else
dbms_output.put_line('!!!pacakge not vaild');
end if;
end;
/
If you manage to find which part of validation is failing, we can re-visit it and adjust.
There seems to be a bit too much going on for pre-test-run validation anyways.
ORA-04047: object specified is incompatible with the flag specified
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at line 46
ORA-06512: at line 61
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at line 46
ORA-06512: at line 61
ORA-06512: at line 75
Can you add some dbms output so we can see variables values ? Replace a do_resolve with something like these
procedure do_resolve(a_owner in out nocopy varchar2, a_object in out nocopy varchar2, a_procedure_name in out nocopy varchar2) is
l_name varchar2(200);
l_context integer := 1; --plsql
begin
l_name := form_name(a_owner, a_object, a_procedure_name);
dbms_output.put_line('Full name: '||l_name);
dbms_output.put_line('a_owner name: '||a_owner);
dbms_output.put_line('a_object name: '||a_object);
dbms_output.put_line('a_procedure_name: '||a_procedure_name);
do_resolve(l_name,l_context,a_owner,a_object, a_procedure_name);
end do_resolve;
Activity
lwasylow commentedon Mar 29, 2019
Hi @tkleiber
Who is the owner of the tests packages and who is executing the tests ?
Does the schema executing tests have execute on the tests packages ?
tkleiber commentedon Mar 29, 2019
The owner is executing the tests, therefore I don't understand why this error occurs.
jgebal commentedon Mar 29, 2019
Is the failure message containing exactly:
SCHEMA.TEST_BETWNSTRor did you modify it?tkleiber commentedon Mar 29, 2019
Have renamed only the schema to hide company informations.
jgebal commentedon Mar 29, 2019
You mentioned duplicate system views in schema. Is this something that you have?
utPLSQL is based on access to some system views so if you have duplicated system views in SCHEMA that could be the problem.
Another possibility is that there are some changes in 18.5 to how dbms_sql / dynamic sql works.
Can you reproduce the same problem in any schema or is it only this one schema that is causing issues?
tkleiber commentedon Mar 30, 2019
System views was only an idea, but I could not found any dba-, user- or all-views in the meantime. As already mentioned in another schema all runs fine.
Should I run them same selects and debug statement as in the last issue?
jgebal commentedon Mar 30, 2019
That would be helpful.
I will not be able to work on urPLSQL within next two weeks however.
tkleiber commentedon Apr 1, 2019
annotation cache:
annotation_cache.zip
suite cache:
ut_suite_cache.zip
debug log:
ut_debug_reporter.zip
jgebal commentedon Apr 18, 2019
Hi @tkleiber
Is this still an issue for you?
Unfortunately I can't reproduce this issue on the DB versions I have at hand.
I'll add some extra debug info into 3.1.7-develop to help investigate the problem.
Two questions:
If you can help us narrow-down the problem - that will help a lot.
jgebal commentedon Apr 18, 2019
Also, is the package
TEST_BETWNSTRactually valid?The reason to get this exception is when:
So there are only three possibilities:
tkleiber commentedon Apr 23, 2019
I have seen this before on 3.1.3, so therefore I have updated to 3.1.6 before I opened this issue to create it for the actual version.
This issue is not reproducable on 11.2.0.4 EE, we are on the way to migrate to 18.5.0.0 EE and running successfully the utPLSQL tests is the first step to verify this migration.
The user ownes the package and so it is visible.
Test package and body TEST_BETWNSTR and the function BETWNSTR are valid and owned by the calling user.
Seems that this remains!?
As already mentioned: If I call the same test from another user, to which is granted execute grants to the owner package and function, all run as expected.
jgebal commentedon Apr 28, 2019
Since I cannot reproduce it on any of DB's we have:
-11g, 12.1, 12.2, 18, 19, can you please check which part of the validation fails for you?
This could indicate an Oracle DB issue - maybe a bug in 18.5 version you have installed:
If you manage to find which part of validation is failing, we can re-visit it and adjust.
There seems to be a bit too much going on for pre-test-run validation anyways.
tkleiber commentedon Apr 29, 2019
Here is the output of this code:
ORA-04047: object specified is incompatible with the flag specified
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at line 46
ORA-06512: at line 61
ORA-06512: at "SYS.DBMS_UTILITY", line 156
ORA-06512: at line 46
ORA-06512: at line 61
ORA-06512: at line 75
!!!pacakge not vaild
lwasylow commentedon Apr 29, 2019
Can you add some dbms output so we can see variables values ? Replace a do_resolve with something like these
tkleiber commentedon Apr 29, 2019
The problem can be stripped down to:
I will try to open a SR at Oracle tomorrow.
jgebal commentedon Apr 29, 2019
We will change our code not to rely on this feature. We cpuld probably get away with using dbms_assert
jgebal commentedon Apr 30, 2019
@tkleiber - do you happen to have any object that is named the same as schema name in your schema?
If so - this is the reason for the problem.
For example:
tkleiber commentedon Apr 30, 2019
Yes - there was a table with same name as the schema.
Now the tests work fine!
Is this a known Oracle bug?
jgebal commentedon Apr 30, 2019
I think it is.
PhilippSalvisberg commentedon Apr 30, 2019
No, I do not think it is a bug. It's just the result of the Resolution of Names in Static SQL Statements.
Removed dependency on `dbms_utility.name_resolve`.
Release/v3.1.7 (#942)