1) Add Reverse Engineered and Modified SQL tests for Foreign Servers. Fixes #4617

2) Add Reverse Engineered and Modified SQL tests for User Mappings. Fixes #4627
This commit is contained in:
Akshay Joshi
2019-09-03 16:27:41 +05:30
parent 04357b7a55
commit 4745ad56e9
45 changed files with 790 additions and 18 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

@@ -15,7 +15,6 @@ CREATE SERVER {{ conn|qtIdent(data.name) }}{% if data.fsrvtype %}
{# ============= Set the owner for foreign server ============= #}
{% if data.fsrvowner %}
ALTER SERVER {{ conn|qtIdent(data.name) }}
OWNER TO {{ conn|qtIdent(data.fsrvowner) }};
{% endif %}

View File

@@ -31,4 +31,4 @@ COMMENT ON SERVER {{ conn|qtIdent(data.name) }}
{% for priv in data.fsrvacl %}
{{ PRIVILEGE.APPLY(conn, 'FOREIGN SERVER', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
{% endif %}
{% endif %}
{% endif %}

View File

@@ -0,0 +1,13 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs;
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';

View File

@@ -0,0 +1,5 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION 1.1;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';

View File

@@ -0,0 +1,18 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1,4 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OPTIONS (ADD host '192.168.1.1', ADD dbname 'edb', ADD port '5450');
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,15 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs;
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1,4 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OPTIONS (DROP host, DROP dbname, DROP port);
REVOKE ALL ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" FROM PUBLIC;

View File

@@ -0,0 +1,18 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
TYPE 'oracle'
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1,13 @@
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
TYPE 'oracle'
VERSION 1.1
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,159 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for foreign server",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_fs",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create foreign server with all options",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql",
"data": {
"name":"FS_$%{}[]()&*^!@\"'`\\/#",
"fsrvtype":"oracle",
"fsrvversion":"1.1",
"fsrvoptions":[
{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}],
"fsrvowner":"postgres",
"description":"Test comment",
"fsrvacl":[{
"grantee":"PUBLIC",
"grantor":"postgres",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
},
"expected_sql_file": "create_fs_all_options.sql",
"expected_msql_file": "create_fs_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "FS_$%{}[]()&*^!@\"'`\\/#"
}
}, {
"type": "create",
"name": "Create foreign server",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"FS_$%{}[]()&*^!@\"'`\\/#",
"fsrvowner":"postgres"
}
}, {
"type": "alter",
"name": "Alter foreign server comment and version",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvversion":"1.1",
"description":"Test comment"
},
"expected_sql_file": "alter_comment_version.sql",
"expected_msql_file": "alter_comment_version_msql.sql"
}, {
"type": "alter",
"name": "Alter foreign server add options and privileges",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvoptions":{
"added": [{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}]
},
"fsrvacl":{
"added": [{
"grantee":"PUBLIC",
"grantor":"postgres",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
}
},
"expected_sql_file": "alter_options_privileges.sql",
"expected_msql_file": "alter_options_privileges_msql.sql"
}, {
"type": "alter",
"name": "Alter foreign server add options and privileges",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvoptions":{
"deleted": [{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}]
},
"fsrvacl":{
"deleted": [{
"grantee":"PUBLIC",
"grantor":"postgres",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
}
},
"expected_sql_file": "alter_remove_options_priv.sql",
"expected_msql_file": "alter_remove_options_priv_msql.sql"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "FS_$%{}[]()&*^!@\"'`\\/#"
}
}, {
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id",
"data": {
"name": "test_fdw_for_fs"
}
}
]
}

View File

@@ -0,0 +1,13 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs;
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';

View File

@@ -0,0 +1,5 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION 1.1;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';

View File

@@ -0,0 +1,18 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,4 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OPTIONS (ADD host '192.168.1.1', ADD dbname 'edb', ADD port '5450');
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,15 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs;
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,4 @@
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OPTIONS (DROP host, DROP dbname, DROP port);
REVOKE ALL ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" FROM PUBLIC;

View File

