Add Reverse Engineered SQL tests for Columns. Fixes #4546

This commit is contained in:
Murtuza Zabuawala 2019-08-16 17:36:13 +05:30 committed by Akshay Joshi
parent 687204771c
commit 3f541200d9
39 changed files with 1202 additions and 0 deletions

View File

@ -22,6 +22,7 @@ New features
Housekeeping
************
| `Issue #4546 <https://redmine.postgresql.org/issues/4546>`_ - Add Reverse Engineered SQL tests for Columns.
| `Issue #4554 <https://redmine.postgresql.org/issues/4554>`_ - Add Reverse Engineered SQL tests for Trigger Functions.
| `Issue #4555 <https://redmine.postgresql.org/issues/4555>`_ - Add Reverse Engineered SQL tests for Exclusion Constraint.
| `Issue #4560 <https://redmine.postgresql.org/issues/4560>`_ - Add a --modules option to the RE-SQL test suite to allow testing of specific object types.

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" character(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_3_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_3_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_3_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#" bigint NOT NULL;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_3_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_3_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_3_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 2 START 1 MINVALUE 1 MAXVALUE 200 CACHE 2 );
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" real NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT ALL("new_col_1_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,15 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_4_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_4_$%{}[]()&*^!@""'`\/#" numeric(15,0) NOT NULL;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_4_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);
GRANT ALL("new_col_4_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_5_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,13 @@
-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_4_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" numeric(10,5) NOT NULL;
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_4_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);

View File

@ -0,0 +1,279 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table for testing column node (v.10+)",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "table_2_$%{}[]()&*^!@\"'`\\/#",
"is_partitioned": false,
"columns": [],
"schema": "testschema"
},
"store_table_id": true
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":"1"
},
"expected_sql_file": "create_column_int.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 1,
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_int.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Character type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"character varying",
"collspcname": "pg_catalog.\"C\"",
"attacl":[],
"is_primary_key":false,
"attnotnull":false,
"attlen":"50",
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":null
},
"expected_sql_file": "create_column_char.sql"
},
{
"type": "alter",
"name": "Alter Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstorage": "p",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_char.sql"
},
{
"type": "delete",
"name": "Drop Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type) with identity",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_3_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"attidentity":"a",
"seqincrement":"1",
"seqstart":"1",
"seqmin":"1",
"seqmax":"99999",
"seqcache":"10",
"seqcycle":true,
"colconstype":"i"
},
"expected_sql_file": "create_column_int_identity.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) with identity",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 3,
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#",
"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}]}]}
},
"expected_sql_file": "alter_column_identity.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) drop identity",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 3,
"colconstype": "n"
},
"expected_sql_file": "alter_column_drop_identity.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_4_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"min_val":0,
"max_val":1000,
"cltype":"numeric",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":"10",
"attprecision":"5",
"attidentity":"a",
"attoptions":[{"name":"n_distinct","value":"1"}],
"seclabels":[]
},
"expected_sql_file": "create_column_numeric.sql"
},
{
"type": "alter",
"name": "Alter Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#",
"attnum": 4,
"attlen":"15",
"attprecision":"0",
"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}]}]}
},
"expected_sql_file": "alter_column_numeric.sql"
},
{
"type": "delete",
"name": "Drop Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column with identity (Generated by default)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_5_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"attidentity":"d",
"seqincrement":"1",
"seqstart":"1",
"seqmin":"1",
"seqmax":"99999",
"seqcache":"10",
"seqcycle":true,
"colconstype":"i"
},
"expected_sql_file": "create_column_int_identity_by_default.sql"
},
{
"type": "alter",
"name": "Alter Column with identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 5,
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"seqincrement":"2",
"seqmax":"200",
"seqcache":"2",
"seqcycle":true,
"seqmin":"1"
},
"expected_sql_file": "alter_column_identity_by_default.sql"
},
{
"type": "alter",
"name": "Alter Column with drop identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 5,
"colconstype": "n"
},
"expected_sql_file": "alter_column_drop_identity_by_default.sql"
},
{
"type": "delete",
"name": "Drop Column Column with identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#"
}
}
]
}

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" character(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_3_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_3_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_3_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_9_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_9_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_9_$%{}[]()&*^!@""'`\/#" bigint NOT NULL;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_9_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_4_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_4_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (((1 + 2) + 3)) STORED;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_4_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_4_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_4_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_4_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_8_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_8_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_8_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS ((dummy1 + dummy2)) STORED;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_8_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_8_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_8_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_8_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_3_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_3_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_3_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_9_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_9_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_9_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 2 START 1 MINVALUE 1 MAXVALUE 200 CACHE 2 );
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_9_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" real NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT ALL("new_col_1_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,15 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#" numeric(15,0) NOT NULL;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_5_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_5_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);
GRANT ALL("new_col_5_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_4_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (((1 + 2) + 3)) STORED;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_8_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_8_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_8_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS ((dummy1 + dummy2)) STORED;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_8_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_9_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_9_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_9_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_9_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,13 @@
-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_5_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" numeric(10,5) NOT NULL;
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_5_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);

