Add drop permission test for functions

This commit is contained in:
Esther Lozano 2019-11-07 11:14:26 +01:00
parent 09076924c0
commit f06b899605
2 changed files with 23 additions and 6 deletions

View File

@ -44,8 +44,10 @@ SELECT * FROM test_view;
SELECT * FROM test_mview;
SELECT * FROM test_selectinto;
SELECT test_function();
DROP FUNCTION test_function();
\set QUIET on
CREATE FUNCTION test_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SET SESSION AUTHORIZATION "ownership_role";
\set QUIET off
@ -54,7 +56,8 @@ SELECT 'denied_tableas', catch_permission_error($$SELECT * FROM test_tablesas;$$
SELECT 'denied_view', catch_permission_error($$SELECT * FROM test_view;$$);
SELECT 'denied_mview', catch_permission_error($$SELECT * FROM test_mview;$$);
SELECT 'denied_selectinto', catch_permission_error($$SELECT * FROM test_selectinto;$$);
SELECT 'denied_function', catch_permission_error($$SELECT test_function();$$);
SELECT test_function();
SELECT 'denied_function', catch_permission_error($$DROP FUNCTION test_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -89,8 +92,10 @@ SELECT * FROM test2_view;
SELECT * FROM test2_mview;
SELECT * FROM test2_selectinto;
SELECT test2_function();
DROP FUNCTION test2_function();
\set QUIET on
CREATE FUNCTION test2_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SET SESSION AUTHORIZATION "ownership_role";
\set QUIET off
@ -99,7 +104,8 @@ SELECT 'denied_tableas2', catch_permission_error($$SELECT * FROM test2_tablesas;
SELECT 'denied_view2', catch_permission_error($$SELECT * FROM test2_view;$$);
SELECT 'denied_mview2', catch_permission_error($$SELECT * FROM test2_mview;$$);
SELECT 'denied_selectinto2', catch_permission_error($$SELECT * FROM test2_selectinto;$$);
SELECT 'denied_function2', catch_permission_error($$SELECT test2_function();$$);
SELECT test2_function();
SELECT 'denied_function2', catch_permission_error($$DROP FUNCTION test2_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -134,8 +140,10 @@ SELECT * FROM test3_view;
SELECT * FROM test3_mview;
SELECT * FROM test3_selectinto;
SELECT test3_function();
DROP FUNCTION test3_function();
\set QUIET on
CREATE FUNCTION test3_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SET SESSION AUTHORIZATION "ownership_role";
\set QUIET off
@ -144,7 +152,8 @@ SELECT 'denied_tableas3', catch_permission_error($$SELECT * FROM test3_tablesas;
SELECT 'denied_view3', catch_permission_error($$SELECT * FROM test3_view;$$);
SELECT 'denied_mview3', catch_permission_error($$SELECT * FROM test3_mview;$$);
SELECT 'denied_selectinto3', catch_permission_error($$SELECT * FROM test3_selectinto;$$);
SELECT 'denied_function3', catch_permission_error($$SELECT test3_function();$$);
SELECT test3_function();
SELECT 'denied_function3', catch_permission_error($$DROP FUNCTION test3_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -179,6 +188,7 @@ SELECT * FROM test4_view;
SELECT * FROM test4_mview;
SELECT * FROM test4_selectinto;
SELECT test4_function();
SELECT 'denied_function4', catch_permission_error($$DROP FUNCTION test4_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "ownership_role";

View File

@ -12,12 +12,14 @@ CREATE FUNCTION
1
1
1
DROP FUNCTION
denied_table|t
denied_tableas|t
denied_view|t
denied_mview|t
denied_selectinto|t
denied_function|f
1
denied_function|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
@ -39,12 +41,14 @@ CREATE FUNCTION
1
1
1
DROP FUNCTION
denied_table2|t
denied_tableas2|t
denied_view2|t
denied_mview2|t
denied_selectinto2|t
denied_function2|f
1
denied_function2|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
@ -65,12 +69,14 @@ CREATE FUNCTION
1
1
1
DROP FUNCTION
denied_table3|t
denied_tableas3|t
denied_view3|t
denied_mview3|t
denied_selectinto3|t
denied_function3|f
1
denied_function3|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
@ -91,6 +97,7 @@ CREATE FUNCTION
1
1
1
denied_function4|t
1
1
1