Added re_sql test cases for privileges in Foreign Data Wrappers

pull/25/head
Akshay Joshi 2019-07-10 17:57:11 +05:30
parent 49503dc73d
commit 6c7e95a463
21 changed files with 103 additions and 13 deletions

View File

@ -19,3 +19,4 @@ FROM
LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid)
LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid)
GROUP BY g.rolname, gt.rolname
ORDER BY grantee

View File

@ -25,3 +25,4 @@ FROM
LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid)
LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid)
GROUP BY g.rolname, gt.rolname
ORDER BY grantee

View File

@ -1,13 +0,0 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator
OPTIONS (opt1 'val1');
ALTER FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OWNER TO <OWNER>;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@ -0,0 +1,16 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator
OPTIONS (opt1 'val1');
ALTER FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
OWNER TO <OWNER>;
COMMENT ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
IS 'a comment';
GRANT USAGE ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#" TO postgres WITH GRANT OPTION;

View File

@ -94,6 +94,34 @@
"name": "Fdw2_$%{}[]()&*^!@\"'`\\/#"
},
"expected_sql_file": "alter_fdw_rename.sql"
},{
"type": "alter",
"name": "Alter FDW add privileges",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwacl": {
"added":[{
"grantee": "PUBLIC",
"grantor": "postgres",
"privileges":[
{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
},{
"grantee": "postgres",
"grantor": "postgres",
"privileges":[{
"privilege_type": "U",
"privilege": true,
"with_grant": true
}]
}]
}
},
"expected_sql_file": "alter_fdw_privileges.sql"
},{
"type": "delete",
"name": "Drop FDW",

View File

@ -0,0 +1,16 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator
OPTIONS (opt1 'val1');
ALTER FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
OWNER TO <OWNER>;
COMMENT ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
IS 'a comment';
GRANT USAGE ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#" TO enterprisedb WITH GRANT OPTION;

View File

@ -0,0 +1,13 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator
OPTIONS (opt1 'val1');
ALTER FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
OWNER TO <OWNER>;
COMMENT ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@ -94,6 +94,34 @@
"name": "Fdw2_$%{}[]()&*^!@\"'`\\/#"
},
"expected_sql_file": "alter_fdw_rename.sql"
},{
"type": "alter",
"name": "Alter FDW add privileges",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwacl": {
"added":[{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges":[
{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
},{
"grantee": "enterprisedb",
"grantor": "enterprisedb",
"privileges":[{
"privilege_type": "U",
"privilege": true,
"with_grant": true
}]
}]
}
},
"expected_sql_file": "alter_fdw_privileges.sql"
},{
"type": "delete",
"name": "Drop FDW",