View File

@ -0,0 +1,407 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table for testing column node (v.12+)",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "table_3_$%{}[]()&*^!@\"'`\\/#",
"is_partitioned": false,
"columns": [],
"schema": "testschema"
},
"store_table_id": true
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":"1"
},
"expected_sql_file": "create_column_int.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 1,
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_int.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Character type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"character varying",
"collspcname": "pg_catalog.\"C\"",
"attacl":[],
"is_primary_key":false,
"attnotnull":false,
"attlen":"50",
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":null
},
"expected_sql_file": "create_column_char.sql"
},
{
"type": "alter",
"name": "Alter Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstorage": "p",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_char.sql"
},
{
"type": "delete",
"name": "Drop Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type) with identity",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_3_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"attidentity":"a",
"seqincrement":"1",
"seqstart":"1",
"seqmin":"1",
"seqmax":"99999",
"seqcache":"10",
"seqcycle":true,
"colconstype":"i"
},
"expected_sql_file": "create_column_int_identity.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) with identity",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 3,
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#",
"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}]}]}
},
"expected_sql_file": "alter_column_identity.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) drop identity",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 3,
"colconstype": "n"
},
"expected_sql_file": "alter_column_drop_identity.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type) with Generated feature",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_4_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":false,
"attlen":null,
"attprecision":null,
"attidentity":"a",
"colconstype":"g",
"genexpr":"1 + 2 + 3",
"attoptions":[],
"seclabels":[]
},
"expected_sql_file": "create_column_int_generated.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) with Generated feature",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 4,
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#",
"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}]}]}
},
"expected_sql_file": "alter_column_generated.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_4_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_5_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"min_val":0,
"max_val":1000,
"cltype":"numeric",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":"10",
"attprecision":"5",
"attidentity":"a",
"attoptions":[{"name":"n_distinct","value":"1"}],
"seclabels":[]
},
"expected_sql_file": "create_column_numeric.sql"
},
{
"type": "alter",
"name": "Alter Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#",
"attnum": 5,
"attlen":"15",
"attprecision":"0",
"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}]}]}
},
"expected_sql_file": "alter_column_numeric.sql"
},
{
"type": "delete",
"name": "Drop Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_5_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Dummy Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "dummy1",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":"1"
}
},
{
"type": "create",
"name": "Create Dummy Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "dummy2",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":"1"
}
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type) with Generated feature with columns",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_8_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":false,
"attlen":null,
"attprecision":null,
"attidentity":"a",
"colconstype":"g",
"genexpr":"dummy1 + dummy2",
"attoptions":[],
"seclabels":[]
},
"expected_sql_file": "create_column_int_generated_with_existing_columns.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type) with Generated feature with columns",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 8,
"name": "new_col_8_$%{}[]()&*^!@\"'`\\/#",
"genexpr":"dummy1 - dummy2",
"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}]}]}
},
"expected_sql_file": "alter_column_generated_with_existing_columns.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type) with Generated feature with columns",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_8_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column with identity (Generated by default)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_9_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"attidentity":"d",
"seqincrement":"1",
"seqstart":"1",
"seqmin":"1",
"seqmax":"99999",
"seqcache":"10",
"seqcycle":true,
"colconstype":"i"
},
"expected_sql_file": "create_column_int_identity_by_default.sql"
},
{
"type": "alter",
"name": "Alter Column with identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 9,
"name": "new_col_9_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"seqincrement":"2",
"seqmax":"200",
"seqcache":"2",
"seqcycle":true,
"seqmin":"1"
},
"expected_sql_file": "alter_column_identity_by_default.sql"
},
{
"type": "alter",
"name": "Alter Column with drop identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 9,
"colconstype": "n"
},
"expected_sql_file": "alter_column_drop_identity_by_default.sql"
},
{
"type": "delete",
"name": "Drop Column Column with identity (Generated by default)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_9_$%{}[]()&*^!@\"'`\\/#"
}
}
]
}

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" character(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_1_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,11 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_1_$%{}[]()&*^!@""'`\/#" real NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
GRANT ALL("new_col_1_$%{}[]()&*^!@""'`\/#") ON testschema."table_1_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,15 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#" numeric(15,0) NOT NULL;
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_3_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);
GRANT ALL("new_col_3_$%{}[]()&*^!@""'`\/#") ON testschema."table_1_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_2_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C";
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,9 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_1_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1;
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';

