trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmar...@apache.org
Subject [01/20] incubator-trafodion git commit: TRAFODION-1087 & TRAFODION-1671 fixes
Date Tue, 12 Jan 2016 22:47:01 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 9f00dd53b -> a331938ba


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/privs2/TEST138
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs2/TEST138 b/core/sql/regress/privs2/TEST138
new file mode 100755
index 0000000..cb58952
--- /dev/null
+++ b/core/sql/regress/privs2/TEST138
@@ -0,0 +1,347 @@
+-- ============================================================================
+-- TEST138 - tests DDL privilege checking
+--
+-- @@@ START COPYRIGHT @@@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+--
+-- @@@ END COPYRIGHT @@@
+--
+-- This tests the following commands:
+--
+--   CREATE, DROP, ALTER table
+--   CREATE, DISABLE/ENABLE, DROP index
+--   CREATE, DROP view
+--   CREATE, DROP sequence
+--
+-- Sections:
+--   clean_up - removes database setup
+--   set_up - prepares for test
+--   test_<type> - runs tests for different types (tables, views, etc)
+--   test_<type>_<user> - runs tests as a particular user
+-- ============================================================================
+
+obey TEST138(clean_up);
+obey TEST138(set_up);
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138 clear;
+obey TEST138(test_create);
+obey TEST138(test_alter);
+obey TEST138(test_view);
+obey TEST138(test_sequence);
+obey TEST138(test_drop);
+log;
+obey TEST138(clean_up);
+exit;
+
+?section clean_up
+set schema t138sch;
+drop sequence user1_seq1;
+drop sequence user1_seq2;
+-- drop database
+drop schema t138sch cascade;
+drop schema sch138c cascade;
+
+?section set_up
+-- turn off CREATE_TABLE privilege, so user1 can no longer create objs
+revoke component privilege "CREATE" on SQL_OPERATIONS from sql_user1;
+revoke component privilege CREATE_SEQUENCE on SQL_OPERATIONS from sql_user1;
+revoke component privilege "CREATE_TABLE" on SQL_OPERATIONS from sql_user1;
+revoke component privilege "CREATE_VIEW" on SQL_OPERATIONS from sql_user1;
+revoke component privilege "ALTER" on SQL_OPERATIONS from sql_user2;
+revoke component privilege "ALTER_TABLE" on SQL_OPERATIONS from sql_user2;
+revoke component privilege "DROP" on SQL_OPERATIONS from sql_user2;
+revoke component privilege DROP_SEQUENCE on SQL_OPERATIONS from sql_user2;
+revoke component privilege "DROP_VIEW" on SQL_OPERATIONS from sql_user2;
+
+?section test_create
+-- =================================================================
+-- run tests to make sure table related operations are 
+-- authorized correctly.  If a user does not have create privileges
+-- they cannot create object.  If a user has CREATE_TABLE privilege
+-- they can create and manage their objects
+-- =================================================================
+
+create private schema t138sch;
+set schema t138sch;
+get tables;
+
+-- Verify sql_user1 does not have CREATE or CREATE_TABLE privilege
+get privileges on component sql_operations for sql_user1;
+sh sqlci -i "TEST138(create_tbl)" -u sql_user1;
+
+-- turn on CREATE_TABLE privilege
+get privileges on component sql_operations for sql_user1;
+grant component privilege CREATE_TABLE on SQL_OPERATIONS to sql_user1;
+get privileges on component sql_operations for sql_user1;
+sh sqlci -i "TEST138(create_tbl)" -u sql_user1;
+-- sql_user1 cannot alter or drop
+sh sqlci -i "TEST138(alter_tbl)" -u sql_user1;
+sh sqlci -i "TEST138(drop_tbl)" -u sql_user1;
+
+get tables;
+
+obey TEST138(drop_tbl);
+
+get tables;
+
+?section test_alter
+-- =================================================================
+-- run tests to make sure table related operations are 
+-- authorized correctly.  If a user does not have an alter privilege
+-- they cannot change objects.  If a user has the appropriate alter
+-- privilege they can perform the operation
+-- =================================================================
+
+set schema t138sch;
+get tables;
+
+-- Verify sql_user2 does not have ALTER or ALTER_TABLE privilege
+get privileges on component sql_operations for sql_user2;
+
+-- create some tables
+grant component privilege CREATE_TABLE on sql_operations to sql_user1;
+sh sqlci -i "TEST138(create_tbl)" -u sql_user1;
+revoke component privilege CREATE_TABLE on sql_operations from sql_user1;
+
+-- user2 cannot alter them
+sh sqlci -i "TEST138(alter_tbl)" -u sql_user2;
+
+-- grant the ALTER privilege to user2
+grant component privilege alter_table on sql_operations to sql_user2;
+sh sqlci -i "TEST138(alter_tbl)" -u sql_user2;
+
+-- turn off the alter_table privilege but grant other alters
+-- all alter's should fail
+revoke component privilege alter_table on sql_operations from sql_user2;
+grant component privilege alter_library, alter_routine, alter_sequence, alter_view 
+on sql_operations to sql_user2;
+get component privileges on sql_operations for sql_user2;
+sh sqlci -i "TEST138(alter_tbl)" -u sql_user2;
+revoke component privilege alter_library, alter_routine, alter_sequence, alter_view 
+on sql_operations from sql_user2;
+get component privileges on sql_operations for sql_user2;
+obey TEST138(drop_tbl);
+
+-- reset
+revoke component privilege CREATE_TABLE on SQL_OPERATIONS from sql_user1;
+get privileges on component sql_operations for "PUBLIC";
+get privileges on component sql_operations for sql_user1;
+
+?section test_view
+-- =================================================================
+-- run tests to make sure view related operations are
+-- authorized correctly. 
+-- =================================================================
+
+set schema t138sch;
+get views;
+get privileges on component sql_operations for sql_user1;
+get privileges on component sql_operations for sql_user2;
+
+-- create some tables
+grant component privilege CREATE_TABLE on sql_operations to sql_user1;
+sh sqlci -i "TEST138(create_tbl)" -u sql_user1;
+revoke component privilege CREATE_TABLE on sql_operations from sql_user1;
+
+-- user1 should not be able to create any views
+sh sqlci -i "TEST138(create_view)" -u sql_user1;
+
+-- grant CREATE_VIEW privilege and try again
+grant component privilege "CREATE_VIEW" on SQL_OPERATIONS to sql_user1;
+get privileges on component sql_operations for sql_user1;
+sh sqlci -i "TEST138(create_view)" -u sql_user1;
+
+-- see if user2 can drop user1's views
+sh sqlci -i "TEST138(drop_view)" -u sql_user2;
+
+-- give user2 drop privilege and then drop
+grant component privilege drop_view on sql_operations to sql_user2;
+get privileges on component sql_operations for sql_user2;
+sh sqlci -i "TEST138(drop_view)" -u sql_user2;
+
+-- restore
+revoke component privilege DROP_VIEW on SQL_OPERATIONS from sql_user2;
+revoke component privilege CREATE_VIEW on SQL_OPERATIONS from sql_user1;
+get privileges on component sql_operations for sql_user1;
+get privileges on component sql_operations for sql_user2;
+obey TEST138(drop_tbl);
+
+?section test_sequence
+-- =================================================================
+-- run tests to make sure sequence related operations are
+-- authorized correctly.
+-- =================================================================
+
+set schema t138sch;
+get sequences in schema t138sch;
+get privileges on component sql_operations for sql_user1;
+get privileges on component sql_operations for sql_user2;
+
+-- user1 should not be able to create any sequences
+sh sqlci -i "TEST138(create_sequence)" -u sql_user1;
+
+-- grant CREATE_SEQUENCE privilege and try again
+grant component privilege "CREATE_SEQUENCE" on SQL_OPERATIONS to sql_user1;
+get privileges on component sql_operations for sql_user1;
+sh sqlci -i "TEST138(create_sequence)" -u sql_user1;
+
+-- see if user2 can drop user1's sequences
+sh sqlci -i "TEST138(drop_sequence)" -u sql_user2;
+
+-- give user2 drop privilege and then drop
+grant component privilege drop_sequence on sql_operations to sql_user2;
+get privileges on component sql_operations for sql_user2;
+sh sqlci -i "TEST138(drop_sequence)" -u sql_user2;
+
+-- restore
+revoke component privilege DROP_SEQUENCE on SQL_OPERATIONS from sql_user2;
+revoke component privilege CREATE_SEQUENCE on SQL_OPERATIONS from sql_user1;
+get privileges on component sql_operations for sql_user1;
+get privileges on component sql_operations for sql_user2;
+
+?section test_drop
+create schema sch138c;
+set schema sch138c;
+-- Setup libraries, procedures and functions
+create library t138_l1 file 'udrtest135.dll';
+
+create function t138_ADD2(int,int) returns (ADD2 int)
+language c parameter style sql external name 'add2'
+library t138_l1
+deterministic no sql final call allow any parallelism state area size 1024 ;
+-- Procedure creation not working
+--sh sh $$scriptsdir$$/tools/java-compile.ksh TEST138.java 2> LOG138-SECONDARY | tee -a LOG138;
+--sh sh $$scriptsdir$$/tools/java-archive.ksh TEST138.jar TEST138.class 2>> LOG138-SECONDARY | tee -a LOG138;
+--create procedure p138(in cmd char(1000),out status char(60))
+--language java parameter style java modifies sql data
+--external name 'TEST101.Xact' library t138_l1;
+
+create table t138 (a int not null primary key);
+create view v138 as select * from T138;
+create sequence sq138;
+
+select count (*) from TRAFODION."_MD_".OBJECTS WHERE schema_name = 'SCH138C';
+
+drop schema SCH138C;
+select count (*) from TRAFODION."_MD_".OBJECTS WHERE schema_name = 'SCH138C';
+
+drop schema SCH138C cascade;
+select count (*) from TRAFODION."_MD_".OBJECTS WHERE schema_name = 'SCH138C';
+
+?section create_tbl
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get tables;
+create table user1_t1 (c1 int not null primary key, c2 int);
+insert into user1_t1 values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7);
+select count(*) from user1_t1;
+-- add grant to allow user2 to create FK constraints
+grant references on user1_t1 to sql_user2;
+showddl user1_t1;
+
+create table user1_t2 (c1 int, c2 int);
+insert into user1_t2 values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7);
+select count(*) from user1_t2;
+showddl user1_t2;
+
+?section alter_tbl
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get tables;
+
+-- add columns, constraints, and indexes
+alter table user1_t1 add column c3 int default 0;
+alter table user1_t1 add constraint user1_ck check (c2 > 0);
+alter table user1_t1 add constraint user1_uq unique (c2);
+alter table user1_t2 add constraint user1_pk primary key (c1);
+alter table user1_t2 add constraint user1_fk foreign key (c2) references user1_t1;
+create index user1_t1_ndx on user1_t1(c2);
+alter table user1_t1 disable index user1_t1_ndx;
+create index user1_t2_ndx  on user1_t2(c2) no populate;
+alter table user1_t2 disable all indexes;
+
+showddl user1_t1;
+showddl user1_t2;
+
+-- remove indexes, constraints, and columns
+alter table user1_t1 enable index user1_t1_ndx;
+alter table user1_t2 enable all indexes;
+drop index user1_t1_ndx;
+drop index user1_t2_ndx;
+alter table user1_t1 drop constraint user1_ck;
+alter table user1_t1 drop constraint user1_uq;
+alter table user1_t2 drop constraint user1_pk;
+alter table user1_t2 drop constraint user1_fk;
+alter table user1_t1 drop column c3;
+
+showddl user1_t1;
+showddl user1_t2;
+
+alter table user1_t1 rename to user1_t4;
+select count(*) from user1_t4;
+alter table user1_t4 rename to user1_t1;
+
+?section drop_tbl
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get tables;
+drop table user1_t1 cascade;
+drop table user1_t2 cascade;
+get tables;
+
+?section create_view
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get views;
+create view user1_v1 as select * from user1_t1;
+create view user1_v2 (c1, c2) as 
+  select t1.c1, t2.c2 from user1_t1 t1, user1_t2 t2;
+get views;
+
+?section drop_view
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get views;
+drop view user1_v1;
+drop view user1_v2;
+get views;
+
+?section create_sequence
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get sequences in schema t138sch;
+create sequence user1_seq1;
+create sequence user1_seq2;
+get sequences in schema t138sch;
+
+?section drop_sequence
+set schema t138sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'on';
+log LOG138;
+get sequences in schema t138sch;
+drop sequence user1_seq1;
+drop sequence user1_seq2;
+get sequences in schema t138sch;
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/privs2/TEST139
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs2/TEST139 b/core/sql/regress/privs2/TEST139
new file mode 100755
index 0000000..6a2f354
--- /dev/null
+++ b/core/sql/regress/privs2/TEST139
@@ -0,0 +1,325 @@
+-- ============================================================================
+-- TEST139 - tests grant and revoke privileges
+--
+-- @@@ START COPYRIGHT @@@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+--
+-- @@@ END COPYRIGHT @@@
+--
+-- This tests the following commands:
+--
+--   GRANT <privilege> ON <object> TO <grantee-list>
+--   REVOKE <privilege> ON <object> FROM <grantee-list>
+--
+-- Sections:
+--   clean_up - removes database setup
+--   set_up - prepares for test
+--   tests - runs tests
+-- ============================================================================
+
+cqd CAT_ENABLE_QUERY_INVALIDATION 'OFF';
+obey TEST139(clean_up);
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
+log LOG139 clear;
+obey TEST139(set_up);
+obey TEST139(create_db);
+obey TEST139(tests);
+-- sh sqlci -i "TEST139(authorized)" -u sql_user4;
+log;
+obey TEST139(clean_up);
+exit;
+
+?section clean_up
+-- drop database
+drop schema t139sch cascade;
+
+?section create_db
+create shared schema t139sch;
+set schema t139sch;
+create table teams
+  (team_number int not null primary key,
+   team_name char(20) not null,
+   team_contact varchar(50) not null,
+   team_contact_number char (10) not null
+   )
+  ;
+
+alter table teams add constraint valid_team_no check (team_number > 0);
+
+insert into teams values
+   (1, 'White Socks', 'Sam','4082282222'),
+   (2, 'Giants', 'Joe', '5102839483'),
+   (3, 'Cardinals', 'Stella', '9513849384'),
+   (4, 'Indians', 'Matt', '5128383748'),
+   (5, 'Tigers', 'Ronit', '6198273827');
+
+create table team_statistics
+  (team_number int not null primary key,
+   num_players int not null)
+;
+
+create table games
+   ( home_team_number int not null,
+     visitor_team_number int not null,
+     game_number int not null primary key,
+     game_time timestamp not null,
+     game_location varchar(50) not null)
+  ;
+--create index home_games on games (home_team_number);
+
+alter table games add constraint valid_game_number check (game_number > 0);
+
+create table standings
+    (team_number int not null primary key,
+     wins int default 0,
+     loses int default 0,
+     last_updated timestamp default current_timestamp)
+;
+insert into standings (team_number)
+  select team_number from teams;
+
+insert into games values
+   (1, 2, 1, timestamp '2009-04-23 19:30:00', 'California'),
+   (1, 3, 2, timestamp '2009-04-24 19:30:00', 'California'),
+   (1, 4, 3, timestamp '2009-04-25 10:00:00', 'Oklahoma'),
+   (2, 3, 4, timestamp '2009-04-25 13:30:00', 'Michigan'),
+   (1, 5, 5, timestamp '2009-04-25 15:00:00', 'Oklahoma'),
+   (2, 5, 6, timestamp '2009-04-27 17:00:00', 'New York'),
+   (3, 4, 7, timestamp '2009-04-28 17:00:00', 'Florida'),
+   (4, 2, 8, current_timestamp, 'Missouri');
+
+create view home_teams_games as
+  select t.team_number, g.game_number, g.game_time
+  from "TEAMS" t,
+       "GAMES" g
+  where t.team_number = g.home_team_number
+  order by 1, game_number, game_time;
+
+create table players
+  (player_number int not null,
+   player_name varchar (50) not null,
+   player_team_number int not null,
+   player_phone_number char (10) not null,
+   player_details varchar(50),
+   primary key (player_number, player_team_number))
+  no partition;
+
+insert into players values
+   (1, 'Tom', 1, '4083948394', null),
+   (2, 'Bob', 1, '4089483948', null),
+   (3, 'Toby',1, '4082938493', 'pitcher'),
+   (3, 'Toby',2, '4082938493', null),
+   (4, 'Julie', 2, '5108394839', 'catcher'),
+   (5, 'Joanne', 2, '5103849384', null),
+   (6, 'Pete', 2, '5102839483', null),
+   (6, 'Pete', 3, '5102839483', 'third base'),
+   (7, 'Jared',4, '9518293849', 'short stop'),
+   (8, 'Zachary', 4, '9518293840', null),
+   (9, 'Lynne', 5, '9518293892', 'pitcher'),
+   (10, 'Omar', 5, '5128394893', null);
+
+alter table players add constraint valid_player_number check(player_number > 0);
+
+create view players_on_team as
+  select player_name, team_name
+  from teams t, players p
+  where p.player_team_number = t.team_number
+  order by t.team_name;
+select * from players_on_team;
+
+create view games_by_player as
+  select player_name, game_time
+  from teams t, games g, players p
+  where p.player_team_number = t.team_number and
+        t.team_number = g.home_team_number
+  order by player_name, team_number;
+
+alter table players add constraint players_teams
+   foreign key (player_team_number) references teams (team_number);
+
+insert into team_statistics
+  select team_number, count (player_number)
+   from teams t, players p
+   where t.team_number = p.player_team_number
+   group by team_number;
+
+create volatile table home_games as
+  select home_team_number, visitor_team_number, game_number,  game_location
+  from games
+    where extract(year  from games.game_time) =
+          extract(year  from current_timestamp) and
+          extract(month from games.game_time) =
+          extract(month from current_timestamp);
+
+?section set_up
+set schema "_PRIVMGR_MD_";
+prepare get_owner_privs from
+select distinct
+   substring (object_name,1,10) as object_name,
+   object_type as type,
+   substring(authname(grantee_id),1,10) as grantee,
+   privileges_bitmap,
+   grantable_bitmap
+from object_privileges 
+where grantor_id = -2
+    and object_uid in 
+     (select object_uid
+      from "_MD_".objects
+      where object_type in ('VI','BT','LB','UR')
+        and schema_name in ('_PRIVMGR_MD_', 'T139SCH'))
+  order by 1, 2
+;
+
+prepare object_privs from
+select distinct
+  object_type as type,
+  substring (grantor_name,1,10) as grantor,
+  substring (grantee_name,1,10) as grantee,
+  privileges_bitmap as privs,
+  grantable_bitmap as wgo
+from "_PRIVMGR_MD_".object_privileges
+where object_name like ?tblname 
+order by 1, 2, 3; 
+
+prepare all_privs from
+select distinct
+  object_type as type,
+  substring (object_name,1,20) as objname,
+  substring (grantor_name,1,10) as grantor,
+  substring (grantee_name,1,10) as grantee,
+  privileges_bitmap as privs,
+  grantable_bitmap as wgo
+from "_PRIVMGR_MD_".object_privileges
+where object_uid in
+   (select object_uid from "_MD_".objects
+    where schema_name in ('T139SCH'))
+ORDER BY 1, 2,3,4;
+ 
+?section tests
+-- =================================================================
+-- this set of tests run basic grant and revoke tests
+-- =================================================================
+set schema t139sch;
+
+set param ?tblname '%GAMES';
+
+-- test SELECT, UPDATE, DELETE, INSERT on games
+grant select on games to sql_user1;
+showddl games;
+-- make sure user1 can select but not other operations
+sh sqlci -i "TEST139(user1_dml)" -u sql_user1;
+
+grant update on games to sql_user1;
+showddl games;
+-- make sure user 1 can select and update but not other operations
+sh sqlci -i "TEST139(user1_dml)" -u sql_user1;
+
+grant delete, insert, references on games to sql_user1;
+showddl games;
+-- make sure user1 can do all dml
+sh sqlci -i "TEST139(user1_dml)" -u sql_user1;
+execute object_privs;
+-- this query does not always return the correct rows 
+-- execute all_privs;
+
+-- test WITH GRANT OPTION
+--grant select, insert, delete on teams to sql_user2 with grant option;
+--showddl teams;
+-- make sure user2 grant of select, insert, delete to user2 succeeds
+-- make sure user2 grant of update, references fails
+-- user2 will grant select to user3
+--sh sqlci -i "TEST139(user2_dml)" -u sql_user2;
+-- make sure user3 can select
+-- user3 will grant select to user4
+--sh sqlci -i "TEST139(user3_dml)" -u sql_user3;
+--grant update on teams to sql_user2 with grant option;
+--showddl teams;
+-- make sure user2 can grant update privilege
+--sh sqlci -i "TEST139(user2_dml)" -u sql_user2;
+-- make sure user3 can update
+--sh sqlci -i "TEST139(user3_dml)" -u sql_user3;
+-- make sure user4 can select, but not other privs
+--sh sqlci -i "TEST139(user4_dml)" -u sql_user4;
+
+-- test revoke SELECT, UPDATE, DELETE, INSERT, REFERENCES 
+
+revoke update on games from sql_user1;
+showddl games;
+revoke all_dml on games from sql_user2;
+showddl games;
+revoke all_dml on teams from sql_user3;
+showddl teams;
+
+
+?section user1_dml
+set schema t139sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
+log LOG139;
+select count(*) from games;
+update games set game_location = 'Ohio' where game_location = 'New York';
+update games set game_location = 'New York' where game_location = 'Ohio'; 
+insert into games values (4, 5, 9, current_timestamp, 'Ohio');
+select count(*) from games;
+delete from games where game_number = 9;
+select count(*) from games;
+exit;
+
+?section user2_dml
+set schema t139sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
+log LOG139;
+select count(*) from teams;
+update teams set team_contact = 'Ophelia', team_contact_number = '2344652934'
+  where team_number = 4;
+insert into teams values (6, 'Angels','Ophelia','2344652934');
+select * from teams;
+delete from teams where team_number = 6;
+update teams set team_contact = 'Matt', team_contact_number = '5128383748'
+  where team_number = 4;
+grant select on teams to sql_user3 with grant option;
+grant update on teams to sql_user3;
+showddl teams;
+
+?section user3_dml
+set schema t139sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
+log LOG139;
+select count(*) from teams;
+update teams set team_contact = 'Ophelia', team_contact_number = '2344652934'
+  where team_number = 4;
+insert into teams values (6, 'Angels','Ophelia','2344652934');
+select * from teams;
+delete from teams where team_number = 6;
+update teams set team_contact = 'Matt', team_contact_number = '5128383748'
+  where team_number = 4;
+grant select on teams to sql_user4;
+grant update on teams to sql_user4;
+
+?section user4_dml
+set schema t139sch;
+cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
+log LOG139;
+select count(*) from teams;
+update teams set team_contact = 'Ophelia', team_contact_number = '2344652934'
+  where team_number = 4;
+insert into teams values (6, 'Angels','Ophelia','2344652934');
+delete from teams where team_number = 6;
+grant select on teams to sql_user4;
+grant update on teams to sql_user4;
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/privs2/TEST140
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs2/TEST140 b/core/sql/regress/privs2/TEST140
new file mode 100755
index 0000000..153c19d
--- /dev/null
+++ b/core/sql/regress/privs2/TEST140
@@ -0,0 +1,433 @@
+-- ============================================================================
+-- TEST140 - tests initializing, dropping and upgrading privilege metadata
+--
+-- @@@ START COPYRIGHT @@@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+--
+-- @@@ END COPYRIGHT @@@
+--
+-- This tests the following commands:
+--
+--   GRANT using the WGO command
+--   REVOKE using the WGO command
+--
+-- Sections:
+--   clean_up - removes database setup
+--   set_up - prepares for test
+--   tests - runs tests
+-- ============================================================================
+
+obey TEST140(clean_up);
+log LOG140 clear;
+env;
+obey TEST140(create_db);
+obey TEST140(set_up);
+obey TEST140(tests);
+obey TEST140(revoke_tests);
+log;
+obey TEST140(clean_up);
+exit;
+
+?section clean_up
+revoke select on "_MD_".objects from sql_user1;
+revoke select on "_PRIVMGR_MD_".object_privileges from sql_user1;
+
+drop function sch.t140_translatePrivsBitmap;
+drop library sch.t140_l1;
+
+drop schema t140_user1_private cascade;
+drop schema t140_user1_shared cascade;
+drop schema t140_priv1_private cascade;
+drop schema t140_priv2_shared cascade;
+drop schema t140_shared_views cascade;
+
+revoke role priv1, priv2, priv3, priv4 from sql_user5;
+revoke role metadata_access from sql_user1, sql_user2, sql_user3,
+   sql_user4, sql_user5, sql_user6, sql_user7, sql_user8, sql_user9;
+revoke select on "_MD_".objects from metadata_access;
+revoke select on "_PRIVMGR_MD_".object_privileges from metadata_access;
+revoke select on "_MD_".auths from metadata_access;
+
+drop role priv1;
+drop role priv2;
+drop role priv3;
+drop role priv4;
+drop role metadata_access;
+
+?section create_db
+-- create roles
+create role priv1;
+create role priv2;
+create role priv3;
+create role priv4;
+create role metadata_access;
+grant role priv1, priv2, priv3, priv4 to sql_user5;
+grant role metadata_access to sql_user1, sql_user2, sql_user3,
+   sql_user4, sql_user5, sql_user6, sql_user7, sql_user8, sql_user9;
+
+grant select on "_MD_".objects to metadata_access;
+grant select on "_PRIVMGR_MD_".object_privileges to metadata_access;
+grant select on "_MD_".auths to metadata_access;
+
+create shared schema t140_shared_views;
+
+-- compile cpp program for function
+sh rm -f ./etest140.dll;
+sh sh $$scriptsdir$$/tools/dll-compile.ksh etest140.cpp
+  2>&1 | tee LOG140-SECONDARY;
+set pattern $$DLL$$ etest140.dll;
+set pattern $$QUOTE$$ '''';
+
+-- create the library and udf
+set schema sch;
+create library t140_l1 file $$QUOTE$$ $$REGRRUNDIR$$/$$DLL$$ $$QUOTE$$ ;
+create function t140_translatePrivsBitmap(bitmap largeint) returns (bitmap_string char (20))
+language c parameter style sql external name 'translateBitmap'
+library t140_l1
+deterministic no sql final call allow any parallelism state area size 1024 ;
+grant execute on function sch.t140_translatePrivsBitmap to "PUBLIC";
+ 
+-- private schema owned by sql_user1
+create schema t140_user1_private authorization sql_user1;
+set schema t140_user1_private;
+obey TEST140(create_tables);
+get tables in schema t140_user1_private;
+
+
+-- shared schema owned by sql_user5
+--create shared schema t140_user1_shared authorization sql_user5;
+--set schema t140_user5_shared;
+--obey TEST140(create_tables);
+--get tables in schema t140_user5_shared;
+
+-- private schema owned by role priv1
+--create private schema t140_priv1_private authorization priv1;
+--set schema t140_priv1_private;
+--obey TEST140(create_tables);
+--get tables in schema t140_priv1_private;
+
+-- shared schema owner by role priv2
+--create shared schema t140_priv2_shared authorization priv2;
+--set schema t140_priv2_shared;
+--obey TEST140(create_tables);
+--get tables in schema t140_priv2_shared;
+
+?section create_tables
+
+-- Creates and loads three tables:  teams, games, players
+-- All tables have a check constraint (other than NOT NULL)
+-- Table games has an index
+-- Table players has a RI contraint referencing teams
+-- A view exists between games & teams
+
+create table teams
+  (team_number int not null primary key,
+   team_name char(20) not null,
+   team_contact varchar(50) not null,
+   team_contact_number char (10) not null
+   )
+  ;
+
+alter table teams add constraint valid_team_no check (team_number > 0);
+
+insert into teams values
+   (1, 'White Socks', 'Sam','4082282222'),
+   (2, 'Giants', 'Joe', '5102839483'),
+   (3, 'Cardinals', 'Stella', '9513849384'),
+   (4, 'Indians', 'Matt', '5128383748'),
+   (5, 'Tigers', 'Ronit', '6198273827');
+
+create table games
+   ( home_team_number int not null,
+     visitor_team_number int not null,
+     game_number int not null primary key,
+     game_time timestamp not null,
+     game_location varchar(50) not null)
+  ;
+create index home_games on games (home_team_number);
+
+alter table games add constraint valid_game_number check (game_number > 0);
+
+insert into games values
+   (1, 2, 1, timestamp '2009-04-23 19:30:00', 'California'),
+   (1, 3, 2, timestamp '2009-04-24 19:30:00', 'California'),
+   (1, 4, 3, timestamp '2009-04-25 10:00:00', 'Oklahoma'),
+   (2, 3, 4, timestamp '2009-04-25 13:30:00', 'Michigan'),
+   (1, 5, 5, timestamp '2009-04-25 15:00:00', 'Oklahoma'),
+   (2, 5, 6, timestamp '2009-04-27 17:00:00', 'New York'),
+   (3, 4, 7, timestamp '2009-04-28 17:00:00', 'Florida'),
+   (4, 2, 8, current_timestamp, 'Missouri');
+
+create view t140_shared_views.home_team_games as
+  select t.team_number, g.game_number, g.game_time
+  from "TEAMS" t,
+       "GAMES" g
+  where t.team_number = g.home_team_number
+  order by 1, game_number, game_time;
+grant select on t140_shared_views.home_team_games to sql_user1 with grant option;
+
+create table players
+  (player_number int not null,
+   player_name varchar (50) not null,
+   player_team_number int not null,
+   player_phone_number char (10) not null,
+   player_details varchar(50),
+   primary key (player_number, player_team_number))
+  no partition;
+
+alter table players add constraint valid_player_number check(player_number > 0);
+
+alter table players add constraint players_teams
+   foreign key (player_team_number) references teams (team_number);
+
+insert into players values
+   (1, 'Tom', 1, '4083948394', null),
+   (2, 'Bob', 1, '4089483948', null),
+   (3, 'Toby',1, '4082938493', 'pitcher'),
+   (3, 'Toby',2, '4082938493', null),
+   (4, 'Julie', 2, '5108394839', 'catcher'),
+   (5, 'Joanne', 2, '5103849384', null),
+   (6, 'Pete', 2, '5102839483', null),
+   (6, 'Pete', 3, '5102839483', 'third base'),
+   (7, 'Jared',4, '9518293849', 'short stop'),
+   (8, 'Zachary', 4, '9518293840', null),
+   (9, 'Lynne', 5, '9518293892', 'pitcher'),
+   (10, 'Omar', 5, '5128394893', null);
+
+?section set_up
+prepare get_privs from
+select distinct
+   substring (object_name,1,40) as object_name,
+   object_type as type,
+   substring(authname(grantor_id),1,10) as grantor,
+   substring(authname(grantee_id),1,10) as grantee,
+   sch.t140_translatePrivsBitmap(privileges_bitmap) as granted_privs,
+   sch.t140_translatePrivsBitmap(grantable_bitmap) as grantable_privs
+from "_PRIVMGR_MD_".object_privileges 
+where object_uid in 
+     (select object_uid
+      from "_MD_".objects
+      where schema_name like 'T140_%')
+  order by 1, 2, 3, 4, 5
+;
+
+?section tests
+values (user);
+
+-- user1 owns everything, start of by doing initial grants
+sh sqlci -i "TEST140(user1_cmds)" -u sql_user1;
+
+-- Go see what user2, user3, user4 and user5 can do
+sh sqlci -i "TEST140(user2_cmds)" -u sql_user2;
+sh sqlci -i "TEST140(user3_cmds)" -u sql_user3;
+sh sqlci -i "TEST140(user4_cmds)" -u sql_user4;
+sh sqlci -i "TEST140(user5_cmds)" -u sql_user5;
+
+?section user1_cmds
+obey TEST140(set_up);
+log LOG140;
+values (user);
+set schema t140_user1_private;
+
+grant select on games to sql_user2;
+
+-- grants to handle table requests
+grant all on teams to sql_user2 with grant option;
+grant select, insert on players to sql_user2 with grant option;
+
+-- grants to handle view requests
+grant select on t140_shared_views.home_team_games to sql_user2;
+
+obey TEST140(set_up);
+execute get_privs;
+
+?section user2_cmds
+log LOG140;
+values (user);
+set schema t140_user1_private;
+
+-- user2 has insert privilege on teams and players
+insert into teams values (6, 'Mets', 'Harry', '8007218888');
+insert into players values (11, 'Barry', 3, '2342342345', 'left field');
+
+-- user2 does not have insert privilege on games
+insert into games values (5,6,9, current_timestamp, 'Michigan');
+
+-- user2 can select from all tables
+select count(*) from teams;
+select count(*) from games;
+select count(*) from players;
+
+-- user2 can select from home_team_games
+select team_number, game_number from t140_shared_views.home_team_games;
+
+-- user2 can create a view that spans all tables
+create view t140_shared_views.games_by_player as
+  select player_name, game_time
+  from teams t, games g, players p
+  where p.player_team_number = t.team_number and
+        t.team_number = g.home_team_number
+  order by player_name, team_number;
+select distinct player_name from t140_shared_views.games_by_player order by 1;
+
+-- user2 cannot propagate select privilege on games
+grant select on games to sql_user3;
+
+-- user2 can propagate all privileges on teams
+grant select, delete on teams to sql_user3 with grant option;
+
+-- user2 can propagate select and insert privilege on players
+grant select on players to sql_user3;
+grant insert on players to sql_user3 with grant option;
+
+obey TEST140(set_up);
+execute get_privs;
+
+?section user3_cmds
+obey TEST140(set_up);
+log LOG140;
+values (user);
+set schema t140_user1_private;
+
+-- user3 cannot select from games
+select count(*) from games;
+
+-- user3 can select from teams and players
+select count(*) from teams;
+select count(*) from players;
+
+-- user3 can create a view between teams and players
+create view t140_shared_views.players_on_team as
+  select player_name, team_name
+  from teams t, players p
+  where p.player_team_number = t.team_number
+  order by t.team_name;
+select * from t140_shared_views.players_on_team;
+
+-- user3 cannot select from view games_by_player or home_team_games;
+select * from t140_shared_views.games_by_player;
+select team_number, game_number from t140_shared_views.home_team_games;
+
+-- user3 can delete from teams;
+delete from teams where team_number = 6;
+
+-- user3 cannot insert into teams
+insert into teams values (6, 'Mets', 'Harry', '8007218888');
+
+-- user3 cannot propagate select on table games
+grant select on games to sql_user4;
+
+-- user3 can propagate select but no insert on table teams
+grant select, insert on teams to sql_user4;
+
+-- user3 can propagate insert on table players
+grant insert on players to sql_user4;
+
+execute get_privs;
+
+?section user4_cmds
+obey TEST140(set_up);
+log LOG140;
+values (user);
+set schema t140_user1_private;
+
+-- user4 cannot select from games or players
+select count(*) from games;
+select count(*) from players;
+
+-- user4 can create a view on teams;
+create view t140_shared_views.team_names as
+select team_name from teams;
+
+-- user4 cannot select from other views
+select * from t140_shared_views.players_on_team;
+
+-- user4 can select from teams;
+select count(*) from teams;
+
+-- user3 has insert privilege into players but not references for the 
+-- associated RI constraint
+insert into players values (12, 'Aaron', 4, '3453453456', 'right field');
+
+--user4 cannot grant any privileges
+grant select on teams to sql_user5;
+grant insert on players to sql_user5;
+
+execute get_privs;
+
+?section user5_cmds
+log LOG140;
+values (user);
+obey TEST140(set_up);
+set schema t140_user1_private;
+
+-- user 5 has no privs
+select count(*) from teams;
+
+?section revoke_tests
+set schema t140_user1_private;
+
+-- set up grant tree
+--  user1 grants select, insert WGO to user2
+--     user2 grants select, insert WGO to user3 
+--        user3 grants select to user4 and user5 
+--     user2 grants select WGO to user4
+--        user4 grants select WGO to user5
+--           user5 grants to user6
+--     user2 grants insert to user4 
+--  user1 grants select, insert to user4
+
+-- owner (user1) grants
+grant select, insert on games to sql_user2 with grant option;
+grant select, insert on games to sql_user4;
+
+-- user2 grants
+grant select, insert on games to sql_user3 with grant option by sql_user2;
+grant select on games to sql_user4 with grant option by sql_user2;
+grant insert on games to sql_user4 by sql_user2;
+
+-- user3 grants
+grant select on games to sql_user4 granted by sql_user3;
+grant select on games to sql_user5 with grant option granted by sql_user3;
+
+-- user4 grants
+grant select on games to sql_user5 with grant option granted by sql_user4;
+
+-- user5 grante
+grant select on games to sql_user6 by sql_user5;
+execute get_privs;
+
+-- user6 tries to grant select to user7
+grant select on games to sql_user7 by sql_user6;
+
+-- user5 tries to grant to user2 (circular)
+grant select on games to sql_user2 by sql_user5;
+
+-- user2 tries to remove WGO from user3, 
+-- fails because of user3->user4 and user3->user5 grants
+revoke grant option for select on games from sql_user3 by sql_user2;
+
+-- remove user3->user5 grant
+revoke select on games from sql_user4 by sql_user3;
+revoke grant option for select on games from sql_user3 by sql_user2;
+revoke select on games from sql_user5 by sql_user3;
+revoke grant option for select on games from sql_user3 by sql_user2;
+
+execute get_privs;
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/privs2/etest140.cpp
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs2/etest140.cpp b/core/sql/regress/privs2/etest140.cpp
new file mode 100644
index 0000000..45416bd
--- /dev/null
+++ b/core/sql/regress/privs2/etest140.cpp
@@ -0,0 +1,98 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bitset>
+#include "sqludr.h"
+
+extern "C" {
+
+/* TRANSLATEBITMAP */
+SQLUDR_LIBFUNC SQLUDR_INT32 translateBitmap(SQLUDR_INT32 *in1,
+                                            SQLUDR_CHAR *out,
+                                            SQLUDR_INT16 *in1Ind,
+                                            SQLUDR_INT16 *outInd,
+                                            SQLUDR_TRAIL_ARGS)
+{
+  enum UDR_PRIVILEGE { SELECT_PRIV = 0,
+                       INSERT_PRIV,
+                       DELETE_PRIV,
+                       UPDATE_PRIV,
+                       USAGE_PRIV,
+                       REFERENCES_PRIV,
+                       EXECUTE_PRIV };
+
+  if (calltype == SQLUDR_CALLTYPE_FINAL)
+    return SQLUDR_SUCCESS;
+
+  std::string result;
+  if (*in1Ind == SQLUDR_NULL)
+  {
+    *outInd = SQLUDR_NULL;
+  }
+  else
+  {
+    std::bitset<7> privs;
+    privs = *in1;
+    if (privs.none())
+      result = "NONE";
+    else
+    {
+      if (privs.test(SELECT_PRIV))
+        result += "S";
+      else
+        result += '-';
+      if (privs.test(INSERT_PRIV))
+        result += "I";
+      else
+        result += '-';
+      if (privs.test(DELETE_PRIV))
+        result += "D";
+      else
+        result += '-';
+      if (privs.test(UPDATE_PRIV))
+        result += "U";
+      else
+        result += '-';
+      if (privs.test(USAGE_PRIV))
+        result += "G";
+      else
+        result += '-';
+      if (privs.test(REFERENCES_PRIV))
+        result += "R";
+      else
+        result += '-';
+      if (privs.test(EXECUTE_PRIV))
+        result += "E";
+      else
+        result += '-';
+    }
+  }
+
+  strcpy(out, result.c_str());
+  return SQLUDR_SUCCESS;
+}
+
+
+} /* extern "C" */

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/privs2/udrtest135.cpp
----------------------------------------------------------------------
diff --git a/core/sql/regress/privs2/udrtest135.cpp b/core/sql/regress/privs2/udrtest135.cpp
new file mode 100644
index 0000000..3c9ee80
--- /dev/null
+++ b/core/sql/regress/privs2/udrtest135.cpp
@@ -0,0 +1,55 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+
+#include "sqludr.h"
+
+using namespace tmudr;
+
+class Sessionize : public UDR
+{
+public:
+
+  // override the runtime method
+  void processData(UDRInvocationInfo &info,
+                   UDRPlanInfo &plan);
+};
+
+extern "C" UDR * SESSIONIZE()
+{
+  return new Sessionize();
+}
+
+void Sessionize::processData(UDRInvocationInfo &info,
+                             UDRPlanInfo &plan)
+{
+  // this is just a dummy implementation, the test
+  // does not rely on the generated results
+
+  // loop over input rows
+  while (getNextRow(info))
+  {
+    info.out().setString(0, "userid");
+    info.out().setLong(1, 999);
+    info.out().setLong(2, 9999);
+
+    emitRow(info);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/tools/runallsb
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/runallsb b/core/sql/regress/tools/runallsb
index d8a5585..863392d 100755
--- a/core/sql/regress/tools/runallsb
+++ b/core/sql/regress/tools/runallsb
@@ -41,7 +41,7 @@ export SQLMX_REGRESS=1
 
 export SEABASE_REGRESS=2
 
-TEST_SUBDIRS="core compGeneral executor seabase fullstack2 charsets qat catman1 udr hive" 
+TEST_SUBDIRS="core compGeneral executor seabase fullstack2 charsets qat privs1 privs2 udr hive" 
 
 #
 # Make sure we're running from the regress subdir
@@ -174,8 +174,14 @@ for dir in $TEST_SUBDIRS; do
          ./runregr -sb $diffStr
          popd
          ;;
-     catman1)
-         pushd catman1
+     privs1)
+         pushd privs1
+         echo "runregr -sb $diffStr"
+         ./runregr -sb $diffStr
+         popd
+         ;;
+     privs2)
+         pushd privs2
          ./runregr -sb $diffStr
          popd
          ;;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/tools/runregr
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/runregr b/core/sql/regress/tools/runregr
index ecbb027..fdd93a2 100755
--- a/core/sql/regress/tools/runregr
+++ b/core/sql/regress/tools/runregr
@@ -31,12 +31,11 @@
 
 # Set defaults: MX-format tables; sequential execution
 sqlmxtbls=1
-table_format='mx'
+table_format='sb'
 ssd='../tools'
 concurrent_execution=0
 exclusive_execution=0
 log_qualifier=
-compress_on=0
 diffs=0
 
 # Parse command line options.  Options must appear on the command line before
@@ -61,11 +60,6 @@ while [ "$#" -gt 0 ]; do
       shift
       ;;
 
-    -compress)
-      compress_on=1
-      shift
-      ;;
-
     -diff)
       diffs=1
       shift
@@ -86,32 +80,21 @@ if [ "$diffs" -eq 1 -a "$table_format" == "sb" ]; then
   export SEABASE_REGRESS_DIFFS=1
 fi
 
-# Override the -compress option with the SQ_FILE_COMPRESSION envvar
-# if SQ_FILE_COMPRESSION is set, the compress_on is TRUE
-if [ $SQ_FILE_COMPRESSION ]; then
-  compress_on=1
-  echo "Running with file compression turned on"
-fi
-
-  export SQLMX_REGRESS=1
-  export SQLMX_NAMETYPE=ANSI
-  echo "Running regressions against MX format objects"
-
-echo ""
+export SQLMX_REGRESS=1
+export SQLMX_NAMETYPE=ANSI
+echo "***** Running SQL regressions *****"
 
 $REGR_PREOP		# you can set this envvar to any command you like
 			# e.g.  export REGR_PREOP="cp $HOME/setupnskenv $RGRT"
 
+export NULL=/dev/null
 export NSK=0
-export LINUX=0
-export WIN=0
-
-    LINUX=1
-    if [ "$scriptsdir" != "" ]; then
-      pushd $scriptsdir/tools
-      . ./setuplnxenv
-      popd
-    fi
+export LINUX=1
+if [ "$scriptsdir" != "" ]; then
+  pushd $scriptsdir/tools > $NULL 
+  . ./setuplnxenv
+  popd > $NULL
+fi
 
 if [ -r $ssd/setupenv ]; then	# second, generic pan-platform setup
   . $ssd/setupenv
@@ -122,38 +105,35 @@ fi
 test "$scriptsdir" = "" && echo Scripts root dir env var \$scriptsdir not set. && exit 1
 test "$rundir" = "" && echo Run root dir env var \$rundir not set. && exit 1
 
-    export mxcmpdir=${mxcmpdir:-$arkcmpdir}
-    export NULL=/dev/null
-    export TEMP=${TMP:-${TEMP:-$rundir/tmp}}
-    test -f $TEMP -a ! -d $TEMP && TEMP=$rundir/tmpdir
-    test ! -d $TEMP && mkdir -p $TEMP
-    test ! -d $TEMP -o ! -w $TEMP && TEMP=/tmp
-
-    if [ ! -e $scriptsdir/tools/logsort_linux.exe ]; then
-	if [ "$scriptsdir/tools/logsort_src" != "" ]; then
-	    pushd $scriptsdir/tools/logsort_src
-	    sh makeit_linux.ksh
-	    popd
-	    mv -f $scriptsdir/tools/logsort_src/logsort.exe $scriptsdir/tools/logsort_linux.exe
-	fi
-    fi
-
-    export LOGSORT=$scriptsdir/tools/logsort_linux.exe
-    export  FILTER=$scriptsdir/tools/regress-filter-linux
-
-    # ln -sf $MY_SQROOT/sql/regress/tools/sqimport $MY_SQROOT/export/bin${SQ_MBTYPE}/import
-
-    export MAKEPARAMS="$mxcmpdir $mxcidir"
-    export MAKEOBJTYP=o
-    export mxci=$mxcidir/sqlci
-    export mxcmp=$mxcmpdir/tdm_arkcmp
-    export mxudr=$mxcmpdir/tdm_udrserv
-    export javahome=${JAVA_HOME}
-    export java=$javahome/bin/java
-    export javac=$javahome/bin/javac
-    export jar=$javahome/bin/jar
-    export NSK_SYS=NSK
-    linuxinit=$scriptsdir/tools/linuxinit
+export mxcmpdir=${mxcmpdir:-$arkcmpdir}
+export TEMP=${TMP:-${TEMP:-$rundir/tmp}}
+test -f $TEMP -a ! -d $TEMP && TEMP=$rundir/tmpdir
+test ! -d $TEMP && mkdir -p $TEMP
+test ! -d $TEMP -o ! -w $TEMP && TEMP=/tmp
+
+if [ ! -e $scriptsdir/tools/logsort_linux.exe ]; then
+  if [ "$scriptsdir/tools/logsort_src" != "" ]; then
+    pushd $scriptsdir/tools/logsort_src > $NULL
+    sh makeit_linux.ksh
+    popd > $NULL
+    mv -f $scriptsdir/tools/logsort_src/logsort.exe $scriptsdir/tools/logsort_linux.exe
+  fi
+fi
+
+export LOGSORT=$scriptsdir/tools/logsort_linux.exe
+export  FILTER=$scriptsdir/tools/regress-filter-linux
+
+export MAKEPARAMS="$mxcmpdir $mxcidir"
+export MAKEOBJTYP=o
+export mxci=$mxcidir/sqlci
+export mxcmp=$mxcmpdir/tdm_arkcmp
+export mxudr=$mxcmpdir/tdm_udrserv
+export javahome=${JAVA_HOME}
+export java=$javahome/bin/java
+export javac=$javahome/bin/javac
+export jar=$javahome/bin/jar
+export NSK_SYS=NSK
+linuxinit=$scriptsdir/tools/linuxinit
 
 # export synonyms for convenience
 export sqlci=$mxci
@@ -171,7 +151,6 @@ export REGRTOOLSDIR=$scriptsdir/tools
 
 export REGRCONCURRENT="$concurrent_execution"
 export REGREXCLUSIVE="$exclusive_execution"
-export REGRCOMPRESS="$compress_on"
 
 # setup up make file script, same for mx and mp
 export MAKESCRIPT=$scriptsdir/tools/makefileall.ksh
@@ -198,91 +177,6 @@ test ! -x $FILTER && chmod +rwx $FILTER		# ensure we can run it
 $FILTER $NULL					# run it (emits errmsg if bad)
 test $? -ne 0 && echo && echo "ERROR: Your copy of $FILTER is broken." && exit 1
 
-  export SQLUSER1=sql_user1
-  export SQLUSER2=sql_user2
-  export SQLUSER3=sql_user3
-  export SQLUSER4=sql_user4
-  export SQLUSER5=sql_user5
-  export SQLUSER6=sql_user6
-  export SQLUSER7=sql_user7
-  export SQLUSER8=sql_user8
-  export SQLUSER9=sql_user9
-  export SQLUSER10=sql_user10
-  export ROLEMGR=role_mgr
-  export SQLUSER1X=$SQLUSER1
-  export SQLUSER2X=$SQLUSER2
-  export SQLUSER3X=$SQLUSER3
-  export SQLUSER4X=$SQLUSER4
-  export SQLUSER5X=$SQLUSER5
-  export SQLUSER6X=$SQLUSER6
-  export SQLUSER7X=$SQLUSER7
-  export SQLUSER8X=$SQLUSER8
-  export SQLUSER9X=$SQLUSER9
-  export SQLUSER10X=$SQLUSER10
-  export ROLEMGRX=$ROLEMGR
-
-# adding quotes around the user name still causes some tests to fail
-# like perhaps executor/test016
-  export SQLUSER1Q=$SQLUSER1
-  export SQLUSER2Q=\"$SQLUSER2\"
-  export SQLUSER3Q=\"$SQLUSER3\"
-  export SQLUSER4Q=\"$SQLUSER4\"
-  export SQLUSER5Q=\"$SQLUSER5\"
-  export SQLUSER6Q=\"$SQLUSER6\"
-  export SQLUSER7Q=\"$SQLUSER7\"
-  export SQLUSER8Q=\"$SQLUSER8\"
-  export SQLUSER9Q=\"$SQLUSER9\"
-  export SQLUSER10Q=\"$SQLUSER10\"
-  export ROLEMGRQ=\"$ROLEMGR\"
-
-if [ $nsk -eq 1 ]; then
- # Verify user accounts exist on NSK
-  bad=0
-  i=1
-  while test $i -lt 11
-  do
-    # The comma after the user-name below specifies the (empty) password
-    # Without the comma, running this script as an alias user (i.e., not as
-    #   super.super) would prompt for a password
-    su SQL.USER$i, -c exit
-    if
-      test $? -eq 1
-    then
-      echo SQL.USER$i not found
-      let bad=1
-    fi
-    let i=$i+1
-  done
-  # Verify role.mgr account exist on NSK
-  gtacl -s -c 'safecom info user ROLE.MGR' | grep THAWED > /dev/null
-  if
-    test $? -eq 1
-  then
-    echo ROLE.MGR not found
-    let bad=1
-  fi
-  if
-    test $bad -eq 1
-  then
-    echo "One or more User Ids are not set up on this machine!! "
-    echo "Create the missing User Ids before running security tests."
-  fi
-elif [ $LINUX -eq 1 -a -z "$SEABASE_REGRESS" ]; then
-  # Make sure users required by tests have been registered in the database
-  if [ -e $scriptsdir/tools/reg_users.log ]; then
-    rm $scriptsdir/tools/reg_users.log
-  fi
-  sqlci -i $scriptsdir/tools/reg_users.sql > $scriptsdir/tools/reg_users.log 2>&1
-  # error 1334 (Object already exists) is the only error that is okay to get
-  grep 'ERROR\['  $scriptsdir/tools/reg_users.log | grep -v 'ERROR\[1334\]'
-  if [[ $? -ne 1 ]]; then
-     echo ""
-     echo "Unexpected error registering users.  See $scriptsdir/tools/reg_users.log"
-     echo ""
-     exit 1
-  fi
-fi
-
 flavor1=
 if [ "$diffs" -ne 1 -o "$table_format" != "sb" ]; then
   echo 'select TESTEXIT;' > $tmplocal.flavor.tmp
@@ -305,29 +199,29 @@ if [ ! -f $tool ]; then
   tool=$scriptsdir/tools/runregr_other.ksh
 fi
 if [ "$diffs" -eq 1 ]; then
-  echo "$tool -diff $*"
+  echo "Command requested: $tool -diff $*"
 else
-  echo "$tool $*"
+  echo "Command requested: $tool $*"
 fi
-echo "$BUILD_FLAVOR_TEXT"
+echo "Build flavor is: $BUILD_FLAVOR_TEXT"
 export PATH="$scriptsdir/tools:$PATH"
 
 # Create the FilteredLogs directory
 FilteredLogs=$scriptsdir/FilteredLogs
 if [ ! -d "$FilteredLogs" ]; then
-echo "Creating directory $FilteredLogs"
-mkdir $FilteredLogs
+  echo "Creating directory $FilteredLogs"
+  mkdir $FilteredLogs
 fi
 
-	if [ ! -d "$FilteredLogs/win" ]; then
-	echo "Creating directory $FilteredLogs/win"
-	mkdir $FilteredLogs/win
-	fi
-	FilteredLogs=$FilteredLogs/win
+if [ ! -d "$FilteredLogs/win" ]; then
+  echo "Creating directory $FilteredLogs/win"
+  mkdir $FilteredLogs/win
+fi
+FilteredLogs=$FilteredLogs/win
 
 if [ ! -d "$FilteredLogs/$REGRBASDIR" ]; then
-echo "Creating directory $FilteredLogs/$REGRBASDIR"
-mkdir $FilteredLogs/$REGRBASDIR
+  echo "Creating directory $FilteredLogs/$REGRBASDIR"
+  mkdir $FilteredLogs/$REGRBASDIR
 fi
 export FilteredLogs="$FilteredLogs/$REGRBASDIR"
 
@@ -337,22 +231,20 @@ rm -f core dumpfile sh_histo ZZSA*
 
 #Establish log, exp and bsl directories
 if [ ! -d "$FilteredLogs/logfiles" ]; then
-echo "Creating directory $FilteredLogs/logfiles"
-mkdir $FilteredLogs/logfiles
+  echo "Creating directory $FilteredLogs/logfiles"
+  mkdir $FilteredLogs/logfiles
 fi
 if [ ! -d "$FilteredLogs/expfiles" ]; then
-echo "Creating directory $FilteredLogs/expfiles"
-mkdir $FilteredLogs/expfiles
+  echo "Creating directory $FilteredLogs/expfiles"
+  mkdir $FilteredLogs/expfiles
 fi
-echo "FilteredLogs:   $FilteredLogs"
+echo "Using the following directory for filtered logs:   $FilteredLogs"
 
 if [ "$diffs" -eq 1 ]; then
-  echo "Running tool with -diff $*"
-  echo "$tool -diff $*"
+  echo "Command executed: $tool -diff $*"
   $tool -diff $*
 else
-   echo "Running tool with $*"
-  echo "$tool $*"
+  echo "Command executed: $tool $*"
   $tool $*
 fi
 
@@ -375,3 +267,4 @@ fi
 
 $REGR_POSTOP		# you can set this envvar to any command you like
 			# e.g.  export REGR_POSTOP="$HOME/bin/rgrCleanup"
+echo "***** Done running regressions *****"

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/tools/runregr_core.ksh
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/runregr_core.ksh b/core/sql/regress/tools/runregr_core.ksh
index 14e657b..bd1c885 100755
--- a/core/sql/regress/tools/runregr_core.ksh
+++ b/core/sql/regress/tools/runregr_core.ksh
@@ -221,7 +221,7 @@ fi
 
 # sbtestfiles contains the list of tests to be run in seabase mode
 if [ "$seabase" -ne 0 ]; then
-  sbtestfiles="TEST000 TEST001 TEST002 TEST004 TEST005 TEST008 TEST010 TEST018 TEST019 TEST020 TEST027 TEST029 TEST032 TEST037 TEST038 TEST041 TEST056 TEST061 TEST116 TESTRTS TEST162"
+  sbtestfiles="TEST000 TEST001 TEST002 TEST004 TEST005 TEST008 TEST010 TEST018 TEST019 TEST020 TEST027 TEST029 TEST032 TEST037 TEST038 TEST041 TEST056 TEST061 TEST116 TESTRTS TEST131 TEST162"
   sbprettyfiles=
   for i in $prettyfiles; do
     for j in $sbtestfiles; do

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/tools/setupenv
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/setupenv b/core/sql/regress/tools/setupenv
index 27a18e6..154182f 100755
--- a/core/sql/regress/tools/setupenv
+++ b/core/sql/regress/tools/setupenv
@@ -19,6 +19,8 @@
 #
 # @@@ END COPYRIGHT @@@
 
+# If running test from a regress directory and SQLMX_REGRESS is not set, 
+# assume SQLMX_REGRESS is 1.
 if [ "$SQLMX_REGRESS" = "" ]; then
   export SQLMX_REGRESS=0
   pwd=`echo $PWD | tr A-Z a-z`
@@ -29,16 +31,7 @@ if [ "$SQLMX_REGRESS" = "" ]; then
   fi
 fi
 
-unset USEUNIXFS
-
-# Set these ONLY if not already set.
-#
-if [   "$VOLUME" = "" ]; then
-  test `uname` = "SunOS" &&
-  export VOLUME=\$DATA
-fi
-
-# Set these if not already set OR if we're in a runrgr|runqat|run* script.
+# Set these if not already set OR if we're in a run* script.
 #
 if [   "$SQL_ERROR_MSGBOX" = ""	-o $SQLMX_REGRESS -ne 0 ]; then
   export SQL_ERROR_MSGBOX=0				# no popup!
@@ -50,7 +43,7 @@ if [   "$YYERROR_QUIET" = ""	-o $SQLMX_REGRESS -ne 0 ]; then
   export YYERROR_QUIET=1				# quiet yacc!
 fi
 
-# Set these ONLY if we're in a runrgr|runqat|run* script.
+# Set these ONLY if we're in a run* script.
 #
 if [ $SQLMX_REGRESS -ne 0 ]; then
 
@@ -59,20 +52,8 @@ if [ $SQLMX_REGRESS -ne 0 ]; then
   export SQL_MXCI_CASE_INSENSITIVE_LOG='U'		# force Uppercase LOG ..
   export SQL_MXCI_CASE_INSENSITIVE_OBEY='U'		# ..and OBEY file names
 
-  # (When not in REGRESS, for this you should use the standard
-  # DEFAULTS table standard mechanism, e.g. by doing, once only:
-  #	OBEY init_sql_dev(NADefaults);  )
-  #
-  if [ "$SQLMX_NAMETYPE" != "NSK" ]; then
-    schema=${TEST_SCHEMA:-'cat.sch'}
-    export SQL_MXCI_INITIALIZATION="set schema $schema"
-  else
-    loc=`echo $NSK_VOL.$NSK_SUBVOL | sed -e 's/^\.//' -e 's/\.$//'`
-    export SQL_MXCI_INITIALIZATION="set mploc $loc"
-  fi
-
-  test "$scriptsdir" = "" && export scriptsdir=W:/regress
-  test "$rundir"     = "" && export rundir=W:/regress
+  test "$scriptsdir" = "" && export scriptsdir=$MY_SQROOT/../sql/regress
+  test "$rundir"     = "" && export rundir=$MY_SQROOT/../sql/regress/rundir
 
   dbgvars=`env | grep -i -e _DEBUG -e SQLMX_REGRESS_JAVA`
   if [ "$dbgvars" != "" ]; then
@@ -86,24 +67,3 @@ if [ $SQLMX_REGRESS -ne 0 ]; then
   fi
 
 fi
-
-#
-# modify values below to match w:/common/ComVersionDefs.h whenever you make a version
-# number change.
-
-export VERS_CURR_MXV=2600
-export VERS_CURR_SCHEMA_VERSION=2600
-export VERS_CURR_SYSTEM_SCHEMA_VERSION=2600
-export VERS_CURR_PLAN_VERSION=2600
-
-export VERS_OSMXV=2600                # Oldest supported mxv
-export VERS_OSSV=2400                 # Oldest supported schema version for ugdg
-export VERS_OSSSV=2400                # Oldest supported system schema version for ugdg
-export VERS_OSPV=2600                 # Oldest supported plan version
-
-export VERS_FAKE_UPREV_MXV=3000
-export VERS_FAKE_OSMXV=3000           # Oldest supported mxv
-export VERS_FAKE_OSSV=2400            # Oldest supported schema version
-export VERS_FAKE_OSPV=3000            # Oldest supported plan version
-
-export SYSMOD_SUFFIX=N29_000          # The system module suffix

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3d65c15/core/sql/regress/tools/setuplnxenv
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/setuplnxenv b/core/sql/regress/tools/setuplnxenv
index 85527be..843a089 100755
--- a/core/sql/regress/tools/setuplnxenv
+++ b/core/sql/regress/tools/setuplnxenv
@@ -38,6 +38,9 @@ export USE_THREADED_IO=${USE_THREADED_IO:-1}
 export SQ_BUILD_TYPE=${SQ_BUILD_TYPE:-debug}
 export LC_ALL=en_US
 
+echo ""
+echo "Setting up regression environment for Linux"
+
 # Don't source sqenv.sh if already sourced
 if [ "$SQ_STARTUP" == "" ]; then
 
@@ -62,16 +65,16 @@ if [ "$SQ_STARTUP" == "" ]; then
          . ./sqenv.sh
          popd
       else
-         echo "ERROR:  Unable to find / source ${CURR_ROOT}/sqenv.sh"
-         echo "        or ${CURR_ROOT}/sqf/sqenv.sh"
-         echo "Your SQF environment is NOT set correctly"
+         echo "  ERROR:  Unable to find / source ${CURR_ROOT}/sqenv.sh"
+         echo "          or ${CURR_ROOT}/sqf/sqenv.sh"
+         echo "  Your SQF environment is NOT set correctly"
          return 1
       fi
   fi
 fi   # sourcing sqend.sh
 
 if [ -z "$MY_SQROOT" ]; then
-  echo ERROR: MY_SQROOT is not set.
+  echo "  ERROR: MY_SQROOT is not set. "
   return 1
 fi
 
@@ -79,8 +82,7 @@ fi
 # Finally, add the regression variables and make sure the directories
 # actually exist
 #
-echo "MY_SQROOT"
-echo $MY_SQROOT
+echo "  MY_SQROOT is set to: $MY_SQROOT"
 export MY_SQROOT=$MY_SQROOT
 export SQLMX_MODULE_DIR=${MY_SQROOT}/sql/sqlmx/USERMODULES
 export SQLMX_SYSMODULE_DIR=${MY_SQROOT}/sql/sqlmx/SYSTEMMODULES
@@ -104,7 +106,7 @@ fi
 for i in $mxcmpdir $mxcidir $rundir $scriptsdir $mxlibdir
 do
   if [ ! -d $dir ]; then
-    echo "ERROR: $i does not exist or is not a directory."
+    echo "  ERROR: $i does not exist or is not a directory."
     return 1
   fi
 done
@@ -113,12 +115,9 @@ if [ -d $MY_SQROOT/sql/local_hadoop ]; then
   . $(dirname $(which swhadoop))/sw_env.sh
 fi
 
-echo ""
-echo "***********"
-echo ""
-echo "Regression test env vars are now set - cd to $scriptsdir and run!"
-echo ""
-echo "***********"
+echo "  Regression test env vars are now set"
+echo "     cd to $scriptsdir and run!"
+echo "Done setting up environment for Linux"
 echo ""
 
 


Mime
View raw message