You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by rm...@apache.org on 2016/02/17 19:43:05 UTC
[1/2] incubator-trafodion git commit: TRAFODION-1832: Add privilege
regression test 132
Repository: incubator-trafodion
Updated Branches:
refs/heads/master 7af82a8a2 -> 0918828b8
TRAFODION-1832: Add privilege regression test 132
Activated privs1 regression test 132. This tests privileges on various
utilities.
Fixed a problem in privilege manager cleanup code where histogram tables
were not be dropped.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/da8dd7c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/da8dd7c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/da8dd7c8
Branch: refs/heads/master
Commit: da8dd7c82b92a3b3650563ced892500c04a1173b
Parents: 83c66bf
Author: Roberta Marton <ro...@apache.org>
Authored: Tue Feb 16 23:59:25 2016 +0000
Committer: Roberta Marton <ro...@apache.org>
Committed: Tue Feb 16 23:59:25 2016 +0000
----------------------------------------------------------------------
core/sql/regress/privs1/EXPECTED132 | 263 +++++++++++++------------
core/sql/regress/privs1/TEST132 | 60 ++----
core/sql/regress/tools/runregr_privs1.ksh | 2 +-
core/sql/sqlcomp/CmpSeabaseDDL.h | 2 +
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 14 ++
core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 6 +-
core/sql/sqlcomp/PrivMgrMD.cpp | 14 +-
7 files changed, 185 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/regress/privs1/EXPECTED132
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs1/EXPECTED132 b/core/sql/regress/privs1/EXPECTED132
index b472586..ea090c5 100644
--- a/core/sql/regress/privs1/EXPECTED132
+++ b/core/sql/regress/privs1/EXPECTED132
@@ -193,52 +193,6 @@ SHOW
--- SQL operation complete.
>>
->>obey TEST132(test_load_unload_purgedata);
->>-- =================================================================
->>-- run tests to make sure users with correct privileges can load
->>-- and unload data. To load a table, you must:
->>-- be DB__ROOT
->>-- be granted DB__ROOTROLE
->>-- have the MANAGE_LOAD
->>-- be table owner
->>-- have SELECT and INSERT (DELETE for TRUNCATE option) privilege
->>--
->>-- To unload a table, you must:`
->>-- be DB__ROOT
->>-- be granted DB__ROOTROLE
->>-- have the MANAGE_LOAD
->>-- be table owner
->>-- have SELECT privilege
->>--
->>-- To purgedata data, you must:
->>-- be DB__ROOT
->>-- be table owner
->>-- have SELECT and DELETE privileges
->>-- =================================================================
->>
->>set schema t132sch;
-
---- SQL operation complete.
->>get tables;
-
---- SQL operation complete.
->>
->>
->>-- perform a load and unload as DB__ROOT
->>-- purgedata
->>-- perform a load and unload after being granted DB__ROOTROLE
->>-- purgedata
->>-- perform a load and unload without privileges
->>-- perform a load and unload as table owner
->>-- purgedata
->>-- perform a load and unload with SELECT
->>-- perform a load and unload with SELECT, INSERT
->>-- purgedata, grant DELETE and purgedata again
->>-- perform a load (truncate) and unload with select, insert, delete
->>-- perform a load and unload with MANAGE_LOAD privilege
->>
->>-- reset
->>
>>obey TEST132(test_popindex);
>>-- =================================================================
>>-- run tests to make sure users that populate indexes have correct
@@ -251,8 +205,24 @@ SHOW
>>set schema t132sch;
--- SQL operation complete.
+>>set parserflags 1;
+
+--- SQL operation complete.
+>>set parserflags 131072;
+
+--- SQL operation complete.
+>>cqd DDL_TRANSACTIONS 'ON';
+
+--- SQL operation complete.
+>>
>>get tables;
+Tables in Schema TRAFODION.T132SCH
+==================================
+
+SB_HISTOGRAMS
+SB_HISTOGRAM_INTERVALS
+
--- SQL operation complete.
>>
>>create table t132t1 (c1 int not null primary key, c2 int);
@@ -291,6 +261,8 @@ SHOW
Tables in Schema TRAFODION.T132SCH
==================================
+SB_HISTOGRAMS
+SB_HISTOGRAM_INTERVALS
T132T1
T132T2
T132T3
@@ -358,9 +330,6 @@ End of MXCI Session
--- SQL operation complete.
>>log LOG132;
->>set parserflags 1;
-
---- SQL operation complete.
>>
>>select count(*) from table (index_table t132t1_ndx1);
@@ -435,16 +404,13 @@ End of MXCI Session
--- SQL operation complete.
>>log LOG132;
->>set parserflags 1;
-
---- SQL operation complete.
>>
>>select count(*) from table (index_table t132t1_ndx1);
(EXPR)
--------------------
- 8
+ 0
--- 1 row(s) selected.
>>select count(*) from table (index_table t132t2_ndx1);
@@ -484,7 +450,7 @@ End of MXCI Session
--- SQL operation complete.
>>
>>
->>-- if user belongs to DB__ROOTROLE, has no privilege
+>>-- if user belongs to DB__ROOTROLE, has DML privileges, so can populate indexes
>>grant role DB__ROOTROLE to sql_user2;
--- SQL operation complete.
@@ -492,43 +458,90 @@ End of MXCI Session
>>
>>populate index t132t1_ndx1 on t132t1;
-*** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.T132SCH.T132T1.
+--- SQL operation complete.
+>>populate index t132t2_ndx1 on t132t2;
-*** ERROR[4481] The user does not have INSERT privilege on table or view TRAFODION.T132SCH.T132T1.
+--- SQL operation complete.
+>>populate index t132t3_ndx1 on t132t3;
---- SQL operation failed with errors.
->>populate index t132t2_ndx1 on t132t2;
+--- SQL operation complete.
+>>
+>>exit;
-*** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.T132SCH.T132T2.
+End of MXCI Session
-*** ERROR[4481] The user does not have INSERT privilege on table or view TRAFODION.T132SCH.T132T2.
+>>obey TEST132(popindex_check_reset);
+>>set schema t132sch;
---- SQL operation failed with errors.
->>populate index t132t3_ndx1 on t132t3;
+--- SQL operation complete.
+>>log LOG132;
+>>
+>>select count(*) from table (index_table t132t1_ndx1);
-*** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.T132SCH.T132T3.
+(EXPR)
+--------------------
-*** ERROR[4481] The user does not have INSERT privilege on table or view TRAFODION.T132SCH.T132T3.
+ 8
---- SQL operation failed with errors.
+--- 1 row(s) selected.
+>>select count(*) from table (index_table t132t2_ndx1);
+
+(EXPR)
+--------------------
+
+ 8
+
+--- 1 row(s) selected.
+>>select count(*) from table (index_table t132t3_ndx1);
+
+(EXPR)
+--------------------
+
+ 8
+
+--- 1 row(s) selected.
>>
->>exit;
+>>drop index t132t1_ndx1;
-End of MXCI Session
+--- SQL operation complete.
+>>create index t132t1_ndx1 on t132t1 (c2) no populate;
+
+--- SQL operation complete.
+>>drop index t132t2_ndx1;
+
+--- SQL operation complete.
+>>create index t132t2_ndx1 on t132t2 (c2) no populate;
+
+--- SQL operation complete.
+>>drop index t132t3_ndx1;
+
+--- SQL operation complete.
+>>create index t132t3_ndx1 on t132t3 (c2) no populate;
+
+--- SQL operation complete.
+>>
+>>revoke role DB__ROOTROLE from sql_user2;
+--- SQL operation complete.
>>
->>-- if user has SELECT and INSERT privileges
->>grant SELECT,INSERT on t132t1 to sql_user3;
+>>-- sql_user3 requires both SELECT and INSERT privileges
+>>-- only t132t2 has granted both privileges
+>>grant SELECT on t132t1 to sql_user3;
--- SQL operation complete.
>>grant SELECT, INSERT on t132t2 to sql_user3 by sql_user1;
--- SQL operation complete.
+>>grant INSERT on t132t3 to sql_user3 by sql_user1;
+
+--- SQL operation complete.
>>sh sqlci -i "TEST132(populate_index)" -u sql_user3;
>>
>>populate index t132t1_ndx1 on t132t1;
---- SQL operation complete.
+*** ERROR[4481] The user does not have INSERT privilege on table or view TRAFODION.T132SCH.T132T1.
+
+--- SQL operation failed with errors.
>>populate index t132t2_ndx1 on t132t2;
--- SQL operation complete.
@@ -536,8 +549,6 @@ End of MXCI Session
*** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.T132SCH.T132T3.
-*** ERROR[4481] The user does not have INSERT privilege on table or view TRAFODION.T132SCH.T132T3.
-
--- SQL operation failed with errors.
>>
>>exit;
@@ -549,16 +560,13 @@ End of MXCI Session
--- SQL operation complete.
>>log LOG132;
->>set parserflags 1;
-
---- SQL operation complete.
>>
>>select count(*) from table (index_table t132t1_ndx1);
(EXPR)
--------------------
- 8
+ 0
--- 1 row(s) selected.
>>select count(*) from table (index_table t132t2_ndx1);
@@ -574,7 +582,7 @@ End of MXCI Session
(EXPR)
--------------------
- 8
+ 0
--- 1 row(s) selected.
>>
@@ -599,9 +607,6 @@ End of MXCI Session
>>
>>
>>-- reset
->>revoke role DB__ROOTROLE from sql_user2;
-
---- SQL operation complete.
>>drop table t132t1 cascade;
--- SQL operation complete.
@@ -613,6 +618,12 @@ End of MXCI Session
--- SQL operation complete.
>>get tables;
+Tables in Schema TRAFODION.T132SCH
+==================================
+
+SB_HISTOGRAMS
+SB_HISTOGRAM_INTERVALS
+
--- SQL operation complete.
>>
>>obey TEST132(test_show);
@@ -852,7 +863,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:38:42 2015
+-- Definition current Sat Feb 13 01:27:45 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -868,7 +879,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:38:44 2015
+-- Definition current Sat Feb 13 01:27:47 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -884,7 +895,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_giants_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_GIANTS_GAMES
--- Definition current Wed Dec 16 22:38:46 2015
+-- Definition current Sat Feb 13 01:27:49 2016
(
GAME_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -898,7 +909,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_home_teams_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_HOME_TEAMS_GAMES
--- Definition current Wed Dec 16 22:38:47 2015
+-- Definition current Sat Feb 13 01:27:50 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -968,7 +979,7 @@ ALTER TABLE TRAFODION.T132SCH.T132_GAMES ADD CONSTRAINT
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:39:05 2015
+-- Definition current Sat Feb 13 01:28:08 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1162,7 +1173,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:39:46 2015
+-- Definition current Sat Feb 13 01:28:45 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1178,7 +1189,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:39:46 2015
+-- Definition current Sat Feb 13 01:28:45 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1194,7 +1205,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_giants_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_GIANTS_GAMES
--- Definition current Wed Dec 16 22:39:46 2015
+-- Definition current Sat Feb 13 01:28:45 2016
(
GAME_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1208,7 +1219,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_home_teams_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_HOME_TEAMS_GAMES
--- Definition current Wed Dec 16 22:39:47 2015
+-- Definition current Sat Feb 13 01:28:45 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1288,7 +1299,7 @@ ALTER TABLE TRAFODION.T132SCH.T132_TEAMS ADD CONSTRAINT
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:40:09 2015
+-- Definition current Sat Feb 13 01:29:10 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1436,7 +1447,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:40:31 2015
+-- Definition current Sat Feb 13 01:29:32 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1452,7 +1463,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:40:31 2015
+-- Definition current Sat Feb 13 01:29:32 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1468,7 +1479,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_giants_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_GIANTS_GAMES
--- Definition current Wed Dec 16 22:40:31 2015
+-- Definition current Sat Feb 13 01:29:32 2016
(
GAME_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1482,7 +1493,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_home_teams_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_HOME_TEAMS_GAMES
--- Definition current Wed Dec 16 22:40:31 2015
+-- Definition current Sat Feb 13 01:29:32 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1595,7 +1606,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:40:52 2015
+-- Definition current Sat Feb 13 01:29:53 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1611,7 +1622,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:40:52 2015
+-- Definition current Sat Feb 13 01:29:53 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1627,7 +1638,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_giants_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_GIANTS_GAMES
--- Definition current Wed Dec 16 22:40:52 2015
+-- Definition current Sat Feb 13 01:29:53 2016
(
GAME_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1641,7 +1652,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_home_teams_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_HOME_TEAMS_GAMES
--- Definition current Wed Dec 16 22:40:52 2015
+-- Definition current Sat Feb 13 01:29:53 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1754,7 +1765,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_games;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_GAMES
--- Definition current Wed Dec 16 22:41:13 2015
+-- Definition current Sat Feb 13 01:30:13 2016
(
HOME_TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1770,7 +1781,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_teams;
-- Definition of Trafodion table TRAFODION.T132SCH.T132_TEAMS
--- Definition current Wed Dec 16 22:41:13 2015
+-- Definition current Sat Feb 13 01:30:13 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1786,7 +1797,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_giants_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_GIANTS_GAMES
--- Definition current Wed Dec 16 22:41:13 2015
+-- Definition current Sat Feb 13 01:30:13 2016
(
GAME_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1800,7 +1811,7 @@ CREATE SEQUENCE TRAFODION.T132SCH.T132_TEAM_NUMBER_SEQUENCE
>>invoke t132_home_teams_games;
-- Definition of Trafodion view TRAFODION.T132SCH.T132_HOME_TEAMS_GAMES
--- Definition current Wed Dec 16 22:41:13 2015
+-- Definition current Sat Feb 13 01:30:13 2016
(
TEAM_NUMBER INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -1840,6 +1851,12 @@ End of MXCI Session
--- SQL operation complete.
>>get tables;
+Tables in Schema TRAFODION.T132SCH
+==================================
+
+SB_HISTOGRAMS
+SB_HISTOGRAM_INTERVALS
+
--- SQL operation complete.
>>
>>create table t132t1 (c1 int, c2 int);
@@ -1860,6 +1877,8 @@ End of MXCI Session
Tables in Schema TRAFODION.T132SCH
==================================
+SB_HISTOGRAMS
+SB_HISTOGRAM_INTERVALS
T132T1
T132T2
@@ -1960,26 +1979,26 @@ End of MXCI Session
>>showstats for table t132t1 on every column;
Histogram data for Table TRAFODION.T132SCH.T132T1
-Table ID: 5885726695669026634
+Table ID: 8532722397900169867
Hist ID # Ints Rowcount UEC Colname(s)
========== ====== =========== =========== ===========================
- 312208455 8 8 8 SYSKEY
- 312208448 8 8 8 C1
- 312208445 8 8 8 C2
+ 835649386 8 8 8 SYSKEY
+ 835649383 8 8 8 C1
+ 835649376 8 8 8 C2
--- SQL operation complete.
>>showstats for table t132t2 on every column;
Histogram data for Table TRAFODION.T132SCH.T132T2
-Table ID: 5885726695669026693
+Table ID: 8532722397900169937
Hist ID # Ints Rowcount UEC Colname(s)
========== ====== =========== =========== ===========================
- 315889526 8 8 8 SYSKEY
- 315889521 8 8 8 C1
- 315889516 8 8 8 C2
+ 839319130 8 8 8 SYSKEY
+ 839319125 8 8 8 C1
+ 839319120 8 8 8 C2
--- SQL operation complete.
@@ -2085,26 +2104,26 @@ MANAGE_STATISTICS
>>showstats for table t132t1 on every column;
Histogram data for Table TRAFODION.T132SCH.T132T1
-Table ID: 5885726695669026634
+Table ID: 8532722397900169867
Hist ID # Ints Rowcount UEC Colname(s)
========== ====== =========== =========== ===========================
- 312208454 8 8 8 SYSKEY
- 312208449 8 8 8 C1
- 312208444 8 8 8 C2
+ 835649387 8 8 8 SYSKEY
+ 835649382 8 8 8 C1
+ 835649377 8 8 8 C2
--- SQL operation complete.
>>showstats for table t132t2 on every column;
Histogram data for Table TRAFODION.T132SCH.T132T2
-Table ID: 5885726695669026693
+Table ID: 8532722397900169937
Hist ID # Ints Rowcount UEC Colname(s)
========== ====== =========== =========== ===========================
- 315889527 8 8 8 SYSKEY
- 315889520 8 8 8 C1
- 315889517 8 8 8 C2
+ 839319131 8 8 8 SYSKEY
+ 839319124 8 8 8 C1
+ 839319121 8 8 8 C2
--- SQL operation complete.
@@ -2165,13 +2184,13 @@ CREATE TABLE TRAFODION.T132SCH.T132T1
>>showstats for table t132t1 on every column;
Histogram data for Table TRAFODION.T132SCH.T132T1
-Table ID: 5885726695669026634
+Table ID: 8532722397900169867
Hist ID # Ints Rowcount UEC Colname(s)
========== ====== =========== =========== ===========================
- 312208454 8 8 8 SYSKEY
- 312208449 8 8 8 C1
- 312208444 8 8 8 C2
+ 835649387 8 8 8 SYSKEY
+ 835649382 8 8 8 C1
+ 835649377 8 8 8 C2
--- SQL operation complete.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/regress/privs1/TEST132
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs1/TEST132 b/core/sql/regress/privs1/TEST132
index d08f652..41f56f9 100755
--- a/core/sql/regress/privs1/TEST132
+++ b/core/sql/regress/privs1/TEST132
@@ -25,7 +25,6 @@
-- This tests the following commands:
--
-- Library operations
--- LOAD/UNLOAD & PURGEDATA
-- POPULATE INDEX
-- SHOWDDL & INVOKE
-- UPDATE STATISTICS
@@ -42,7 +41,6 @@ obey TEST132(clean_up);
obey TEST132(set_up);
log LOG132 clear;
obey TEST132(test_libraries);
-obey TEST132(test_load_unload_purgedata);
obey TEST132(test_popindex);
obey TEST132(test_show);
obey TEST132(test_stats);
@@ -112,48 +110,6 @@ get libraries in schema t132sch;
drop library t132_l1;
get libraries in schema t132sch;
-?section test_load_unload_purgedata
--- =================================================================
--- run tests to make sure users with correct privileges can load
--- and unload data. To load a table, you must:
--- be DB__ROOT
--- be granted DB__ROOTROLE
--- have the MANAGE_LOAD
--- be table owner
--- have SELECT and INSERT (DELETE for TRUNCATE option) privilege
---
--- To unload a table, you must:`
--- be DB__ROOT
--- be granted DB__ROOTROLE
--- have the MANAGE_LOAD
--- be table owner
--- have SELECT privilege
---
--- To purgedata data, you must:
--- be DB__ROOT
--- be table owner
--- have SELECT and DELETE privileges
--- =================================================================
-
-set schema t132sch;
-get tables;
-
-
--- perform a load and unload as DB__ROOT
--- purgedata
--- perform a load and unload after being granted DB__ROOTROLE
--- purgedata
--- perform a load and unload without privileges
--- perform a load and unload as table owner
--- purgedata
--- perform a load and unload with SELECT
--- perform a load and unload with SELECT, INSERT
--- purgedata, grant DELETE and purgedata again
--- perform a load (truncate) and unload with select, insert, delete
--- perform a load and unload with MANAGE_LOAD privilege
-
--- reset
-
?section test_popindex
-- =================================================================
-- run tests to make sure users that populate indexes have correct
@@ -164,6 +120,10 @@ get tables;
-- =================================================================
set schema t132sch;
+set parserflags 1;
+set parserflags 131072;
+cqd DDL_TRANSACTIONS 'ON';
+
get tables;
create table t132t1 (c1 int not null primary key, c2 int);
@@ -194,18 +154,21 @@ obey TEST132(popindex_check_reset);
sh sqlci -i "TEST132(populate_index)" -u sql_user1;
obey TEST132(popindex_check_reset);
--- if user belongs to DB__ROOTROLE, has no privilege
+-- if user belongs to DB__ROOTROLE, has DML privileges, so can populate indexes
grant role DB__ROOTROLE to sql_user2;
sh sqlci -i "TEST132(populate_index)" -u sql_user2;
+obey TEST132(popindex_check_reset);
+revoke role DB__ROOTROLE from sql_user2;
--- if user has SELECT and INSERT privileges
-grant SELECT,INSERT on t132t1 to sql_user3;
+-- sql_user3 requires both SELECT and INSERT privileges
+-- only t132t2 has granted both privileges
+grant SELECT on t132t1 to sql_user3;
grant SELECT, INSERT on t132t2 to sql_user3 by sql_user1;
+grant INSERT on t132t3 to sql_user3 by sql_user1;
sh sqlci -i "TEST132(populate_index)" -u sql_user3;
obey TEST132(popindex_check_reset);
-- reset
-revoke role DB__ROOTROLE from sql_user2;
drop table t132t1 cascade;
drop table t132t2 cascade;
drop table t132t3 cascade;
@@ -222,7 +185,6 @@ populate index t132t3_ndx1 on t132t3;
?section popindex_check_reset
set schema t132sch;
log LOG132;
-set parserflags 1;
select count(*) from table (index_table t132t1_ndx1);
select count(*) from table (index_table t132t2_ndx1);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/regress/tools/runregr_privs1.ksh
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/runregr_privs1.ksh b/core/sql/regress/tools/runregr_privs1.ksh
index 7198c90..868aaee 100755
--- a/core/sql/regress/tools/runregr_privs1.ksh
+++ b/core/sql/regress/tools/runregr_privs1.ksh
@@ -182,7 +182,7 @@ fi
# For now, don't run these tests --
# Add list of tests to script in "skipTheseTests" --
#-------------------------------------------------------
-skipTheseTests="TEST132"
+skipTheseTests=""
testfiles="$prettyfiles"
prettyfiles=
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 9a10fae..5ab446e 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -196,6 +196,8 @@ class CmpSeabaseDDL
const NABoolean ignoreIfExists,
NAString &tableNotCreated);
+ static std::vector<std::string> getHistogramTables();
+
NABoolean isAuthorizationEnabled();
short existsInHbase(const NAString &objName,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 98bc80f..8f53cc9 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -66,6 +66,7 @@
#include "PrivMgrRoles.h"
#include "ComUser.h"
#include "ComMisc.h"
+#include "CmpSeabaseDDLmd.h"
#include "hdfs.h"
void cleanupLOBDataDescFiles(const char*, int, const char *);
@@ -1061,6 +1062,19 @@ NABoolean CmpSeabaseDDL::isUserUpdatableSeabaseMD(const NAString &catName,
return FALSE;
}
+std::vector<std::string> CmpSeabaseDDL::getHistogramTables()
+{
+ Int32 numHistTables = sizeof(allMDHistInfo) / sizeof(MDTableInfo);
+ std::vector<std::string> histTables;
+ for (Int32 i = 0; i < numHistTables; i++)
+ {
+ const MDTableInfo &mdh = allMDHistInfo[i];
+ std::string tableName(mdh.newName);
+ histTables.push_back(tableName);
+ }
+ return histTables;
+}
+
ExpHbaseInterface* CmpSeabaseDDL::allocEHI(const char * server,
const char * zkPort,
NABoolean raiseError)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index 94ebf17..ca4f0be 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@ -1268,7 +1268,7 @@ void CmpSeabaseDDL::populateSeabaseIndex(
NABoolean hasPriv = TRUE;
if ( !privs->hasSelectPriv() )
{
- hasPriv == FALSE;
+ hasPriv = FALSE;
*CmpCommon::diags() << DgSqlCode( -4481 )
<< DgString0( "SELECT" )
<< DgString1( extTableName.data());
@@ -1276,12 +1276,12 @@ void CmpSeabaseDDL::populateSeabaseIndex(
if ( !privs->hasInsertPriv() )
{
- hasPriv == FALSE;
+ hasPriv = FALSE;
*CmpCommon::diags() << DgSqlCode( -4481 )
<< DgString0( "INSERT" )
<< DgString1( extTableName.data());
}
- if (hasPriv == FALSE)
+ if (!hasPriv)
{
processReturn();
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/da8dd7c8/core/sql/sqlcomp/PrivMgrMD.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/PrivMgrMD.cpp b/core/sql/sqlcomp/PrivMgrMD.cpp
index 8284306..250b5ff 100644
--- a/core/sql/sqlcomp/PrivMgrMD.cpp
+++ b/core/sql/sqlcomp/PrivMgrMD.cpp
@@ -40,6 +40,7 @@
#include "PrivMgrComponentPrivileges.h"
#include "PrivMgrObjects.h"
#include "CmpSeabaseDDLauth.h"
+#include "CmpSeabaseDDL.h"
#include "ComUser.h"
#include <set>
@@ -546,16 +547,19 @@ PrivStatus PrivMgrMDAdmin::dropMetadata (
// Call Trafodion to drop the schema cascade
+ log (__FILE__, "dropping _PRIVMGR_MD_ schema cascade", -1);
std::string schemaDDL("DROP SCHEMA IF EXISTS ");
schemaDDL += metadataLocation_;
schemaDDL += "CASCADE";
cliRC = cliInterface.executeImmediate(schemaDDL.c_str());
if (cliRC < 0)
{
+ traceMsg = "ERROR unable to drop schema cascade: ";
+ traceMsg += to_string((long long int)cliRC);
+ log(__FILE__, traceMsg, -1);
cliInterface.retrieveSQLDiagnostics(pDiags_);
retcode = STATUS_ERROR;
}
- log (__FILE__, "dropping _PRIVMGR_MD_ schema cascade", -1);
CmpSeabaseDDLrole role;
role.dropStandardRole(DB__ROOTROLE);
@@ -581,6 +585,14 @@ void PrivMgrMDAdmin::cleanupMetadata (ExeCliInterface &cliInterface)
std::string traceMsg;
log (__FILE__, "cleaning up PRIVMGR tables: ", -1);
+ // cleanup histogram tables, if they exist
+ std::vector<std::string> histTables = CmpSeabaseDDL::getHistogramTables();
+ Int32 numHistTables = histTables.size();
+ for (Int32 i = 0; i < numHistTables; i++)
+ {
+ cleanupTable(histTables[i].c_str(), cliInterface, pDiags_);
+ }
+
size_t numTables = sizeof(privMgrTables)/sizeof(PrivMgrTableStruct);
for (int ndx_tl = 0; ndx_tl < numTables; ndx_tl++)
{
[2/2] incubator-trafodion git commit: merge [TRAFODION-1832] PR 325
Add privilege regression test 132
Posted by rm...@apache.org.
merge [TRAFODION-1832] PR 325 Add privilege regression test 132
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/0918828b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/0918828b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/0918828b
Branch: refs/heads/master
Commit: 0918828b803be695e1a1302cf06fe08d28157aba
Parents: 7af82a8 da8dd7c
Author: Roberta Marton <ro...@apache.org>
Authored: Wed Feb 17 18:42:39 2016 +0000
Committer: Roberta Marton <ro...@apache.org>
Committed: Wed Feb 17 18:42:39 2016 +0000
----------------------------------------------------------------------
core/sql/regress/privs1/EXPECTED132 | 263 +++++++++++++------------
core/sql/regress/privs1/TEST132 | 60 ++----
core/sql/regress/tools/runregr_privs1.ksh | 2 +-
core/sql/sqlcomp/CmpSeabaseDDL.h | 2 +
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 14 ++
core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 6 +-
core/sql/sqlcomp/PrivMgrMD.cpp | 14 +-
7 files changed, 185 insertions(+), 176 deletions(-)
----------------------------------------------------------------------