@@ -0,0 +1,18 @@
-- Foreign Server: FS_$%{}[]()&*^!@"'`\/#
-- DROP SERVER FS_$%{}[]()&*^!@"'`\/#
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
TYPE 'oracle'
VERSION '1.1'
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,13 @@
CREATE SERVER "FS_$%{}[]()&*^!@""'`\/#"
TYPE 'oracle'
VERSION 1.1
FOREIGN DATA WRAPPER test_fdw_for_fs
OPTIONS (host '192.168.1.1', dbname 'edb', port '5450');
ALTER SERVER "FS_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON SERVER "FS_$%{}[]()&*^!@""'`\/#"
IS 'Test comment';
GRANT USAGE ON FOREIGN SERVER "FS_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,159 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for foreign server",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_fs",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create foreign server with all options",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql",
"data": {
"name":"FS_$%{}[]()&*^!@\"'`\\/#",
"fsrvtype":"oracle",
"fsrvversion":"1.1",
"fsrvoptions":[
{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}],
"fsrvowner":"enterprisedb",
"description":"Test comment",
"fsrvacl":[{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
},
"expected_sql_file": "create_fs_all_options.sql",
"expected_msql_file": "create_fs_all_options_msql.sql"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "FS_$%{}[]()&*^!@\"'`\\/#"
}
}, {
"type": "create",
"name": "Create foreign server",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"FS_$%{}[]()&*^!@\"'`\\/#",
"fsrvowner":"enterprisedb"
}
}, {
"type": "alter",
"name": "Alter foreign server comment and version",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvversion":"1.1",
"description":"Test comment"
},
"expected_sql_file": "alter_comment_version.sql",
"expected_msql_file": "alter_comment_version_msql.sql"
}, {
"type": "alter",
"name": "Alter foreign server add options and privileges",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvoptions":{
"added": [{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}]
},
"fsrvacl":{
"added": [{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
}
},
"expected_sql_file": "alter_options_privileges.sql",
"expected_msql_file": "alter_options_privileges_msql.sql"
}, {
"type": "alter",
"name": "Alter foreign server add options and privileges",
"endpoint": "NODE-foreign_server.obj_id",
"sql_endpoint": "NODE-foreign_server.sql_id",
"msql_endpoint": "NODE-foreign_server.msql_id",
"data": {
"fsrvoptions":{
"deleted": [{
"fsrvoption":"host",
"fsrvvalue":"192.168.1.1"
},{
"fsrvoption":"dbname",
"fsrvvalue":"edb"
},{
"fsrvoption":"port",
"fsrvvalue":"5450"
}]
},
"fsrvacl":{
"deleted": [{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[{
"privilege_type":"U",
"privilege":true,
"with_grant":false
}]
}]
}
},
"expected_sql_file": "alter_remove_options_priv.sql",
"expected_msql_file": "alter_remove_options_priv_msql.sql"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "FS_$%{}[]()&*^!@\"'`\\/#"
}
}, {
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id",
"data": {
"name": "test_fdw_for_fs"
}
}
]
}

View File

@@ -0,0 +1,6 @@
-- User Mapping : postgres
-- DROP USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user12', password 'secret123');

View File

@@ -0,0 +1,5 @@
-- User Mapping : postgres
-- DROP USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;

View File

@@ -0,0 +1,2 @@
ALTER USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS (DROP "user", DROP password);

View File

@@ -0,0 +1,2 @@
ALTER USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS (SET "user" 'test_user12', SET password 'secret123');

View File

@@ -0,0 +1,6 @@
-- User Mapping : postgres
-- DROP USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user', password 'secret');

View File

@@ -0,0 +1,2 @@
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user', password 'secret');

View File

@@ -0,0 +1,99 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for user mapping",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_user_mapping",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create foreign server for user mapping",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"test_fs_for_user_mapping"
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create User Mapping",
"endpoint": "NODE-user_mapping.obj",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql",
"data": {
"name": "postgres",
"umoptions":[{
"umoption":"user",
"umvalue":"test_user"
},{
"umoption":"password",
"umvalue":"secret"
}]
},
"expected_sql_file": "create_user_mapping.sql",
"expected_msql_file": "create_user_mapping_msql.sql"
}, {
"type": "alter",
"name": "Alter user mapping options",
"endpoint": "NODE-user_mapping.obj_id",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql_id",
"data": {
"umoptions":{
"changed": [{
"umoption":"user",
"umvalue":"test_user12"
},{
"umoption":"password",
"umvalue":"secret123"
}]
}
},
"expected_sql_file": "alter_options.sql",
"expected_msql_file": "alter_options_msql.sql"
}, {
"type": "alter",
"name": "Alter user mapping drop options",
"endpoint": "NODE-user_mapping.obj_id",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql_id",
"data": {
"umoptions":{
"deleted": [{
"umoption":"user",
"umvalue":"test_user12"
},{
"umoption":"password",
"umvalue":"secret123"
}]
}
},
"expected_sql_file": "alter_options_deleted.sql",
"expected_msql_file": "alter_options_deleted_msql.sql"
}, {
"type": "delete",
"name": "Drop user mapping",
"endpoint": "NODE-user_mapping.delete_id"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "test_fs_for_user_mapping"
}
}, {
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id",
"data": {
"name": "test_fdw_for_user_mapping"
}
}
]
}

