add test expect

This commit is contained in:
Gonzalo Riestra 2019-10-25 11:50:03 +02:00
parent 11b30c8f59
commit a8966270bd
2 changed files with 24 additions and 8 deletions

View File

@ -36,7 +36,7 @@ CREATE TABLE test_tablesas AS SELECT * FROM test;
CREATE VIEW test_view AS SELECT * FROM test;
CREATE MATERIALIZED VIEW test_mview AS SELECT * FROM test;
SELECT * INTO test_selectinto FROM test;
CREATE FUNCTION test_function() RETURNS text AS $$ BEGIN RETURN 'test'; END; $$ LANGUAGE PLPGSQL;
CREATE FUNCTION test_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SELECT * FROM test;
SELECT * FROM test_tablesas;
@ -54,7 +54,7 @@ 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 test_function();
SELECT 'denied_function', catch_permission_error($$SELECT test_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -81,7 +81,7 @@ CREATE TABLE test2_tablesas AS SELECT * FROM test2;
CREATE VIEW test2_view AS SELECT * FROM test2;
CREATE MATERIALIZED VIEW test2_mview AS SELECT * FROM test2;
SELECT * INTO test2_selectinto FROM test2;
CREATE FUNCTION test2_function() RETURNS text AS $$ BEGIN RETURN 'test'; END; $$ LANGUAGE PLPGSQL;
CREATE FUNCTION test2_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SELECT * FROM test2;
SELECT * FROM test2_tablesas;
@ -99,7 +99,7 @@ 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 test2_function();
SELECT 'denied_function2', catch_permission_error($$SELECT test2_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -126,14 +126,14 @@ CREATE TABLE test3_tablesas AS SELECT * FROM test3;
CREATE VIEW test3_view AS SELECT * FROM test3;
CREATE MATERIALIZED VIEW test3_mview AS SELECT * FROM test3;
SELECT * INTO test3_selectinto FROM test3;
CREATE FUNCTION test3_function() RETURNS text AS $$ BEGIN RETURN 'test'; END; $$ LANGUAGE PLPGSQL;
CREATE FUNCTION test3_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SELECT * FROM test3;
SELECT * FROM test3_tablesas;
SELECT * FROM test3_view;
SELECT * FROM test3_mview;
SELECT * FROM test3_selectinto;
SELECT test_function();
SELECT test3_function();
\set QUIET on
SET SESSION AUTHORIZATION "ownership_role";
@ -144,7 +144,7 @@ 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 test_function();
SELECT 'denied_function3', catch_permission_error($$SELECT test3_function();$$);
\set QUIET on
SET SESSION AUTHORIZATION "creator_role";
@ -171,7 +171,7 @@ CREATE TABLE test4_tablesas AS SELECT * FROM test4;
CREATE VIEW test4_view AS SELECT * FROM test4;
CREATE MATERIALIZED VIEW test4_mview AS SELECT * FROM test4;
SELECT * INTO test4_selectinto FROM test4;
CREATE FUNCTION test4_function() RETURNS text AS $$ BEGIN RETURN 'test'; END; $$ LANGUAGE PLPGSQL;
CREATE FUNCTION test4_function() RETURNS integer AS $$ BEGIN RETURN 1; END; $$ LANGUAGE PLPGSQL;
SELECT * FROM test4;
SELECT * FROM test4_tablesas;

View File

@ -5,6 +5,8 @@ SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
CREATE FUNCTION
1
1
1
1
@ -15,11 +17,13 @@ denied_tableas|t
denied_view|t
denied_mview|t
denied_selectinto|t
denied_function|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
DROP FUNCTION
NOTICE: event trigger "oauth_reassign_tables_trigger" does not exist, skipping
CREATE TABLE
@ -28,6 +32,8 @@ SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
CREATE FUNCTION
1
1
1
1
@ -38,11 +44,13 @@ denied_tableas2|t
denied_view2|t
denied_mview2|t
denied_selectinto2|t
denied_function2|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
DROP FUNCTION
CREATE TABLE
INSERT 0 1
@ -50,6 +58,8 @@ SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
CREATE FUNCTION
1
1
1
1
@ -60,11 +70,13 @@ denied_tableas3|t
denied_view3|t
denied_mview3|t
denied_selectinto3|t
denied_function3|t
DROP TABLE
DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
DROP FUNCTION
CREATE TABLE
INSERT 0 1
@ -72,6 +84,9 @@ SELECT 1
CREATE VIEW
SELECT 1
SELECT 1
CREATE FUNCTION
1
1
1
1
1
@ -87,4 +102,5 @@ DROP VIEW
DROP MATERIALIZED VIEW
DROP TABLE
DROP TABLE
DROP FUNCTION