Add Reverse Engineered SQL tests for Constraints. Fixes #4475

This commit is contained in:
Khushboo Vashi
2019-07-17 13:25:08 +01:00
committed by Dave Page
parent 710d520631
commit 8168f623c4
6 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
-- Constraint: Chk_$%{}[]()&*^!@"'`\/#a
-- ALTER TABLE testschema.tableforcon DROP CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#a";
ALTER TABLE testschema.tableforcon
ADD CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#a" CHECK (col1 > 1);
COMMENT ON CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforcon
IS 'Comment for alter';

View File

@@ -0,0 +1,10 @@
-- Constraint: Chk_$%{}[]()&*^!@"'`\/#
-- ALTER TABLE testschema.tableforcon DROP CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema.tableforcon
ADD CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#" CHECK (col1 > 1)
NOT VALID;
COMMENT ON CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforcon
IS 'Comment for create';

View File

@@ -0,0 +1,6 @@
ALTER TABLE testschema.tableforcon
RENAME CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#" TO "Chk_$%{}[]()&*^!@""'`\/#a";
ALTER TABLE testschema.tableforcon
VALIDATE CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#a";
COMMENT ON CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforcon
IS 'Comment for alter';

View File

@@ -0,0 +1,56 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "tableforcon",
"columns": [{
"name": "col1",
"cltype": "integer",
"is_primary_key": true
}],
"is_partitioned": false,
"schema": "testschema",
"spcname": "pg_default"
},
"store_table_id": true
},
{
"type": "create",
"name": "Create Check Constraint",
"endpoint": "NODE-check_constraint.obj",
"sql_endpoint": "NODE-check_constraint.sql_id",
"data": {
"name": "Chk_$%{}[]()&*^!@\"'`\\/#",
"comment": "Comment for create",
"consrc": "col1 > 1",
"connoinherit": false,
"convalidated": true
},
"expected_sql_file": "create_check_constraint.sql"
}, {
"type": "alter",
"name": "Alter Check Constraint",
"endpoint": "NODE-check_constraint.obj_id",
"sql_endpoint": "NODE-check_constraint.sql_id",
"msql_endpoint": "NODE-check_constraint.msql_id",
"data": {
"name": "Chk_$%{}[]()&*^!@\"'`\\/#a",
"convalidated": false,
"comment": "Comment for alter"
},
"expected_sql_file": "alter_check_constraint.sql",
"expected_msql_file": "msql_check_constraint.sql"
}, {
"type": "delete",
"name": "Drop Check Constraint",
"endpoint": "NODE-check_constraint.delete_id",
"data": {
"name": "Chk_$%{}[]()&*^!@\"'`\\/#a"
}
}
]
}