mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-10 23:45:58 -06:00
1) Add Reverse Engineered and Modified SQL tests for Primary Keys. Fixes #4624.
2) Ensure Primary Key should be created with Index. Fixes #4742.
This commit is contained in:
parent
d923dcf98b
commit
aa668856f7
@ -26,6 +26,7 @@ Housekeeping
|
||||
| `Issue #4618 <https://redmine.postgresql.org/issues/4618>`_ - Add Reverse Engineered and Modified SQL tests for Foreign Tables.
|
||||
| `Issue #4619 <https://redmine.postgresql.org/issues/4619>`_ - Add Reverse Engineered and Modified SQL tests for FTS Templates.
|
||||
| `Issue #4621 <https://redmine.postgresql.org/issues/4621>`_ - Add Reverse Engineered and Modified SQL tests for Indexes.
|
||||
| `Issue #4624 <https://redmine.postgresql.org/issues/4624>`_ - Add Reverse Engineered and Modified SQL tests for Primary Keys.
|
||||
| `Issue #4627 <https://redmine.postgresql.org/issues/4627>`_ - Add Reverse Engineered and Modified SQL tests for User Mappings.
|
||||
| `Issue #4690 <https://redmine.postgresql.org/issues/4690>`_ - Add Modified SQL tests for Resource Group.
|
||||
|
||||
@ -58,3 +59,4 @@ Bug fixes
|
||||
| `Issue #4726 <https://redmine.postgresql.org/issues/4726>`_ - Ensure sequence with negative value should be created.
|
||||
| `Issue #4727 <https://redmine.postgresql.org/issues/4727>`_ - Fix issue where EXEC script doesn't write the complete script for Procedures.
|
||||
| `Issue #4736 <https://redmine.postgresql.org/issues/4736>`_ - Fix query tool and view data issue with the Italian language.
|
||||
| `Issue #4742 <https://redmine.postgresql.org/issues/4742>`_ - Ensure Primary Key should be created with Index.
|
@ -51,6 +51,13 @@
|
||||
"data": {
|
||||
"name": "Chk_$%{}[]()&*^!@\"'`\\/#a"
|
||||
}
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Table for Check Constraint",
|
||||
"endpoint": "NODE-table.delete_id",
|
||||
"data": {
|
||||
"name": "tableforcon"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -571,7 +571,8 @@ class IndexConstraintView(PGChildNodeView):
|
||||
for arg in required_args:
|
||||
if isinstance(arg, list):
|
||||
for param in arg:
|
||||
if param in data and is_key_list(param, data):
|
||||
if param in data and (param != 'columns' or
|
||||
is_key_list(param, data)):
|
||||
break
|
||||
else:
|
||||
return make_json_response(
|
||||
|
@ -533,14 +533,11 @@ define('pgadmin.node.primary_key', [
|
||||
},
|
||||
},{
|
||||
id: 'index', label: gettext('Index'),
|
||||
mode: ['create'],
|
||||
type: 'text', group: gettext('Definition'),
|
||||
control: Backform.NodeListByNameControl.extend({
|
||||
initialize:function() {
|
||||
if (_.isUndefined(this.model.top)) {
|
||||
Backform.NodeListByNameControl.prototype.initialize.apply(this,arguments);
|
||||
} else {
|
||||
Backform.Control.prototype.initialize.apply(this,arguments);
|
||||
}
|
||||
Backform.NodeListByNameControl.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
}),
|
||||
select2:{allowClear:true}, node: 'index',
|
||||
|
@ -0,0 +1,13 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
INCLUDE (col2)
|
||||
WITH (FILLFACTOR=90)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,11 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=90);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
SET (FILLFACTOR=90);
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
SET (FILLFACTOR=90);
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
@ -0,0 +1,2 @@
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
RESET (FILLFACTOR);
|
@ -0,0 +1,12 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
INCLUDE (col2)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,12 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
INCLUDE (col2)
|
||||
WITH (FILLFACTOR=20)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,10 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,8 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
INCLUDE (col2)
|
||||
WITH (FILLFACTOR=20)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,129 @@
|
||||
{
|
||||
"scenarios": [
|
||||
{
|
||||
"type": "create",
|
||||
"name": "Create Table",
|
||||
"endpoint": "NODE-table.obj",
|
||||
"sql_endpoint": "NODE-table.sql_id",
|
||||
"data": {
|
||||
"name": "tableforindexcon",
|
||||
"columns": [{
|
||||
"name": "col1",
|
||||
"cltype": "integer",
|
||||
"is_primary_key": false
|
||||
}, {
|
||||
"name": "col2",
|
||||
"cltype": "integer",
|
||||
"is_primary_key": false
|
||||
}],
|
||||
"is_partitioned": false,
|
||||
"schema": "testschema",
|
||||
"spcname": "pg_default"
|
||||
},
|
||||
"store_object_id": true
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Index",
|
||||
"endpoint": "NODE-index.obj",
|
||||
"sql_endpoint": "NODE-index.sql_id",
|
||||
"data": {
|
||||
"name": "uindex",
|
||||
"spcname": "pg_default",
|
||||
"amname": "btree",
|
||||
"columns": [{
|
||||
"colname": "col1",
|
||||
"sort_order": false,
|
||||
"nulls": false,
|
||||
"is_sort_nulls_applicable": true
|
||||
}],
|
||||
"indisunique": true,
|
||||
"fillfactor": 20
|
||||
}
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Primary Key Constraint -- 11 Plus",
|
||||
"endpoint": "NODE-primary_key.obj",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
|
||||
"comment": "Comment for create",
|
||||
"fillfactor": 20,
|
||||
"columns": [{"column":"col1"}],
|
||||
"include": ["col2"],
|
||||
"condeferrable": true,
|
||||
"condeferred": true
|
||||
},
|
||||
"expected_sql_file": "create_index_constraint.sql",
|
||||
"expected_msql_file": "create_msql_index_constraint.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint -- 11 Plus",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
|
||||
"fillfactor": 90,
|
||||
"comment": "Comment for alter"
|
||||
},
|
||||
"expected_sql_file": "alter_index_constraint.sql",
|
||||
"expected_msql_file": "alter_msql_index_constraint.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint Reset Fill factor",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"fillfactor": ""
|
||||
},
|
||||
"expected_sql_file": "alter_reset_fillfactor.sql",
|
||||
"expected_msql_file": "alter_msql_reset_fillfactor.sql"
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Primary Key Constraint -- 11 plus",
|
||||
"endpoint": "NODE-primary_key.delete_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
|
||||
}
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Primary Key Constraint with Index -- 11 plus",
|
||||
"endpoint": "NODE-primary_key.obj",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
|
||||
"comment": "Comment for create",
|
||||
"index": "uindex"
|
||||
},
|
||||
"expected_sql_file": "create_index_constraint_with_index.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint with Index -- 11 plus",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
|
||||
"fillfactor": 90,
|
||||
"comment": "Comment for alter"
|
||||
},
|
||||
"expected_sql_file": "alter_index_constraint_with_index.sql",
|
||||
"expected_msql_file": "alter_msql_index_constraint_with_index.sql"
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Primary Key Constraint with Index -- 11 plus",
|
||||
"endpoint": "NODE-primary_key.delete_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
|
||||
}
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Index Constraint Table -- 11 plus",
|
||||
"endpoint": "NODE-table.delete_id",
|
||||
"data": {
|
||||
"name": "tableforindexcon"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=90)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,11 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=90);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
SET (FILLFACTOR=90);
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
RENAME CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" TO "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
SET (FILLFACTOR=90);
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
@ -0,0 +1,2 @@
|
||||
ALTER INDEX testschema."Pk_$%{}[]()&*^!@""'`\/#a"
|
||||
RESET (FILLFACTOR);
|
@ -0,0 +1,11 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#a
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" PRIMARY KEY (col1)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#a" ON testschema.tableforindexcon
|
||||
IS 'Comment for alter';
|
||||
|
@ -0,0 +1,11 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,10 @@
|
||||
-- Constraint: Pk_$%{}[]()&*^!@"'`\/#
|
||||
|
||||
-- ALTER TABLE testschema.tableforindexcon DROP CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#";
|
||||
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,7 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20)
|
||||
DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE testschema.tableforindexcon
|
||||
ADD CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" PRIMARY KEY (col1)
|
||||
WITH (FILLFACTOR=20);
|
||||
|
||||
COMMENT ON CONSTRAINT "Pk_$%{}[]()&*^!@""'`\/#" ON testschema.tableforindexcon
|
||||
IS 'Comment for create';
|
@ -0,0 +1,124 @@
|
||||
{
|
||||
"scenarios": [
|
||||
{
|
||||
"type": "create",
|
||||
"name": "Create Table",
|
||||
"endpoint": "NODE-table.obj",
|
||||
"sql_endpoint": "NODE-table.sql_id",
|
||||
"data": {
|
||||
"name": "tableforindexcon",
|
||||
"columns": [{
|
||||
"name": "col1",
|
||||
"cltype": "integer",
|
||||
"is_primary_key": false
|
||||
}],
|
||||
"is_partitioned": false,
|
||||
"schema": "testschema",
|
||||
"spcname": "pg_default"
|
||||
},
|
||||
"store_object_id": true
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Index",
|
||||
"endpoint": "NODE-index.obj",
|
||||
"sql_endpoint": "NODE-index.sql_id",
|
||||
"data": {
|
||||
"name": "uindex",
|
||||
"spcname": "pg_default",
|
||||
"amname": "btree",
|
||||
"columns": [{
|
||||
"colname": "col1",
|
||||
"sort_order": false,
|
||||
"nulls": false,
|
||||
"is_sort_nulls_applicable": true
|
||||
}],
|
||||
"indisunique": true,
|
||||
"fillfactor": 20
|
||||
}
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Primary Key Constraint",
|
||||
"endpoint": "NODE-primary_key.obj",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
|
||||
"comment": "Comment for create",
|
||||
"fillfactor": 20,
|
||||
"columns": [{"column":"col1"}],
|
||||
"condeferrable": true,
|
||||
"condeferred": true
|
||||
},
|
||||
"expected_sql_file": "create_index_constraint.sql",
|
||||
"expected_msql_file": "create_msql_index_constraint.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
|
||||
"fillfactor": 90,
|
||||
"comment": "Comment for alter"
|
||||
},
|
||||
"expected_sql_file": "alter_index_constraint.sql",
|
||||
"expected_msql_file": "alter_msql_index_constraint.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint Reset Fill factor",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"fillfactor": ""
|
||||
},
|
||||
"expected_sql_file": "alter_reset_fillfactor.sql",
|
||||
"expected_msql_file": "alter_msql_reset_fillfactor.sql"
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Primary Key Constraint",
|
||||
"endpoint": "NODE-primary_key.delete_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
|
||||
}
|
||||
}, {
|
||||
"type": "create",
|
||||
"name": "Create Primary Key Constraint with Index",
|
||||
"endpoint": "NODE-primary_key.obj",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#",
|
||||
"comment": "Comment for create",
|
||||
"index": "uindex"
|
||||
},
|
||||
"expected_sql_file": "create_index_constraint_with_index.sql"
|
||||
}, {
|
||||
"type": "alter",
|
||||
"name": "Alter Primary Key Constraint with Index",
|
||||
"endpoint": "NODE-primary_key.obj_id",
|
||||
"sql_endpoint": "NODE-primary_key.sql_id",
|
||||
"msql_endpoint": "NODE-primary_key.msql_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a",
|
||||
"fillfactor": 90,
|
||||
"comment": "Comment for alter"
|
||||
},
|
||||
"expected_sql_file": "alter_index_constraint_with_index.sql",
|
||||
"expected_msql_file": "alter_msql_index_constraint_with_index.sql"
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Primary Key Constraint with Index",
|
||||
"endpoint": "NODE-primary_key.delete_id",
|
||||
"data": {
|
||||
"name": "Pk_$%{}[]()&*^!@\"'`\\/#a"
|
||||
}
|
||||
}, {
|
||||
"type": "delete",
|
||||
"name": "Drop Index Constraint Table",
|
||||
"endpoint": "NODE-table.delete_id",
|
||||
"data": {
|
||||
"name": "tableforindexcon"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
|
||||
ADD{% if data.name %} CONSTRAINT {{ conn|qtIdent(data.name) }}{% endif%} {{constraint_name}} {% if data.index %}USING INDEX {{ conn|qtIdent(data.index) }}{% else %}
|
||||
({% for columnobj in data.columns %}{% if loop.index != 1 %}
|
||||
, {% endif %}{{ conn|qtIdent(columnobj.column)}}{% endfor %})
|
||||
{% if data.include|length > 0 %}
|
||||
INCLUDE({% for col in data.include %}{% if loop.index != 1 %}, {% endif %}{{conn|qtIdent(col)}}{% endfor %}){% endif %}
|
||||
, {% endif %}{{ conn|qtIdent(columnobj.column)}}{% endfor %}){% if data.include|length > 0 %}
|
||||
|
||||
INCLUDE ({% for col in data.include %}{% if loop.index != 1 %}, {% endif %}{{conn|qtIdent(col)}}{% endfor %}){% endif %}
|
||||
{% if data.fillfactor %}
|
||||
|
||||
WITH (FILLFACTOR={{data.fillfactor}}){% endif %}{% if data.spcname and data.spcname != "pg_default" %}
|
||||
@ -12,7 +12,7 @@ ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
|
||||
|
||||
DEFERRABLE{% if data.condeferred %}
|
||||
INITIALLY DEFERRED{% endif%}
|
||||
{% endif%};
|
||||
{% endif -%};
|
||||
{% if data.comment and data.name %}
|
||||
|
||||
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
|
||||
|
@ -9,7 +9,7 @@ ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
|
||||
|
||||
DEFERRABLE{% if data.condeferred %}
|
||||
INITIALLY DEFERRED{% endif%}
|
||||
{% endif%};
|
||||
{% endif -%};
|
||||
{% if data.comment and data.name %}
|
||||
|
||||
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
|
||||
|
@ -13,6 +13,9 @@ ALTER INDEX {{ conn|qtIdent(data.schema, data.name) }}
|
||||
{% if data.fillfactor and data.fillfactor != o_data.fillfactor %}
|
||||
ALTER INDEX {{ conn|qtIdent(data.schema, data.name) }}
|
||||
SET (FILLFACTOR={{ data.fillfactor }});
|
||||
{% elif data.fillfactor is defined and data.fillfactor == '' %}
|
||||
ALTER INDEX {{ conn|qtIdent(data.schema, data.name) }}
|
||||
RESET (FILLFACTOR);
|
||||
{% endif %}
|
||||
{# ==== To update constraint comments ==== #}
|
||||
{% if data.comment is defined and data.comment != o_data.comment %}
|
||||
|
Loading…
Reference in New Issue
Block a user