View File

@@ -0,0 +1,6 @@
-- User Mapping : enterprisedb
-- DROP USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user12', password 'secret123');

View File

@@ -0,0 +1,5 @@
-- User Mapping : enterprisedb
-- DROP USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping;

View File

@@ -0,0 +1,2 @@
ALTER USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS (DROP "user", DROP password);

View File

@@ -0,0 +1,2 @@
ALTER USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS (SET "user" 'test_user12', SET password 'secret123');

View File

@@ -0,0 +1,6 @@
-- User Mapping : enterprisedb
-- DROP USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user', password 'secret');

View File

@@ -0,0 +1,2 @@
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS ("user" 'test_user', password 'secret');

View File

@@ -0,0 +1,99 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW for user mapping",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "test_fdw_for_user_mapping",
"fdwacl": [],
"fdwoptions": []
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create foreign server for user mapping",
"endpoint": "NODE-foreign_server.obj",
"sql_endpoint": "NODE-foreign_server.sql_id",
"data": {
"name":"test_fs_for_user_mapping"
},
"store_object_id": "True"
}, {
"type": "create",
"name": "Create User Mapping",
"endpoint": "NODE-user_mapping.obj",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql",
"data": {
"name": "enterprisedb",
"umoptions":[{
"umoption":"user",
"umvalue":"test_user"
},{
"umoption":"password",
"umvalue":"secret"
}]
},
"expected_sql_file": "create_user_mapping.sql",
"expected_msql_file": "create_user_mapping_msql.sql"
}, {
"type": "alter",
"name": "Alter user mapping options",
"endpoint": "NODE-user_mapping.obj_id",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql_id",
"data": {
"umoptions":{
"changed": [{
"umoption":"user",
"umvalue":"test_user12"
},{
"umoption":"password",
"umvalue":"secret123"
}]
}
},
"expected_sql_file": "alter_options.sql",
"expected_msql_file": "alter_options_msql.sql"
}, {
"type": "alter",
"name": "Alter user mapping drop options",
"endpoint": "NODE-user_mapping.obj_id",
"sql_endpoint": "NODE-user_mapping.sql_id",
"msql_endpoint": "NODE-user_mapping.msql_id",
"data": {
"umoptions":{
"deleted": [{
"umoption":"user",
"umvalue":"test_user12"
},{
"umoption":"password",
"umvalue":"secret123"
}]
}
},
"expected_sql_file": "alter_options_deleted.sql",
"expected_msql_file": "alter_options_deleted_msql.sql"
}, {
"type": "delete",
"name": "Drop user mapping",
"endpoint": "NODE-user_mapping.delete_id"
}, {
"type": "delete",
"name": "Drop foreign server",
"endpoint": "NODE-foreign_server.delete_id",
"data": {
"name": "test_fs_for_user_mapping"
}
}, {
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id",
"data": {
"name": "test_fdw_for_user_mapping"
}
}
]
}

View File

@@ -11,7 +11,7 @@
"columns": [],
"schema": "testschema"
},
"store_table_id": true
"store_object_id": true
},
{
"type": "create",

View File

@@ -11,7 +11,7 @@
"columns": [],
"schema": "testschema"
},
"store_table_id": true
"store_object_id": true
},
{
"type": "create",

View File

@@ -11,7 +11,7 @@
"columns": [],
"schema": "testschema"
},
"store_table_id": true
"store_object_id": true
},
{
"type": "create",

View File

@@ -19,7 +19,7 @@
"schema": "testschema",
"spcname": "pg_default"
},
"store_table_id": true
"store_object_id": true
}, {
"type": "create",
"name": "Create compound trigger for insert or delete",

View File

@@ -16,7 +16,7 @@
"schema": "testschema",
"spcname": "pg_default"
},
"store_table_id": true
"store_object_id": true
},
{
"type": "create",

View File

@@ -19,7 +19,7 @@
"schema": "testschema",
"spcname": "pg_default"
},
"store_table_id": true
"store_object_id": true
}, {
"type": "create",
"name": "Create Extension",

View File

@@ -19,7 +19,7 @@
"schema": "testschema",
"spcname": "pg_default"
},
"store_table_id": true
"store_object_id": true
}, {
"type": "create",
"name": "Create Extension",

View File

@@ -22,7 +22,7 @@
"schema": "public",
"spcname": "pg_default"
},
"store_table_id": true
"store_object_id": true
}, {
"type": "create",
"name": "Create Rule for insert event",