[CP] [to #2024072000103866275] fix bugs, modify ALL_PROCEDURES view_definition and ALL_TRIGGER view_definitions
This commit is contained in:
@ -210,7 +210,7 @@ int ObInnerTableSchema::dba_procedures_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT D.DATABASE_NAME AS OWNER, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID())R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE D.IN_RECYCLEBIN = 0 UNION ALL SELECT CAST('SYS' AS VARCHAR2(30)) AS OWNER, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_NAME WHEN 2 THEN RS.ROUTINE_NAME WHEN 3 THEN PS.PACKAGE_NAME WHEN 4 THEN TS.TYPE_NAME END AS OBJECT_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN RS.ROUTINE_NAME WHEN 4 THEN RS.ROUTINE_NAME END AS PROCEDURE_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_ID WHEN 2 THEN RS.ROUTINE_ID WHEN 3 THEN PS.PACKAGE_ID WHEN 4 THEN TS.TYPE_ID END AS OBJECT_ID, CASE RS.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE RS.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE RS.OVERLOAD WHEN 0 THEN NULL ELSE RS.OVERLOAD END AS OVERLOAD, CASE RS.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(RS.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(RS.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, CAST(CASE WHEN TS1.TYPE_NAME IS NULL THEN NULL ELSE 'SYS' END AS VARCHAR2(30)) AS IMPLTYPEOWNER, TS1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(RS.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(RS.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(RS.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, RS.TENANT_ID AS ORIGIN_CON_ID FROM SYS.ALL_VIRTUAL_ROUTINE_SYS_AGENT RS LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_SYS_AGENT PS ON RS.PACKAGE_ID = PS.PACKAGE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS ON RS.PACKAGE_ID = TS.TYPE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS1 ON RS.TYPE_ID = TS1.TYPE_ID WHERE RS.ROUTINE_TYPE != 1 AND RS.ROUTINE_TYPE != 2 -- sys tenant only have sys package and type. )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT D.DATABASE_NAME AS OWNER, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID())R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE D.IN_RECYCLEBIN = 0 UNION ALL SELECT CAST('SYS' AS VARCHAR2(30)) AS OWNER, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_NAME WHEN 2 THEN RS.ROUTINE_NAME WHEN 3 THEN PS.PACKAGE_NAME WHEN 4 THEN TS.TYPE_NAME END AS OBJECT_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN RS.ROUTINE_NAME WHEN 4 THEN RS.ROUTINE_NAME END AS PROCEDURE_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_ID WHEN 2 THEN RS.ROUTINE_ID WHEN 3 THEN PS.PACKAGE_ID WHEN 4 THEN TS.TYPE_ID END AS OBJECT_ID, CASE RS.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE RS.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE RS.OVERLOAD WHEN 0 THEN NULL ELSE RS.OVERLOAD END AS OVERLOAD, CASE RS.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(RS.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(RS.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, CAST(CASE WHEN TS1.TYPE_NAME IS NULL THEN NULL ELSE 'SYS' END AS VARCHAR2(30)) AS IMPLTYPEOWNER, TS1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(RS.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(RS.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(RS.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, RS.TENANT_ID AS ORIGIN_CON_ID FROM SYS.ALL_VIRTUAL_ROUTINE_SYS_AGENT RS LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_SYS_AGENT PS ON RS.PACKAGE_ID = PS.PACKAGE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS ON RS.PACKAGE_ID = TS.TYPE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS1 ON RS.TYPE_ID = TS1.TYPE_ID WHERE RS.ROUTINE_TYPE != 1 AND RS.ROUTINE_TYPE != 2 -- sys tenant only have sys package and type. )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -360,7 +360,7 @@ int ObInnerTableSchema::all_procedures_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT D.DATABASE_NAME AS OWNER, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE (R.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(12, R.ROUTINE_ID, R.DATABASE_ID) = 1) AND D.IN_RECYCLEBIN = 0 UNION ALL SELECT CAST('SYS' AS VARCHAR2(30)) AS OWNER, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_NAME WHEN 2 THEN RS.ROUTINE_NAME WHEN 3 THEN PS.PACKAGE_NAME WHEN 4 THEN TS.TYPE_NAME END AS OBJECT_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN RS.ROUTINE_NAME WHEN 4 THEN RS.ROUTINE_NAME END AS PROCEDURE_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_ID WHEN 2 THEN RS.ROUTINE_ID WHEN 3 THEN PS.PACKAGE_ID WHEN 4 THEN TS.TYPE_ID END AS OBJECT_ID, CASE RS.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE RS.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE RS.OVERLOAD WHEN 0 THEN NULL ELSE RS.OVERLOAD END AS OVERLOAD, CASE RS.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(RS.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(RS.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, CAST(CASE WHEN TS1.TYPE_NAME IS NULL THEN NULL ELSE 'SYS' END AS VARCHAR2(30)) AS IMPLTYPEOWNER, TS1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(RS.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(RS.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(RS.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, RS.TENANT_ID AS ORIGIN_CON_ID FROM SYS.ALL_VIRTUAL_ROUTINE_SYS_AGENT RS LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_SYS_AGENT PS ON RS.PACKAGE_ID = PS.PACKAGE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS ON RS.PACKAGE_ID = TS.TYPE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS1 ON RS.TYPE_ID = TS1.TYPE_ID WHERE RS.ROUTINE_TYPE != 1 AND RS.ROUTINE_TYPE != 2 -- sys tenant only have sys package and type. )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT D.DATABASE_NAME AS OWNER, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE (R.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(12, R.ROUTINE_ID, R.DATABASE_ID) = 1) AND D.IN_RECYCLEBIN = 0 UNION ALL SELECT CAST('SYS' AS VARCHAR2(30)) AS OWNER, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_NAME WHEN 2 THEN RS.ROUTINE_NAME WHEN 3 THEN PS.PACKAGE_NAME WHEN 4 THEN TS.TYPE_NAME END AS OBJECT_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN RS.ROUTINE_NAME WHEN 4 THEN RS.ROUTINE_NAME END AS PROCEDURE_NAME, CASE RS.ROUTINE_TYPE WHEN 1 THEN RS.ROUTINE_ID WHEN 2 THEN RS.ROUTINE_ID WHEN 3 THEN PS.PACKAGE_ID WHEN 4 THEN TS.TYPE_ID END AS OBJECT_ID, CASE RS.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE RS.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE RS.OVERLOAD WHEN 0 THEN NULL ELSE RS.OVERLOAD END AS OVERLOAD, CASE RS.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(RS.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(RS.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, CAST(CASE WHEN TS1.TYPE_NAME IS NULL THEN NULL ELSE 'SYS' END AS VARCHAR2(30)) AS IMPLTYPEOWNER, TS1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(RS.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(RS.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(RS.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, RS.TENANT_ID AS ORIGIN_CON_ID FROM SYS.ALL_VIRTUAL_ROUTINE_SYS_AGENT RS LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_SYS_AGENT PS ON RS.PACKAGE_ID = PS.PACKAGE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS ON RS.PACKAGE_ID = TS.TYPE_ID LEFT JOIN SYS.ALL_VIRTUAL_TYPE_SYS_AGENT TS1 ON RS.TYPE_ID = TS1.TYPE_ID WHERE RS.ROUTINE_TYPE != 1 AND RS.ROUTINE_TYPE != 2 -- sys tenant only have sys package and type. )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -510,7 +510,7 @@ int ObInnerTableSchema::user_procedures_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE D.IN_RECYCLEBIN = 0 AND R.DATABASE_ID = USERENV('SCHEMAID') )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_NAME WHEN 2 THEN R.ROUTINE_NAME WHEN 3 THEN P.PACKAGE_NAME WHEN 4 THEN T.TYPE_NAME END AS OBJECT_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN NULL WHEN 2 THEN NULL WHEN 3 THEN R.ROUTINE_NAME WHEN 4 THEN R.ROUTINE_NAME END AS PROCEDURE_NAME, CASE R.ROUTINE_TYPE WHEN 1 THEN R.ROUTINE_ID WHEN 2 THEN R.ROUTINE_ID WHEN 3 THEN P.PACKAGE_ID WHEN 4 THEN T.TYPE_ID END AS OBJECT_ID, CASE R.SUBPROGRAM_ID WHEN 0 THEN 1 ELSE R.SUBPROGRAM_ID END AS SUBPROGRAM_ID, CASE R.OVERLOAD WHEN 0 THEN NULL ELSE R.OVERLOAD END AS OVERLOAD, CASE R.ROUTINE_TYPE WHEN 1 THEN 'PROCEDURE' WHEN 2 THEN 'FUNCTION' WHEN 3 THEN 'PACKAGE' WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE, CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE, CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED, D1.DATABASE_NAME AS IMPLTYPEOWNER, T1.TYPE_NAME AS IMPLTYPENAME, CAST(DECODE(BITAND(R.FLAG, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS PARALLEL, CAST('NO' AS VARCHAR2(3)) AS INTERFACE, CAST(DECODE(BITAND(R.FLAG, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS DETERMINISTIC, CAST(DECODE(BITAND(R.FLAG, 16), 16, 'INVOKER', 'DEFINER') AS VARCHAR2(12)) AS AUTHID, R.TENANT_ID AS ORIGIN_CON_ID FROM (SELECT * FROM SYS.ALL_VIRTUAL_ROUTINE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) R LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON R.DATABASE_ID = D.DATABASE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_PACKAGE_REAL_AGENT P ON R.PACKAGE_ID = P.PACKAGE_ID AND P.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T ON R.PACKAGE_ID = T.TYPE_ID AND T.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TYPE_REAL_AGENT T1 ON R.TYPE_ID = T1.TYPE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D1 ON T1.DATABASE_ID = D1.DATABASE_ID AND T1.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE D.IN_RECYCLEBIN = 0 AND R.DATABASE_ID = USERENV('SCHEMAID') )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ int ObInnerTableSchema::all_triggers_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT DB1.DATABASE_NAME AS OWNER, TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE', 34, 'VIEW') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB1 ON TRG.DATABASE_ID = DB1.DATABASE_ID AND TRG.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND (TRG.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, abs(nvl(TRG.BASE_OBJECT_ID,0)), TRG.DATABASE_ID) = 1) LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT DB1.DATABASE_NAME AS OWNER, TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE', 34, 'VIEW') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB1 ON TRG.DATABASE_ID = DB1.DATABASE_ID AND TRG.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND (TRG.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, abs(nvl(TRG.BASE_OBJECT_ID,0)), TRG.DATABASE_ID) = 1) LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ int ObInnerTableSchema::dba_triggers_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT DB1.DATABASE_NAME AS OWNER, TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB1 ON TRG.DATABASE_ID = DB1.DATABASE_ID AND TRG.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT DB1.DATABASE_NAME AS OWNER, TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB1 ON TRG.DATABASE_ID = DB1.DATABASE_ID AND TRG.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB1.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ int ObInnerTableSchema::user_triggers_schema(ObTableSchema &table_schema)
|
||||
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE', 34, 'VIEW') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW, CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM (SELECT * FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID())TRG LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TRG.DATABASE_ID = USERENV('SCHEMAID') )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT TRG.TRIGGER_NAME AS TRIGGER_NAME, CAST((case when TRG.TRIGGER_TYPE=1 then DECODE(BITAND(TRG.TIMING_POINTS, 30), 2, 'BEFORE STATEMENT', 4, 'BEFORE EACH ROW', 8, 'AFTER EACH ROW', 16, 'AFTER STATEMENT') when TRG.TRIGGER_TYPE=2 then 'COMPOUND' when TRG.TRIGGER_TYPE=3 then 'INSTEAD OF' END) AS VARCHAR2(16)) AS TRIGGER_TYPE, CAST(DECODE(TRG.TRIGGER_EVENTS, 1, 'INSERT', 2, 'UPDATE', 4, 'DELETE', 1 + 2, 'INSERT OR UPDATE', 1 + 4, 'INSERT OR DELETE', 2 + 4, 'UPDATE OR DELETE', 1 + 2 + 4, 'INSERT OR UPDATE OR DELETE') AS VARCHAR2(246)) AS TRIGGERING_EVENT, DB2.DATABASE_NAME AS TABLE_OWNER, CAST(DECODE(TRG.BASE_OBJECT_TYPE, 5, 'TABLE', 34, 'VIEW') AS VARCHAR2(18)) AS BASE_OBJECT_TYPE, TBL.TABLE_NAME AS TABLE_NAME, CAST(NULL AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(CONCAT('REFERENCING', CONCAT(CONCAT(' NEW AS ', REF_NEW_NAME), CONCAT(' OLD AS ', REF_OLD_NAME))) AS VARCHAR2(422)) AS REFERENCING_NAMES, WHEN_CONDITION AS WHEN_CLAUSE, CAST(decode(BITAND(TRG.trigger_flags, 1), 1, 'ENABLED', 'DISABLED') AS VARCHAR2(8)) AS STATUS, TRIGGER_BODY AS DESCRIPTION, CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE, TRIGGER_BODY AS TRIGGER_BODY, CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT, CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW, CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE, CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY FROM (SELECT * FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID())TRG LEFT JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TBL ON TRG.BASE_OBJECT_ID = TBL.TABLE_ID AND TBL.TENANT_ID = EFFECTIVE_TENANT_ID() AND bitand((TBL.TABLE_MODE / 4096), 15) IN (0,1) INNER JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB2 ON TBL.DATABASE_ID = DB2.DATABASE_ID AND DB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TRG.DATABASE_ID = USERENV('SCHEMAID') )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
@ -42581,7 +42581,7 @@ def_table_schema(
|
||||
WHEN 2 THEN 'FUNCTION'
|
||||
WHEN 3 THEN 'PACKAGE'
|
||||
WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED,
|
||||
D1.DATABASE_NAME AS IMPLTYPEOWNER,
|
||||
T1.TYPE_NAME AS IMPLTYPENAME,
|
||||
@ -42890,7 +42890,7 @@ def_table_schema(
|
||||
WHEN 2 THEN 'FUNCTION'
|
||||
WHEN 3 THEN 'PACKAGE'
|
||||
WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED,
|
||||
D1.DATABASE_NAME AS IMPLTYPEOWNER,
|
||||
T1.TYPE_NAME AS IMPLTYPENAME,
|
||||
@ -43211,7 +43211,7 @@ def_table_schema(
|
||||
WHEN 2 THEN 'FUNCTION'
|
||||
WHEN 3 THEN 'PACKAGE'
|
||||
WHEN 4 THEN 'TYPE' END AS OBJECT_TYPE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16484, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 16384), 16384, 'YES', 'NO') AS VARCHAR(3)) AS AGGREGATE,
|
||||
CAST(DECODE(BITAND(R.FLAG, 128), 128, 'YES', 'NO') AS VARCHAR2(3)) AS PIPELINED,
|
||||
D1.DATABASE_NAME AS IMPLTYPEOWNER,
|
||||
T1.TYPE_NAME AS IMPLTYPENAME,
|
||||
@ -49894,11 +49894,11 @@ SELECT DB1.DATABASE_NAME AS OWNER,
|
||||
CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE,
|
||||
TRIGGER_BODY AS TRIGGER_BODY,
|
||||
CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE,
|
||||
CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY
|
||||
FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG
|
||||
@ -49965,11 +49965,11 @@ SELECT DB1.DATABASE_NAME AS OWNER,
|
||||
CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE,
|
||||
TRIGGER_BODY AS TRIGGER_BODY,
|
||||
CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE,
|
||||
CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY
|
||||
FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT TRG
|
||||
@ -50034,11 +50034,11 @@ SELECT TRG.TRIGGER_NAME AS TRIGGER_NAME,
|
||||
CAST('PL/SQL' AS VARCHAR2(11)) AS ACTION_TYPE,
|
||||
TRIGGER_BODY AS TRIGGER_BODY,
|
||||
CAST('NO' AS VARCHAR2(7)) AS CROSSEDITION,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST('NO' AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST('NO' AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 2), 2, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 4), 4, 'YES', 'NO') AS VARCHAR2(3)) AS BEFORE_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 8), 8, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_ROW,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 16), 16, 'YES', 'NO') AS VARCHAR2(3)) AS AFTER_STATEMENT,
|
||||
CAST(DECODE(BITAND(TRG.TIMING_POINTS, 32), 32, 'YES', 'NO') AS VARCHAR2(3)) AS INSTEAD_OF_ROW,
|
||||
CAST('YES' AS VARCHAR2(3)) AS FIRE_ONCE,
|
||||
CAST('NO' AS VARCHAR2(3)) AS APPLY_SERVER_ONLY
|
||||
FROM (SELECT * FROM SYS.ALL_VIRTUAL_TENANT_TRIGGER_REAL_AGENT
|
||||
|
||||
Reference in New Issue
Block a user