mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that the user will be able to modify the start value of the Identity column. Fixes #5632
This commit is contained in:
parent
287a6628ed
commit
74fd5dfe96
1
.gitignore
vendored
1
.gitignore
vendored
@ -50,3 +50,4 @@ web/yarn-error.log
|
|||||||
auditjs.html
|
auditjs.html
|
||||||
auditpy.txt
|
auditpy.txt
|
||||||
/venv/
|
/venv/
|
||||||
|
.scannerwork/
|
@ -24,5 +24,6 @@ Bug fixes
|
|||||||
|
|
||||||
| `Issue #4810 <https://redmine.postgresql.org/issues/4810>`_ - Fixed an issue where the user is not able to save the new row if the table is empty.
|
| `Issue #4810 <https://redmine.postgresql.org/issues/4810>`_ - Fixed an issue where the user is not able to save the new row if the table is empty.
|
||||||
| `Issue #5490 <https://redmine.postgresql.org/issues/5490>`_ - Make the runtime configuration dialog non-modal.
|
| `Issue #5490 <https://redmine.postgresql.org/issues/5490>`_ - Make the runtime configuration dialog non-modal.
|
||||||
|
| `Issue #5632 <https://redmine.postgresql.org/issues/5632>`_ - Ensure that the user will be able to modify the start value of the Identity column.
|
||||||
| `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object.
|
| `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object.
|
||||||
| `Issue #5708 <https://redmine.postgresql.org/issues/5708>`_ - Correct TLS certificate filename in the container deployment docs.
|
| `Issue #5708 <https://redmine.postgresql.org/issues/5708>`_ - Correct TLS certificate filename in the container deployment docs.
|
@ -604,6 +604,8 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
|||||||
gettext("Could not find the column on the server.")
|
gettext("Could not find the column on the server.")
|
||||||
)
|
)
|
||||||
old_data = dict(res['rows'][0])
|
old_data = dict(res['rows'][0])
|
||||||
|
if 'seqcycle' in old_data and old_data['seqcycle'] is False:
|
||||||
|
old_data['seqcycle'] = None
|
||||||
# We will add table & schema as well
|
# We will add table & schema as well
|
||||||
old_data = column_utils.column_formatter(
|
old_data = column_utils.column_formatter(
|
||||||
self.conn, tid, clid, old_data)
|
self.conn, tid, clid, old_data)
|
||||||
|
@ -599,10 +599,8 @@ define('pgadmin.node.column', [
|
|||||||
visible: 'isTypeIdentity',
|
visible: 'isTypeIdentity',
|
||||||
},{
|
},{
|
||||||
id: 'seqstart', label: gettext('Start'), type: 'int',
|
id: 'seqstart', label: gettext('Start'), type: 'int',
|
||||||
mode: ['properties', 'create'], group: gettext('Constraints'),
|
mode: ['properties', 'create', 'edit'], group: gettext('Constraints'),
|
||||||
disabled: function(m) {
|
disabled: function(m) {
|
||||||
if (!m.isNew())
|
|
||||||
return true;
|
|
||||||
let isIdentity = m.get('attidentity');
|
let isIdentity = m.get('attidentity');
|
||||||
if(!_.isUndefined(isIdentity) && !_.isNull(isIdentity) && !_.isEmpty(isIdentity))
|
if(!_.isUndefined(isIdentity) && !_.isNull(isIdentity) && !_.isEmpty(isIdentity))
|
||||||
return false;
|
return false;
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ALTER COLUMN "col_6_$%{}[]()&*^!@""'`\/#" SET CYCLE SET INCREMENT 3 RESTART SET START 3 SET MINVALUE 3 SET MAXVALUE 30 SET CACHE 3;
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 3 START 3 MINVALUE 3 MAXVALUE 30 CACHE 3 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ALTER COLUMN "col_6_$%{}[]()&*^!@""'`\/#" SET GENERATED ALWAYS SET NO CYCLE RESTART SET START 2;
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 2 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -46,7 +46,36 @@
|
|||||||
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
|
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
|
||||||
"description": "Comment for alter",
|
"description": "Comment for alter",
|
||||||
"cltype": "real",
|
"cltype": "real",
|
||||||
"attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]}
|
"attacl": {
|
||||||
|
"added": [
|
||||||
|
{
|
||||||
|
"grantee": "PUBLIC",
|
||||||
|
"grantor": "postgres",
|
||||||
|
"privileges": [
|
||||||
|
{
|
||||||
|
"privilege_type": "a",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "r",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "w",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "x",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_column_int.sql",
|
"expected_sql_file": "alter_column_int.sql",
|
||||||
"expected_msql_file": "alter_column_int.msql"
|
"expected_msql_file": "alter_column_int.msql"
|
||||||
@ -97,7 +126,31 @@
|
|||||||
"attstorage": "p",
|
"attstorage": "p",
|
||||||
"description": "Comment for alter",
|
"description": "Comment for alter",
|
||||||
"cltype": "character",
|
"cltype": "character",
|
||||||
"attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]}
|
"attacl": {
|
||||||
|
"added": [
|
||||||
|
{
|
||||||
|
"grantee": "PUBLIC",
|
||||||
|
"grantor": "postgres",
|
||||||
|
"privileges": [
|
||||||
|
{
|
||||||
|
"privilege_type": "a",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "r",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "x",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_column_char.sql",
|
"expected_sql_file": "alter_column_char.sql",
|
||||||
"expected_msql_file": "alter_column_char.msql"
|
"expected_msql_file": "alter_column_char.msql"
|
||||||
@ -150,7 +203,31 @@
|
|||||||
"attnum": 3,
|
"attnum": 3,
|
||||||
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#",
|
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#",
|
||||||
"description": "Comment for alter",
|
"description": "Comment for alter",
|
||||||
"attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]}
|
"attacl": {
|
||||||
|
"added": [
|
||||||
|
{
|
||||||
|
"grantee": "PUBLIC",
|
||||||
|
"grantor": "postgres",
|
||||||
|
"privileges": [
|
||||||
|
{
|
||||||
|
"privilege_type": "a",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "r",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "x",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_column_identity.sql",
|
"expected_sql_file": "alter_column_identity.sql",
|
||||||
"expected_msql_file": "alter_column_identity.msql"
|
"expected_msql_file": "alter_column_identity.msql"
|
||||||
@ -177,7 +254,6 @@
|
|||||||
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#"
|
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Column (Numeric type with Length Precision & Variables)",
|
"name": "Create Column (Numeric type with Length Precision & Variables)",
|
||||||
@ -196,7 +272,12 @@
|
|||||||
"attlen": "10",
|
"attlen": "10",
|
||||||
"attprecision": "5",
|
"attprecision": "5",
|
||||||
"attidentity": "a",
|
"attidentity": "a",
|
||||||
"attoptions":[{"name":"n_distinct","value":"1"}],
|
"attoptions": [
|
||||||
|
{
|
||||||
|
"name": "n_distinct",
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
],
|
||||||
"seclabels": []
|
"seclabels": []
|
||||||
},
|
},
|
||||||
"expected_sql_file": "create_column_numeric.sql",
|
"expected_sql_file": "create_column_numeric.sql",
|
||||||
@ -214,7 +295,36 @@
|
|||||||
"attlen": "15",
|
"attlen": "15",
|
||||||
"attprecision": "6",
|
"attprecision": "6",
|
||||||
"description": "Comment for alter",
|
"description": "Comment for alter",
|
||||||
"attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]}
|
"attacl": {
|
||||||
|
"added": [
|
||||||
|
{
|
||||||
|
"grantee": "PUBLIC",
|
||||||
|
"grantor": "postgres",
|
||||||
|
"privileges": [
|
||||||
|
{
|
||||||
|
"privilege_type": "a",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "r",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "w",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"privilege_type": "x",
|
||||||
|
"privilege": true,
|
||||||
|
"with_grant": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_column_numeric.sql",
|
"expected_sql_file": "alter_column_numeric.sql",
|
||||||
"expected_msql_file": "alter_column_numeric.msql"
|
"expected_msql_file": "alter_column_numeric.msql"
|
||||||
@ -241,7 +351,6 @@
|
|||||||
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#"
|
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Column with identity (Generated by default)",
|
"name": "Create Column with identity (Generated by default)",
|
||||||
@ -311,6 +420,78 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#"
|
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "create",
|
||||||
|
"name": "Create Column with identity (BY DEFAULT) for combination of identity options & initiate START",
|
||||||
|
"endpoint": "NODE-column.obj",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql",
|
||||||
|
"data": {
|
||||||
|
"name": "col_6_$%{}[]()&*^!@\"'`\\/#",
|
||||||
|
"cltype": "bigint",
|
||||||
|
"attacl": [],
|
||||||
|
"description": "demo comments",
|
||||||
|
"is_primary_key": false,
|
||||||
|
"attnotnull": true,
|
||||||
|
"attlen": null,
|
||||||
|
"attprecision": null,
|
||||||
|
"attidentity": "d",
|
||||||
|
"seqincrement": "1",
|
||||||
|
"seqstart": "1",
|
||||||
|
"seqmin": "1",
|
||||||
|
"seqmax": "10",
|
||||||
|
"seqcache": "1",
|
||||||
|
"seqcycle": true,
|
||||||
|
"colconstype": "i",
|
||||||
|
"attoptions": [],
|
||||||
|
"seclabels": []
|
||||||
|
},
|
||||||
|
"expected_sql_file": "create_column_identity_for_restart_seq.sql",
|
||||||
|
"expected_msql_file": "create_column_identity_for_restart_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alter identity Column (BY DEFAULT) to ALWAYS & Update START",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql_id",
|
||||||
|
"data": {
|
||||||
|
"attnotnull": true,
|
||||||
|
"attidentity": "a",
|
||||||
|
"seqstart": 2,
|
||||||
|
"seqcycle": false
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_column_identity_for_restart_seq.sql",
|
||||||
|
"expected_msql_file": "alter_column_identity_for_restart_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alter identity Column (ALWAYS) for combination of identity options & Update START",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql_id",
|
||||||
|
"data": {
|
||||||
|
"attnum": 9,
|
||||||
|
"attidentity": "a",
|
||||||
|
"seqincrement": "3",
|
||||||
|
"seqstart": "3",
|
||||||
|
"seqmin": "3",
|
||||||
|
"seqmax": "30",
|
||||||
|
"seqcache": "3",
|
||||||
|
"seqcycle": true
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_column_identity_for_comb_start_seq.sql",
|
||||||
|
"expected_msql_file": "alter_column_identity_for_comb_start_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "delete",
|
||||||
|
"name": "Drop Column with identity (ALWAYS)",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"data": {
|
||||||
|
"name": "col_6_$%{}[]()&*^!@\"'`\\/#"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ALTER COLUMN "col_6_$%{}[]()&*^!@""'`\/#" SET CYCLE SET INCREMENT 3 RESTART SET START 3 SET MINVALUE 3 SET MAXVALUE 30 SET CACHE 3;
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 3 START 3 MINVALUE 3 MAXVALUE 30 CACHE 3 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ALTER COLUMN "col_6_$%{}[]()&*^!@""'`\/#" SET GENERATED ALWAYS SET NO CYCLE RESTART SET START 2;
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 2 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -0,0 +1,9 @@
|
|||||||
|
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
|
||||||
|
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_6_$%{}[]()&*^!@""'`\/#";
|
||||||
|
|
||||||
|
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
|
||||||
|
ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 );
|
||||||
|
|
||||||
|
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#"
|
||||||
|
IS 'demo comments';
|
@ -448,7 +448,78 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"name": "new_col_9_$%{}[]()&*^!@\"'`\\/#"
|
"name": "new_col_9_$%{}[]()&*^!@\"'`\\/#"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "create",
|
||||||
|
"name": "Create Column with identity (BY DEFAULT) for combination of identity options & initiate START",
|
||||||
|
"endpoint": "NODE-column.obj",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql",
|
||||||
|
"data": {
|
||||||
|
"name": "col_6_$%{}[]()&*^!@\"'`\\/#",
|
||||||
|
"cltype": "bigint",
|
||||||
|
"attacl": [],
|
||||||
|
"description": "demo comments",
|
||||||
|
"is_primary_key": false,
|
||||||
|
"attnotnull": true,
|
||||||
|
"attlen": null,
|
||||||
|
"attprecision": null,
|
||||||
|
"attidentity": "d",
|
||||||
|
"seqincrement": "1",
|
||||||
|
"seqstart": "1",
|
||||||
|
"seqmin": "1",
|
||||||
|
"seqmax": "10",
|
||||||
|
"seqcache": "1",
|
||||||
|
"seqcycle": true,
|
||||||
|
"colconstype": "i",
|
||||||
|
"attoptions": [],
|
||||||
|
"seclabels": []
|
||||||
|
},
|
||||||
|
"expected_sql_file": "create_column_identity_for_restart_seq.sql",
|
||||||
|
"expected_msql_file": "create_column_identity_for_restart_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alter identity Column (BY DEFAULT) to ALWAYS & Update START",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql_id",
|
||||||
|
"data": {
|
||||||
|
"attnotnull": true,
|
||||||
|
"attidentity": "a",
|
||||||
|
"seqstart": 2,
|
||||||
|
"seqcycle": false
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_column_identity_for_restart_seq.sql",
|
||||||
|
"expected_msql_file": "alter_column_identity_for_restart_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alter identity Column (ALWAYS) for combination of identity options & Update START",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"msql_endpoint": "NODE-column.msql_id",
|
||||||
|
"data": {
|
||||||
|
"attnum": 9,
|
||||||
|
"attidentity": "a",
|
||||||
|
"seqincrement": "3",
|
||||||
|
"seqstart": "3",
|
||||||
|
"seqmin": "3",
|
||||||
|
"seqmax": "30",
|
||||||
|
"seqcache": "3",
|
||||||
|
"seqcycle": true
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_column_identity_for_comb_start_seq.sql",
|
||||||
|
"expected_msql_file": "alter_column_identity_for_comb_start_seq.msql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "delete",
|
||||||
|
"name": "Drop Column with identity (ALWAYS)",
|
||||||
|
"endpoint": "NODE-column.obj_id",
|
||||||
|
"sql_endpoint": "NODE-column.sql_id",
|
||||||
|
"data": {
|
||||||
|
"name": "col_6_$%{}[]()&*^!@\"'`\\/#"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ class ColumnPutTestCase(BaseTestGenerator):
|
|||||||
'seqmin': 1,
|
'seqmin': 1,
|
||||||
'seqmax': 10,
|
'seqmax': 10,
|
||||||
'seqcache': 1,
|
'seqcache': 1,
|
||||||
|
'colconstype': 'i',
|
||||||
'seqcycle': True
|
'seqcycle': True
|
||||||
})),
|
})),
|
||||||
('Edit column to Identity column as Default', dict(
|
('Edit column to Identity column as Default', dict(
|
||||||
@ -63,6 +64,7 @@ class ColumnPutTestCase(BaseTestGenerator):
|
|||||||
'seqmin': 2,
|
'seqmin': 2,
|
||||||
'seqmax': 2000,
|
'seqmax': 2000,
|
||||||
'seqcache': 1,
|
'seqcache': 1,
|
||||||
|
'colconstype': 'i',
|
||||||
'seqcycle': True
|
'seqcycle': True
|
||||||
})),
|
})),
|
||||||
('Edit column Drop Identity by changing constraint type to NONE',
|
('Edit column Drop Identity by changing constraint type to NONE',
|
||||||
|
@ -38,6 +38,9 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
|||||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} {% if data.attnotnull %}SET{% else %}DROP{% endif %} NOT NULL;
|
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} {% if data.attnotnull %}SET{% else %}DROP{% endif %} NOT NULL;
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if data.seqincrement or (data.seqcycle or (data.seqcycle == False and data.seqcycle != o_data.seqcycle)) or data.seqincrement or data.seqstart or data.seqmin or data.seqmax or data.seqcache %}
|
||||||
|
{% set attidentity_params = true %}{% else %}
|
||||||
|
{% set attidentity_params = false %}{% endif %}
|
||||||
{### Alter column - add identity ###}
|
{### Alter column - add identity ###}
|
||||||
{% if data.colconstype == 'i' and 'attidentity' in data and o_data.attidentity == '' and data.attidentity != o_data.attidentity %}
|
{% if data.colconstype == 'i' and 'attidentity' in data and o_data.attidentity == '' and data.attidentity != o_data.attidentity %}
|
||||||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||||
@ -51,24 +54,22 @@ MINVALUE {{data.seqmin|int}} {% endif %}{% if data.seqmax is defined and data.se
|
|||||||
MAXVALUE {{data.seqmax|int}} {% endif %}{% if data.seqcache is defined and data.seqcache|int(-1) > -1%}
|
MAXVALUE {{data.seqmax|int}} {% endif %}{% if data.seqcache is defined and data.seqcache|int(-1) > -1%}
|
||||||
CACHE {{data.seqcache|int}} {% endif %}
|
CACHE {{data.seqcache|int}} {% endif %}
|
||||||
{% if data.seqincrement or data.seqcycle or data.seqincrement or data.seqstart or data.seqmin or data.seqmax or data.seqcache %}){% endif %};
|
{% if data.seqincrement or data.seqcycle or data.seqincrement or data.seqstart or data.seqmin or data.seqmax or data.seqcache %}){% endif %};
|
||||||
{% endif %}
|
|
||||||
{### Alter column - change identity ###}
|
{### Alter column - change identity - sequence options ###}
|
||||||
|
{% elif 'attidentity' in data or attidentity_params %}
|
||||||
{% if 'attidentity' in data and data.attidentity != '' and o_data.attidentity != '' and data.attidentity != o_data.attidentity %}
|
{% if 'attidentity' in data and data.attidentity != '' and o_data.attidentity != '' and data.attidentity != o_data.attidentity %}
|
||||||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET GENERATED {% if data.attidentity == 'a' %}ALWAYS{% else%}BY DEFAULT{% endif %};
|
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET GENERATED {% if data.attidentity == 'a' %}ALWAYS{% else%}BY DEFAULT{% endif %}{% if attidentity_params is false %};{% else %}{% endif %}
|
||||||
|
{% else %}
|
||||||
{% endif %}
|
|
||||||
{### Alter column - change identity - sequence options ###}
|
|
||||||
{% if 'attidentity' not in data and (data.seqincrement or data.seqcycle or data.seqincrement or data.seqstart or data.seqmin or data.seqmax or data.seqcache) %}
|
|
||||||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}} {% else %}{{conn|qtTypeIdent(o_data.name)}} {% endif %}
|
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %}{% endif %}
|
||||||
{% if data.seqcycle %}
|
{% if data.seqcycle %} SET CYCLE{% elif (data.seqcycle == False and o_data.seqcycle and data.seqcycle != o_data.seqcycle) %} SET NO CYCLE{% endif %}
|
||||||
SET CYCLE {% endif %}{% if data.seqincrement is defined and data.seqincrement|int(-1) > -1 %}
|
{% if data.seqincrement is defined and data.seqincrement|int(-1) > -1 %} SET INCREMENT {{data.seqincrement|int}}{% endif %}
|
||||||
SET INCREMENT {{data.seqincrement|int}} {% endif %}{% if data.seqstart is defined and data.seqstart|int(-1) > -1%}
|
{% if data.seqstart is defined and data.seqstart|int(-1) > -1%} RESTART SET START {{data.seqstart|int}}{% endif %}
|
||||||
SET START {{data.seqstart|int}} {% endif %}{% if data.seqmin is defined and data.seqmin|int(-1) > -1%}
|
{% if data.seqmin is defined and data.seqmin|int(-1) > -1%} SET MINVALUE {{data.seqmin|int}}{% endif %}
|
||||||
SET MINVALUE {{data.seqmin|int}} {% endif %}{% if data.seqmax is defined and data.seqmax|int(-1) > -1%}
|
{% if data.seqmax is defined and data.seqmax|int(-1) > -1%} SET MAXVALUE {{data.seqmax|int}}{% endif %}
|
||||||
SET MAXVALUE {{data.seqmax|int}} {% endif %}{% if data.seqcache is defined and data.seqcache|int(-1) > -1%}
|
{% if data.seqcache is defined and data.seqcache|int(-1) > -1%} SET CACHE {{data.seqcache|int}}{% endif %}{% if attidentity_params is true %};{% endif %}
|
||||||
SET CACHE {{data.seqcache|int}} {% endif %};
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{### Alter column - drop identity when column constraint is changed###}
|
{### Alter column - drop identity when column constraint is changed###}
|
||||||
|
Loading…
Reference in New Issue
Block a user