Add Reverse Engineered SQL tests for FDWs. Fixes #4441

This commit is contained in:
Aditya Toshniwal
2019-07-05 11:24:47 +01:00
committed by Dave Page
parent 954c0d3101
commit ba32c98241
17 changed files with 371 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ New features
| `Feature #4335 <https://redmine.postgresql.org/issues/4335>`_ - Add EXPLAIN options for SETTINGS and SUMMARY.
| `Feature #4415 <https://redmine.postgresql.org/issues/4415>`_ - Add Reverse Engineered SQL tests for Roles and Resource Groups.
| `Feature #4318 <https://redmine.postgresql.org/issues/4318>`_ - Set the mouse cursor appropriately based on the layout lock state.
| `Feature #4441 <https://redmine.postgresql.org/issues/4441>`_ - Add Reverse Engineered SQL tests for FDWs.
Bug fixes
*********

View File

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

View File

@@ -0,0 +1,11 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

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

View File

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

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 postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@@ -0,0 +1,13 @@
-- 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 postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@@ -0,0 +1,8 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;

View File

@@ -0,0 +1,104 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "Fdw1_$%{}[]()&*^!@\"'`\\/#",
"fdwowner": "postgres",
"fdwacl": [],
"fdwoptions": []
},
"expected_sql_file": "create_fdw.sql"
},{
"type": "alter",
"name": "Alter FDW add comment",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"description": "a comment"
},
"expected_sql_file": "alter_fdw_comment.sql"
},{
"type": "alter",
"name": "Alter FDW add option 1",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"added": [{
"fdwoption": "opt1",
"fdwvalue": "val1"
}]
}
},
"expected_sql_file": "alter_fdw_opt1.sql"
},{
"type": "alter",
"name": "Alter FDW add option 2",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"added": [{
"fdwoption": "opt2",
"fdwvalue": "val2"
}]
}
},
"expected_sql_file": "alter_fdw_opt2.sql"
},{
"type": "alter",
"name": "Alter FDW change option 2 value",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"changed": [{
"fdwoption": "opt2",
"fdwvalue": "valopt2"
}]
}
},
"expected_sql_file": "alter_fdw_change_opt2.sql"
},{
"type": "alter",
"name": "Alter FDW remove option 2",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"deleted": [{
"fdwoption": "opt2",
"fdwvalue": "valopt2"
}]
}
},
"expected_sql_file": "alter_fdw_opt1.sql"
},{
"type": "alter",
"name": "Alter FDW add validator",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwvalue": "pg_catalog.postgresql_fdw_validator"
},
"expected_sql_file": "alter_fdw_validator.sql"
},{
"type": "alter",
"name": "Alter FDW rename",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "Fdw2_$%{}[]()&*^!@\"'`\\/#"
},
"expected_sql_file": "alter_fdw_rename.sql"
},{
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id"
}
]
}

View File

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

View File

@@ -0,0 +1,11 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
-- 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 postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@@ -0,0 +1,13 @@
-- 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 postgres;
COMMENT ON FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
IS 'a comment';

View File

@@ -0,0 +1,8 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";
ALTER FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;

View File

@@ -0,0 +1,104 @@
{
"scenarios": [
{
"type": "create",
"name": "Create FDW",
"endpoint": "NODE-foreign_data_wrapper.obj",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "Fdw1_$%{}[]()&*^!@\"'`\\/#",
"fdwowner": "postgres",
"fdwacl": [],
"fdwoptions": []
},
"expected_sql_file": "create_fdw.sql"
},{
"type": "alter",
"name": "Alter FDW add comment",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"description": "a comment"
},
"expected_sql_file": "alter_fdw_comment.sql"
},{
"type": "alter",
"name": "Alter FDW add option 1",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"added": [{
"fdwoption": "opt1",
"fdwvalue": "val1"
}]
}
},
"expected_sql_file": "alter_fdw_opt1.sql"
},{
"type": "alter",
"name": "Alter FDW add option 2",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"added": [{
"fdwoption": "opt2",
"fdwvalue": "val2"
}]
}
},
"expected_sql_file": "alter_fdw_opt2.sql"
},{
"type": "alter",
"name": "Alter FDW change option 2 value",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"changed": [{
"fdwoption": "opt2",
"fdwvalue": "valopt2"
}]
}
},
"expected_sql_file": "alter_fdw_change_opt2.sql"
},{
"type": "alter",
"name": "Alter FDW remove option 2",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwoptions": {
"deleted": [{
"fdwoption": "opt2",
"fdwvalue": "valopt2"
}]
}
},
"expected_sql_file": "alter_fdw_opt1.sql"
},{
"type": "alter",
"name": "Alter FDW add validator",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"fdwvalue": "pg_catalog.postgresql_fdw_validator"
},
"expected_sql_file": "alter_fdw_validator.sql"
},{
"type": "alter",
"name": "Alter FDW rename",
"endpoint": "NODE-foreign_data_wrapper.obj_id",
"sql_endpoint": "NODE-foreign_data_wrapper.sql_id",
"data": {
"name": "Fdw2_$%{}[]()&*^!@\"'`\\/#"
},
"expected_sql_file": "alter_fdw_rename.sql"
},{
"type": "delete",
"name": "Drop FDW",
"endpoint": "NODE-foreign_data_wrapper.delete_id"
}
]
}