-
Notifications
You must be signed in to change notification settings - Fork 17
SQL Dev extension: No filter on owner of a synonym #66
Copy link
Copy link
Open
Labels
Description
Case 1: for objects of type synonym, the following disjunction voids the filter on owner :
where (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
The effect can be demonstrated easily by creating a synonym with the same name in two distinct schemas:
alter session set plscope_settings = "IDENTIFIERS:ALL, STATEMENTS:ALL";
alter session set current_schema = SCOTT";
create or replace synonym s_emp for emp;
alter session set current_schema = "SCOTT2";
create or replace synonym s_emp for emp;
Then, after navigating to the PL/Scope -> Synonyms -> S_EMP node of either schema. both synonyms will be shown at once, e.g. in the "Identifiers" tab, if using a privileged account (e.g. if SELECT_CATALOG_ROLE is enabled in the session).
Affected tabs:
- Identifiers
- Uses
- Used By
$ git checkout v1.0.0
$ git grep -in 'object_owner or'
sqldev/src/main/resources/com/salvis/plscope/sqldev/editor/plscope-utils-viewers.xml:51: where (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
sqldev/src/main/resources/com/salvis/plscope/sqldev/editor/plscope-utils-viewers.xml:72: where (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
sqldev/src/main/resources/com/salvis/plscope/sqldev/editor/plscope-utils-viewers.xml:584: where (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
sqldev/src/main/resources/com/salvis/plscope/sqldev/editor/plscope-utils-viewers.xml:1173: and (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
sqldev/src/main/resources/com/salvis/plscope/sqldev/editor/plscope-utils-viewers.xml:1285: and (owner = :OBJECT_OWNER or upper(replace(:OBJECT_TYPE, 'plscope-utils-')) = 'SYNONYM')
Case 2: omitted filters
For consistency reasons, in the sql_ids CTE of the "Table Usages" tab, the following:
from sys.all_statements -- NOSONAR: avoid public synonym
where owner like nvl(:OBJECT_OWNER, user)
should read as:
from sys.all_statements -- NOSONAR: avoid public synonym
where owner like nvl(:OBJECT_OWNER, user)
and object_type in (
upper(replace(:OBJECT_TYPE, 'plscope-utils-')), upper(replace(:OBJECT_TYPE, 'plscope-utils-')) || ' BODY'
)
and object_name = :OBJECT_NAME
I'm not aware of any consequence beside pulling unnecessary rows from all_statements.
Reactions are currently unavailable