Repository: trafodion Updated Branches: refs/heads/master dc68de48a -> a2ba04cb7
http://git-wip-us.apache.org/repos/asf/trafodion/blob/4528a100/core/sql/regress/privs2/EXPECTED143 ---------------------------------------------------------------------- diff --git a/core/sql/regress/privs2/EXPECTED143 b/core/sql/regress/privs2/EXPECTED143 index 863d74f..bdcbae9 100644 --- a/core/sql/regress/privs2/EXPECTED143 +++ b/core/sql/regress/privs2/EXPECTED143 @@ -917,6 +917,28 @@ T143_USER1.U1T3 3 SQL --- SQL operation complete. >>execute get_obj_privs; +*** ERROR[8734] Statement must be recompiled to allow privileges to be re-evaluated. + +--- 0 row(s) selected. +>>prepare get_obj_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> object_type as type, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".object_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3 ++>; + +--- SQL command prepared. +>>execute get_obj_privs; + OBJECT_NAME TYPE GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS ------------------------------------------------------------ ---- ---------- ---------- -------------------- -------------------- @@ -934,6 +956,27 @@ T143_USER3.U3V4 VI -2 --- 10 row(s) selected. >>execute get_col_privs; +*** ERROR[8734] Statement must be recompiled to allow privileges to be re-evaluated. + +--- 0 row(s) selected. +>>prepare get_col_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> column_number, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".column_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3, 4; + +--- SQL command prepared. +>>execute get_col_privs; + OBJECT_NAME COLUMN_NUMBER GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS ------------------------------------------------------------ ------------- ---------- ---------- -------------------- -------------------- @@ -1095,6 +1138,40 @@ T143_USER5.U5V1 VI -2 T143_USER5.U5V2 VI -2 SQL_USER5 S----R- S----R- --- 9 row(s) selected. +>>prepare get_obj_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> object_type as type, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".object_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3 ++>; + +--- SQL command prepared. +>> +>>execute get_obj_privs; + +OBJECT_NAME TYPE GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS +------------------------------------------------------------ ---- ---------- ---------- -------------------- -------------------- + +T143_USER1.U1T1 BT -2 SQL_USER1 SIDU-R- SIDU-R- +T143_USER1.U1V1 VI -2 SQL_USER1 S-DU-R- S-DU-R- +T143_USER1.U1V1 VI SQL_USER1 SQL_USER5 S------ NONE +T143_USER1.U1V1 VI SQL_USER1 USER2_ROLE S------ S------ +T143_USER2.U2V1 VI -2 USER2_ROLE S------ S------ +T143_USER2.U2V1 VI USER2_ROLE SQL_USER6 S------ S------ +T143_USER3.U3V1 VI -2 SQL_USER3 S------ NONE +T143_USER5.U5V1 VI -2 SQL_USER5 S------ NONE +T143_USER5.U5V2 VI -2 SQL_USER5 S----R- S----R- + +--- 9 row(s) selected. >> >>-- u1t1 user1 grants: c1-select, c2/c3-select WGO user5 >>-- u2v1 user2_role grants: c1/c2-select user3, select-c2 user6 @@ -1111,6 +1188,36 @@ T143_USER2.U2V1 1 USE T143_USER2.U2V1 1 USER2_ROLE SQL_USER6 S------ NONE --- 6 row(s) selected. +>>prepare get_col_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> column_number, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".column_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3, 4; + +--- SQL command prepared. +>> +>>execute get_col_privs; + +OBJECT_NAME COLUMN_NUMBER GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS +------------------------------------------------------------ ------------- ---------- ---------- -------------------- -------------------- + +T143_USER1.U1T1 0 SQL_USER1 SQL_USER5 S------ NONE +T143_USER1.U1T1 1 SQL_USER1 SQL_USER5 S------ S------ +T143_USER1.U1T1 2 SQL_USER1 SQL_USER5 S------ S------ +T143_USER2.U2V1 0 USER2_ROLE SQL_USER3 S------ NONE +T143_USER2.U2V1 1 USER2_ROLE SQL_USER3 S------ NONE +T143_USER2.U2V1 1 USER2_ROLE SQL_USER6 S------ NONE + +--- 6 row(s) selected. >> >>-- Run some different tests: >> @@ -1231,6 +1338,41 @@ T143_USER5.U5V2 VI -2 T143_USER5.U5V2 VI SQL_USER5 SQL_USER4 S------ NONE --- 11 row(s) selected. +>>prepare get_obj_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> object_type as type, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".object_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3; + +--- SQL command prepared. +>> +>>execute get_obj_privs; + +OBJECT_NAME TYPE GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS +------------------------------------------------------------ ---- ---------- ---------- -------------------- -------------------- + +T143_USER1.U1T1 BT -2 SQL_USER1 SIDU-R- SIDU-R- +T143_USER1.U1T1 BT SQL_USER1 USER2_ROLE -I----- -I----- +T143_USER1.U1V1 VI -2 SQL_USER1 S-DU-R- S-DU-R- +T143_USER1.U1V1 VI SQL_USER1 SQL_USER5 S------ NONE +T143_USER1.U1V1 VI SQL_USER1 USER2_ROLE S--U--- S------ +T143_USER2.U2V1 VI -2 USER2_ROLE S--U--- S------ +T143_USER2.U2V1 VI USER2_ROLE SQL_USER6 S------ S------ +T143_USER3.U3V1 VI -2 SQL_USER3 S------ S------ +T143_USER5.U5V1 VI -2 SQL_USER5 S------ NONE +T143_USER5.U5V2 VI -2 SQL_USER5 S----R- S----R- +T143_USER5.U5V2 VI SQL_USER5 SQL_USER4 S------ NONE + +--- 11 row(s) selected. >>execute get_col_privs; OBJECT_NAME COLUMN_NUMBER GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS @@ -1246,6 +1388,37 @@ T143_USER3.U3V1 0 SQL T143_USER3.U3V1 1 SQL_USER3 SQL_USER4 S------ NONE --- 8 row(s) selected. +>>prepare get_col_privs from ++>select distinct ++> substring (object_name,11,15) as object_name, ++> column_number, ++> substring(authname(grantor_id),1,10) as grantor, ++> substring(authname(grantee_id),1,10) as grantee, ++> t143_udr.translateBitmap(privileges_bitmap) as granted_privs, ++> t143_udr.translateBitmap(grantable_bitmap) as grantable_privs ++>from "_PRIVMGR_MD_".column_privileges ++>where object_uid in ++> (select object_uid ++> from "_MD_".objects ++> where object_name like 'U%' and schema_name like 'T143_USER%') ++> order by 1, 2, 3, 4; + +--- SQL command prepared. >> +>>execute get_col_privs; + +OBJECT_NAME COLUMN_NUMBER GRANTOR GRANTEE GRANTED_PRIVS GRANTABLE_PRIVS +------------------------------------------------------------ ------------- ---------- ---------- -------------------- -------------------- + +T143_USER1.U1T1 0 SQL_USER1 SQL_USER5 S------ NONE +T143_USER1.U1T1 1 SQL_USER1 SQL_USER5 S------ S------ +T143_USER1.U1T1 2 SQL_USER1 SQL_USER5 S------ S------ +T143_USER2.U2V1 0 USER2_ROLE SQL_USER3 S------ S------ +T143_USER2.U2V1 1 USER2_ROLE SQL_USER3 S------ S------ +T143_USER2.U2V1 1 USER2_ROLE SQL_USER6 S------ NONE +T143_USER3.U3V1 0 SQL_USER3 SQL_USER4 S------ NONE +T143_USER3.U3V1 1 SQL_USER3 SQL_USER4 S------ NONE + +--- 8 row(s) selected. >>-- >>============================================================================ >>log; http://git-wip-us.apache.org/repos/asf/trafodion/blob/4528a100/core/sql/regress/privs2/TEST143 ---------------------------------------------------------------------- diff --git a/core/sql/regress/privs2/TEST143 b/core/sql/regress/privs2/TEST143 index 3f7f5b1..ece3c38 100755 --- a/core/sql/regress/privs2/TEST143 +++ b/core/sql/regress/privs2/TEST143 @@ -302,6 +302,37 @@ revoke insert (c1) on t143_user1.u1t2 from user3_role; revoke update on t143_user1.u1t3 from user3_role; revoke grant option for select (c2, c3) on t143_user1.u1t3 from user3_role; execute get_obj_privs; +prepare get_obj_privs from +select distinct + substring (object_name,11,15) as object_name, + object_type as type, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".object_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3 +; +execute get_obj_privs; +execute get_col_privs; +prepare get_col_privs from +select distinct + substring (object_name,11,15) as object_name, + column_number, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".column_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3, 4; execute get_col_privs; -- ============================================================================ @@ -369,10 +400,43 @@ create view u5v2 (u5v1_c1) as -- u1v1 user1 grants: select user2_role WGO, select user5 -- u2v1 user2-role grants: select user6 WGO execute get_obj_privs; +prepare get_obj_privs from +select distinct + substring (object_name,11,15) as object_name, + object_type as type, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".object_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3 +; + +execute get_obj_privs; -- u1t1 user1 grants: c1-select, c2/c3-select WGO user5 -- u2v1 user2_role grants: c1/c2-select user3, select-c2 user6 execute get_col_privs; +prepare get_col_privs from +select distinct + substring (object_name,11,15) as object_name, + column_number, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".column_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3, 4; + +execute get_col_privs; -- Run some different tests: @@ -416,8 +480,39 @@ grant select on t143_user5.u5v2 to sql_user4; -- u1v1 user1 grants: + update user2_role -- u5v2 user5 grants: c1-select user4 execute get_obj_privs; +prepare get_obj_privs from +select distinct + substring (object_name,11,15) as object_name, + object_type as type, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".object_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3; + +execute get_obj_privs; execute get_col_privs; +prepare get_col_privs from +select distinct + substring (object_name,11,15) as object_name, + column_number, + substring(authname(grantor_id),1,10) as grantor, + substring(authname(grantee_id),1,10) as grantee, + t143_udr.translateBitmap(privileges_bitmap) as granted_privs, + t143_udr.translateBitmap(grantable_bitmap) as grantable_privs +from "_PRIVMGR_MD_".column_privileges +where object_uid in + (select object_uid + from "_MD_".objects + where object_name like 'U%' and schema_name like 'T143_USER%') + order by 1, 2, 3, 4; +execute get_col_privs; -- ============================================================================ ?section user2_views -- ============================================================================ http://git-wip-us.apache.org/repos/asf/trafodion/blob/4528a100/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp index 1501661..17dfc45 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp @@ -573,12 +573,13 @@ void CmpSeabaseDDL::createSeabaseLibrary2( libNameNoPath = libFileName(lastSlash+1, libFileName.length()-lastSlash-1); else { - *CmpCommon::diags() << DgSqlCode(-1382) + /**CmpCommon::diags() << DgSqlCode(-1382) << DgString0(libFileName); deallocEHI(ehi); processReturn(); - return; - + return;*/ + libNameNoPath = libFileName; + } ComTdbVirtTableTableInfo * tableInfo = new(STMTHEAP) ComTdbVirtTableTableInfo[1]; tableInfo->tableName = NULL,