View File

@ -0,0 +1,13 @@
-- Column: testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" numeric(10,5) NOT NULL;
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "col_3_$%{}[]()&*^!@""'`\/#"
SET (n_distinct=1);

View File

@ -0,0 +1,154 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table for testing column node (Ver.default)",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "table_1_$%{}[]()&*^!@\"'`\\/#",
"is_partitioned": false,
"columns": [],
"schema": "testschema"
},
"store_table_id": true
},
{
"type": "create",
"name": "Create Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"bigint",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":null,
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":"1"
},
"expected_sql_file": "create_column_int.sql"
},
{
"type": "alter",
"name": "Alter Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 1,
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_int.sql"
},
{
"type": "delete",
"name": "Drop Column (Integer/Numeric type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_1_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Character type)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_2_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"cltype":"character varying",
"collspcname": "pg_catalog.\"C\"",
"attacl":[],
"is_primary_key":false,
"attnotnull":false,
"attlen":"50",
"attprecision":null,
"attoptions":[],
"seclabels":[],
"defval":null
},
"expected_sql_file": "create_column_char.sql"
},
{
"type": "alter",
"name": "Alter Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstorage": "p",
"description": "Comment for alter",
"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}]}]}
},
"expected_sql_file": "alter_column_char.sql"
},
{
"type": "delete",
"name": "Drop Column (Character type)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "col_3_$%{}[]()&*^!@\"'`\\/#",
"description": "Comment for create",
"min_val":0,
"max_val":1000,
"cltype":"numeric",
"attacl":[],
"is_primary_key":false,
"attnotnull":true,
"attlen":"10",
"attprecision":"5",
"attidentity":"a",
"attoptions":[{"name":"n_distinct","value":"1"}],
"seclabels":[]
},
"expected_sql_file": "create_column_numeric.sql"
},
{
"type": "alter",
"name": "Alter Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#",
"attnum": 3,
"attlen":"15",
"attprecision":"0",
"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}]}]}
},
"expected_sql_file": "alter_column_numeric.sql"
},
{
"type": "delete",
"name": "Drop Column (Numeric type with Length Precision & Variables)",
"endpoint": "NODE-column.obj_id",
"sql_endpoint": "NODE-column.sql_id",
"data": {
"name": "new_col_3_$%{}[]()&*^!@\"'`\\/#"
}
}
]
}

View File

@ -32,3 +32,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