diff --git a/docs/en_US/images/table_advanced.png b/docs/en_US/images/table_advanced.png index ec138cd35..49aac77c4 100644 Binary files a/docs/en_US/images/table_advanced.png and b/docs/en_US/images/table_advanced.png differ diff --git a/docs/en_US/table_dialog.rst b/docs/en_US/table_dialog.rst index 025d0d85b..9ebcbfc72 100644 --- a/docs/en_US/table_dialog.rst +++ b/docs/en_US/table_dialog.rst @@ -418,13 +418,21 @@ not-null constraints; after saving the new or modified table, any changes to the original table will not be applied to the new table. * Use the drop-down listbox next to *Relation* to select a reference table. -* Move the *With default values?* switch to the *Yes* position to copy default +* Move the switch next to *With default values?* towards the *right position* to copy default values. -* Move the *With constraints?* switch to the *Yes* position to copy table and +* Move the switch next to *With constraints?* towards the *right position* to copy table and column constraints. -* Move the *With indexes?* switch to the *Yes* position to copy indexes. -* Move the *With storage?* switch to the *Yes* position to copy storage settings. -* Move the *With comments?* switch to the *Yes* position to copy comments. +* Move the switch next to *With indexes?* towards the *right position* to copy indexes. +* Move the switch next to *With storage?* towards the *right position* to copy storage settings. +* Move the switch next to *With comments?* towards the *right position* to copy comments. +* Move the switch next to *With compression?* towards the *right position* to copy + compression method. This option is available only on PostgreSQL 14 and above. +* Move the switch next to *With generated?* towards the *right position* to copy + generation expressions of copied column. This option is available only on PostgreSQL 12 and above. +* Move the switch next to *With identity?* towards the *right position* to copy + any identity specifications of copied column. +* Move the switch next to *With statistics?* towards the *right position* to copy + extended statistics. With PostgreSQL 10 forward, the *Partition* tab will be visible. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js index c276f652f..2495842d3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.ui.js @@ -231,6 +231,10 @@ export class LikeSchema extends BaseUISchema { like_indexes: false, like_storage: false, like_comments: false, + like_compression: false, + like_generated: false, + like_identity: false, + like_statistics: false }; } } @@ -256,22 +260,46 @@ export class LikeSchema extends BaseUISchema { id: 'like_default_value', label: gettext('With default values?'), type: 'switch', mode: ['create'], deps: ['like_relation'], disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, },{ id: 'like_constraints', label: gettext('With constraints?'), type: 'switch', mode: ['create'], deps: ['like_relation'], disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, },{ id: 'like_indexes', label: gettext('With indexes?'), type: 'switch', mode: ['create'], deps: ['like_relation'], disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, },{ id: 'like_storage', label: gettext('With storage?'), type: 'switch', mode: ['create'], deps: ['like_relation'], disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, },{ id: 'like_comments', label: gettext('With comments?'), type: 'switch', mode: ['create'], deps: ['like_relation'], disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, + },{ + id: 'like_compression', label: gettext('With compression?'), + type: 'switch', mode: ['create'], deps: ['like_relation'], + disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + min_version: 140000, inlineNext: true, + },{ + id: 'like_generated', label: gettext('With generated?'), + type: 'switch', mode: ['create'], deps: ['like_relation'], + disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + min_version: 120000, inlineNext: true, + },{ + id: 'like_identity', label: gettext('With identity?'), + type: 'switch', mode: ['create'], deps: ['like_relation'], + disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), + inlineNext: true, + },{ + id: 'like_statistics', label: gettext('With statistics?'), + type: 'switch', mode: ['create'], deps: ['like_relation'], + disabled: this.isRelationDisable, depChange: (...args)=>obj.resetVals(...args), } ]; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql index 64c22707c..ea21997d6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql @@ -34,7 +34,11 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if add_not_exists INCLUDING STORAGE{% endif %}{% if data.like_comments %} - INCLUDING COMMENTS{% endif %}{% if data.columns|length > 0 %}, + INCLUDING COMMENTS{% endif %}{% if data.like_identity %} + + INCLUDING IDENTITY{% endif %}{% if data.like_statistics %} + + INCLUDING STATISTICS{% endif %}{% if data.columns|length > 0 %}, {% endif %} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql index 09fa59160..6879ee3c0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql @@ -38,7 +38,13 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if add_not_exists INCLUDING STORAGE{% endif %}{% if data.like_comments %} - INCLUDING COMMENTS{% endif %}{% if data.columns|length > 0 %}, + INCLUDING COMMENTS{% endif %}{% if data.like_generated %} + + INCLUDING GENERATED{% endif %}{% if data.like_identity %} + + INCLUDING IDENTITY{% endif %}{% if data.like_statistics %} + + INCLUDING STATISTICS{% endif %}{% if data.columns|length > 0 %}, {% endif %} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql new file mode 100644 index 000000000..1924ccb95 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql @@ -0,0 +1,235 @@ +{% import 'macros/schemas/security.macros' as SECLABEL %} +{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} +{% import 'macros/variable.macros' as VARIABLE %} +{% import 'columns/macros/security.macros' as COLUMN_SECLABEL %} +{% import 'columns/macros/privilege.macros' as COLUMN_PRIVILEGE %} +{% import 'tables/sql/macros/constraints.macro' as CONSTRAINTS %} +{% import 'types/macros/get_full_type_sql_format.macros' as GET_TYPE %} +{#===========================================#} +{#====== MAIN TABLE TEMPLATE STARTS HERE ======#} +{#===========================================#} +{# + If user has not provided any details but only name then + add empty bracket with table name +#} +{% set empty_bracket = ""%} +{% if data.coll_inherits|length == 0 and data.columns|length == 0 and not data.typname and not data.like_relation and data.primary_key|length == 0 and data.unique_constraint|length == 0 and data.foreign_key|length == 0 and data.check_constraint|length == 0 and data.exclude_constraint|length == 0 %} +{% set empty_bracket = "\n(\n)"%} +{% endif %} +{% set with_clause = false%} +{% if data.fillfactor or data.parallel_workers or data.toast_tuple_target or (data.autovacuum_custom and data.add_vacuum_settings_in_sql) or data.autovacuum_enabled in ('t', 'f') or (data.toast_autovacuum and data.add_vacuum_settings_in_sql) or data.toast_autovacuum_enabled in ('t', 'f') %} +{% set with_clause = true%} +{% endif %} +CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}} +{% if data.typname %} + OF {{ data.typname }} +{% endif %} +{% if data.like_relation or data.coll_inherits or data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %} +( +{% endif %} +{% if data.like_relation %} + LIKE {{ data.like_relation }}{% if data.like_default_value %} + + INCLUDING DEFAULTS{% endif %}{% if data.like_constraints %} + + INCLUDING CONSTRAINTS{% endif %}{% if data.like_indexes %} + + INCLUDING INDEXES{% endif %}{% if data.like_storage %} + + INCLUDING STORAGE{% endif %}{% if data.like_comments %} + + INCLUDING COMMENTS{% endif %}{% if data.like_compression %} + + INCLUDING COMPRESSION{% endif %}{% if data.like_generated %} + + INCLUDING GENERATED{% endif %}{% if data.like_identity %} + + INCLUDING IDENTITY{% endif %}{% if data.like_statistics %} + + INCLUDING STATISTICS{% endif %}{% if data.columns|length > 0 %}, +{% endif %} + +{% endif %} +{### Add columns ###} +{% if data.columns and data.columns|length > 0 %} +{% for c in data.columns %} +{% if c.name and c.cltype %} + {% if c.inheritedfromtable %}-- Inherited from table {{c.inheritedfromtable}}: {% elif c.inheritedfromtype %}-- Inherited from type {{c.inheritedfromtype}}: {% endif %}{{conn|qtIdent(c.name)}} {% if is_sql %}{{c.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, c.cltype, c.attlen, c.attprecision, c.hasSqrBracket) }}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.attnotnull %} NOT NULL{% endif %}{% if c.defval is defined and c.defval is not none and c.defval != '' and c.colconstype != 'g' %} DEFAULT {{c.defval}}{% endif %} +{% if c.colconstype == 'i' and c.attidentity and c.attidentity != '' %} +{% if c.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif c.attidentity == 'd' %} GENERATED BY DEFAULT AS IDENTITY{% endif %} +{% if c.seqincrement or c.seqcycle or c.seqincrement or c.seqstart or c.seqmin or c.seqmax or c.seqcache %} ( {% endif %} +{% if c.seqcycle is defined and c.seqcycle %} +CYCLE {% endif %}{% if c.seqincrement is defined and c.seqincrement|int(-1) > -1 %} +INCREMENT {{c.seqincrement|int}} {% endif %}{% if c.seqstart is defined and c.seqstart|int(-1) > -1%} +START {{c.seqstart|int}} {% endif %}{% if c.seqmin is defined and c.seqmin|int(-1) > -1%} +MINVALUE {{c.seqmin|int}} {% endif %}{% if c.seqmax is defined and c.seqmax|int(-1) > -1%} +MAXVALUE {{c.seqmax|int}} {% endif %}{% if c.seqcache is defined and c.seqcache|int(-1) > -1%} +CACHE {{c.seqcache|int}} {% endif %} +{% if c.seqincrement or c.seqcycle or c.seqincrement or c.seqstart or c.seqmin or c.seqmax or c.seqcache %}){% endif %} +{% endif %} +{% if c.colconstype == 'g' and c.genexpr and c.genexpr != '' %} GENERATED ALWAYS AS ({{c.genexpr}}) STORED{% endif %} +{% if not loop.last %}, +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +{# Macro to render for constraints #} +{% if data.primary_key|length > 0 %}{% if data.columns|length > 0 %},{% endif %} +{{CONSTRAINTS.PRIMARY_KEY(conn, data.primary_key[0])}}{% endif %}{% if data.unique_constraint|length > 0 %}{% if data.columns|length > 0 or data.primary_key|length > 0 %},{% endif %} +{{CONSTRAINTS.UNIQUE(conn, data.unique_constraint)}}{% endif %}{% if data.foreign_key|length > 0 %}{% if data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 %},{% endif %} +{{CONSTRAINTS.FOREIGN_KEY(conn, data.foreign_key)}}{% endif %}{% if data.check_constraint|length > 0 %}{% if data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 %},{% endif %} +{{CONSTRAINTS.CHECK(conn, data.check_constraint)}}{% endif %}{% if data.exclude_constraint|length > 0 %}{% if data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 %},{% endif %} +{{CONSTRAINTS.EXCLUDE(conn, data.exclude_constraint)}}{% endif %} +{% if data.like_relation or data.coll_inherits or data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %} + +){% endif %}{% if data.relkind is defined and data.relkind == 'p' %} PARTITION BY {{ data.partition_scheme }}{% endif %} +{% if not data.coll_inherits and not data.spcname and not with_clause %};{% endif %} + +{### If we are inheriting it from another table(s) ###} +{% if data.coll_inherits %} + INHERITS ({% for val in data.coll_inherits %}{% if loop.index != 1 %}, {% endif %}{{val}}{% endfor %}){% if not data.spcname and not with_clause %};{% endif %} +{% endif %} + +{% if with_clause %} +{% set ns = namespace(add_comma=false) %} +WITH ( +{% if data.fillfactor %}{% set ns.add_comma = true%} + FILLFACTOR = {{ data.fillfactor }}{% endif %}{% if data.parallel_workers %} +{% if ns.add_comma %}, +{% endif %} + parallel_workers = {{ data.parallel_workers }}{% set ns.add_comma = true%}{% endif %}{% if data.toast_tuple_target %} +{% if ns.add_comma %}, +{% endif %} + toast_tuple_target = {{ data.toast_tuple_target }}{% set ns.add_comma = true%}{% endif %}{% if data.autovacuum_enabled in ('t', 'f') %} +{% if ns.add_comma %}, +{% endif %} + autovacuum_enabled = {% if data.autovacuum_enabled == 't' %}TRUE{% else %}FALSE{% endif %}{% set ns.add_comma = true%}{% endif %}{% if data.toast_autovacuum_enabled in ('t', 'f') %} +{% if ns.add_comma %}, +{% endif %} + toast.autovacuum_enabled = {% if data.toast_autovacuum_enabled == 't' %}TRUE{% else %}FALSE{% endif %}{% set ns.add_comma = true%}{% endif %}{% if data.autovacuum_custom %} +{% for opt in data.vacuum_table %}{% if opt.name and opt.value is defined %} +{% if ns.add_comma %}, +{% endif %} + {{opt.name}} = {{opt.value}}{% set ns.add_comma = true%}{% endif %} +{% endfor %}{% endif %}{% if data.toast_autovacuum %} +{% for opt in data.vacuum_toast %}{% if opt.name and opt.value is defined %} +{% if ns.add_comma %}, +{% endif %} + toast.{{opt.name}} = {{opt.value}}{% set ns.add_comma = true%}{% endif %} +{% endfor %}{% endif %} + +{% if data.spcname %}){% else %});{% endif %} + +{% endif %} +{### SQL for Tablespace ###} +{% if data.spcname %} +TABLESPACE {{ conn|qtIdent(data.spcname) }}; +{% endif %} +{### Alter SQL for Owner ###} +{% if data.relowner %} + +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + OWNER to {{conn|qtIdent(data.relowner)}}; +{% endif %} + +{#####################################################} +{## Enable Row Level Security Policy on table ##} +{#####################################################} +{% if data.rlspolicy %} +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + ENABLE ROW LEVEL SECURITY; +{% endif %} + +{#####################################################} +{## Force Enable Row Level Security Policy on table ##} +{#####################################################} +{% if data.forcerlspolicy %} +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + FORCE ROW LEVEL SECURITY; +{% endif %} + +{### Security Labels on Table ###} +{% if data.seclabels and data.seclabels|length > 0 %} + +{% for r in data.seclabels %} +{{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }} +{% endfor %} +{% endif %} +{### ACL on Table ###} +{% if data.revoke_all %} +{% for priv in data.revoke_all %} +{{ PRIVILEGE.UNSETALL(conn, "TABLE", priv, data.name, data.schema)}} +{% endfor %} +{% endif %} +{% if data.relacl %} + +{% for priv in data.relacl %} +{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }} +{% endfor %} +{% endif %} +{### SQL for COMMENT ###} +{% if data.description %} +COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}} + IS {{data.description|qtLiteral(conn)}}; +{% endif %} +{#===========================================#} +{#====== MAIN TABLE TEMPLATE ENDS HERE ======#} +{#===========================================#} +{#===========================================#} +{# COLUMN SPECIFIC TEMPLATES STARTS HERE #} +{#===========================================#} +{% if data.columns and data.columns|length > 0 %} +{% for c in data.columns %} +{% if c.description %} + +COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.name, c.name)}} + IS {{c.description|qtLiteral(conn)}}; +{% endif %} +{### Add variables to column ###} +{% if c.attoptions and c.attoptions|length > 0 %} + +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + {{ VARIABLE.SET(conn, 'COLUMN', c.name, c.attoptions) }} + +{% endif %} +{### Alter column statistics value ###} +{% if c.attstattarget is defined and c.attstattarget > -1 %} +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}}; + +{% endif %} +{### Alter column storage value ###} +{% if c.attstorage is defined and c.attstorage != c.defaultstorage %} +ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}} + ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STORAGE {%if c.attstorage == 'p' %} +PLAIN{% elif c.attstorage == 'm'%}MAIN{% elif c.attstorage == 'e'%} +EXTERNAL{% elif c.attstorage == 'x'%}EXTENDED{% endif %}; + +{% endif %} +{### ACL ###} +{% if c.attacl and c.attacl|length > 0 %} + +{% for priv in c.attacl %} +{{ COLUMN_PRIVILEGE.APPLY(conn, data.schema, data.name, c.name, priv.grantee, priv.without_grant, priv.with_grant) }} +{% endfor %} +{% endif %} +{### Security Lables ###} +{% if c.seclabels and c.seclabels|length > 0 %} + +{% for r in c.seclabels %} +{{ COLUMN_SECLABEL.APPLY(conn, 'COLUMN',data.schema, data.name, c.name, r.provider, r.label) }} +{% endfor %} +{% endif %} +{% endfor %} +{% endif %} +{#===========================================#} +{# COLUMN SPECIFIC TEMPLATES ENDS HERE #} +{#===========================================#} +{#======================================#} +{# CONSTRAINTS SPECIFIC TEMPLATES #} +{#======================================#} +{{CONSTRAINTS.CONSTRAINT_COMMENTS(conn, data.schema, data.name, data.primary_key)}} +{{CONSTRAINTS.CONSTRAINT_COMMENTS(conn, data.schema, data.name, data.unique_constraint)}} +{{CONSTRAINTS.CONSTRAINT_COMMENTS(conn, data.schema, data.name, data.foreign_key)}} +{{CONSTRAINTS.CONSTRAINT_COMMENTS(conn, data.schema, data.name, data.check_constraint)}} +{{CONSTRAINTS.CONSTRAINT_COMMENTS(conn, data.schema, data.name, data.exclude_constraint)}} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql index 09957feb5..3e5763781 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql @@ -34,7 +34,11 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if add_not_exists INCLUDING STORAGE{% endif %}{% if data.like_comments %} - INCLUDING COMMENTS{% endif %}{% if data.columns|length > 0 %}, + INCLUDING COMMENTS{% endif %}{% if data.like_identity %} + + INCLUDING IDENTITY{% endif %}{% if data.like_statistics %} + + INCLUDING STATISTICS{% endif %}{% if data.columns|length > 0 %}, {% endif %} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql index 08b348515..413d6bc2e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql @@ -22,7 +22,8 @@ COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#" -- Partitions SQL CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#" - FOR VALUES FROM ('20') TO ('25'); + FOR VALUES FROM ('20') TO ('25') +TABLESPACE pg_default; ALTER TABLE IF EXISTS public.cust_arr_small OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql index 59405123b..0db6496d2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql @@ -22,7 +22,8 @@ COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" -- Partitions SQL CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" - FOR VALUES WITH (modulus 2, remainder 1); + FOR VALUES WITH (modulus 2, remainder 1) +TABLESPACE pg_default; ALTER TABLE IF EXISTS public.cust_part11 OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json index d8fb1e51d..8d9b58cf8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json @@ -171,7 +171,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_without_primary_key.sql", @@ -397,7 +399,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk.sql", @@ -650,11 +654,1463 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk_chk.sql", "expected_msql_file": "create_table_with_pk_chk_msql.sql" + },{ + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "btree", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "=", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "postgres", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition with collate and opclass", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "partition_table_with_collate_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small", + "values_from": "'20'", + "values_to": "'25'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status", + "collationame": "\"C\"", + "op_class": "text_pattern_ops" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_partition_table_with_collate.sql", + "expected_msql_file": "create_partition_table_with_collate_msql.sql" } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql index 9d60a82b2..f25f7444f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql @@ -17,8 +17,8 @@ CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/# ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE, - CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>) + CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =) ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql index a70e2599f..87ec46022 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql @@ -1,3 +1,3 @@ ALTER TABLE IF EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>); + ADD CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql index b421c5b80..d3eb152c9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql @@ -18,9 +18,9 @@ ALTER TABLE IF EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" REVOKE ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" FROM PUBLIC; -GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO postgres; - GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; +GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO postgres; + COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql index dfadf3bb3..4c61edc1f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql @@ -18,7 +18,8 @@ COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#" -- Partitions SQL CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#" - FOR VALUES FROM ('20') TO ('25'); + FOR VALUES FROM ('20') TO ('25') +TABLESPACE pg_default; ALTER TABLE IF EXISTS public.cust_arr_small OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql index 8e83b8604..eb72d2770 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql @@ -18,7 +18,8 @@ COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" -- Partitions SQL CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" - FOR VALUES WITH (modulus 2, remainder 1); + FOR VALUES WITH (modulus 2, remainder 1) +TABLESPACE pg_default; ALTER TABLE IF EXISTS public.cust_part11 OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql index 2218a1684..19ac43efd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql @@ -6,6 +6,9 @@ CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS + INCLUDING GENERATED + INCLUDING IDENTITY + INCLUDING STATISTICS ); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql index 06710591e..9e88970ec 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql @@ -18,7 +18,8 @@ COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" -- Partitions SQL CREATE TABLE public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" - FOR VALUES IN ('ACTIVE'); + FOR VALUES IN ('ACTIVE') +TABLESPACE pg_default; ALTER TABLE IF EXISTS public.cust_active OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql index 3aa2d990c..b8adf5aad 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql @@ -15,7 +15,8 @@ ALTER TABLE IF EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" -- Partitions SQL CREATE TABLE public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" - FOR VALUES FROM ('20') TO ('25'); + FOR VALUES FROM ('20') TO ('25') +TABLESPACE pg_default; ALTER TABLE IF EXISTS public."cust_arr_small PARTITION" OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json index d8fb1e51d..cb606e371 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json @@ -171,7 +171,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_without_primary_key.sql", @@ -397,7 +400,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk.sql", @@ -650,11 +656,1464 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk_chk.sql", "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "btree", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "=", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + },{ + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + },{ + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_generated": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + },{ + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + },{ + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "postgres", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition with collate and opclass", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "partition_table_with_collate_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small", + "values_from": "'20'", + "values_to": "'25'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status", + "collationame": "\"C\"", + "op_class": "text_pattern_ops" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_partition_table_with_collate.sql", + "expected_msql_file": "create_partition_table_with_collate_msql.sql" } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..5c14ad797 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,20 @@ +CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + INCLUDING COMPRESSION + INCLUDING GENERATED + INCLUDING IDENTITY + INCLUDING STATISTICS + +); + +ALTER TABLE IF EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/test.json new file mode 100644 index 000000000..f413b3c9a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/14_plus/test.json @@ -0,0 +1,2126 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "btree", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "=", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + },{ + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + },{ + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_generated": true, + "like_compression": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + },{ + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + },{ + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "postgres", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition with collate and opclass", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "partition_table_with_collate_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small", + "values_from": "'20'", + "values_to": "'25'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status", + "collationame": "\"C\"", + "op_class": "text_pattern_ops" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_partition_table_with_collate.sql", + "expected_msql_file": "create_partition_table_with_collate_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql index 0c37babc9..b60897b3f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql @@ -17,8 +17,8 @@ CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/# ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE, - CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>) + CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =) ) WITH ( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql index a70e2599f..87ec46022 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql @@ -1,3 +1,3 @@ ALTER TABLE IF EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>); + ADD CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql index a415a72a0..9adc732bb 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql @@ -16,6 +16,8 @@ TABLESPACE pg_default; ALTER TABLE IF EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" OWNER to postgres; +REVOKE ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" FROM PUBLIC; + GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql index 7bac199e7..cf44cf35b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql @@ -6,6 +6,8 @@ CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS + INCLUDING IDENTITY + INCLUDING STATISTICS ) WITH ( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json index e9020c2f8..a520b6575 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json @@ -171,7 +171,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_without_primary_key.sql", @@ -397,7 +399,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk.sql", @@ -650,7 +654,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk_chk.sql", @@ -923,7 +929,9 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "preprocess_data": true, @@ -974,14 +982,14 @@ "added": [ { "name": "ex_constr", - "amname": "gist", + "amname": "btree", "columns": [ { "column": "col1", "is_exp": false, "order": false, "nulls_order": false, - "operator": "<>", + "operator": "=", "is_sort_nulls_applicable": false } ], @@ -1126,6 +1134,8 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, "autovacuum_custom": true }, "store_object_id": true, @@ -1304,6 +1314,8 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, "rlspolicy": true }, "store_object_id": true, @@ -1478,6 +1490,8 @@ "like_indexes": true, "like_storage": true, "like_comments": true, + "like_identity": true, + "like_statistics": true, "like_relation": "public.like_tbl" }, "store_object_id": true, @@ -1636,6 +1650,8 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, "autovacuum_custom": false }, "store_object_id": true, @@ -1785,6 +1801,8 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, "autovacuum_custom": false }, "store_object_id": true, @@ -1937,6 +1955,8 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, "autovacuum_custom": false }, "store_object_id": true, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json index d598b3e32..328234a51 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json @@ -1,5 +1,520 @@ { - "scenarios": [ { + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { "type": "create", "name": "Create Table with pk & check constraint", "endpoint": "NODE-table.obj", @@ -135,11 +650,1314 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk_chk.sql", "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "btree", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "=", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition with collate and opclass", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "partition_table_with_collate_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small", + "values_from": "'20'", + "values_to": "'25'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status", + "collationame": "\"C\"", + "op_class": "text_pattern_ops" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_partition_table_with_collate.sql", + "expected_msql_file": "create_partition_table_with_collate_msql.sql" } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql index b828c6c04..bde2430f6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql @@ -17,8 +17,8 @@ CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/# ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE, - CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>) + CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =) ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql index a70e2599f..87ec46022 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql @@ -1,3 +1,3 @@ ALTER TABLE IF EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>); + ADD CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql index d85d0d3cf..e3bd6833a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql @@ -6,6 +6,9 @@ CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS + INCLUDING GENERATED + INCLUDING IDENTITY + INCLUDING STATISTICS ); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json index 6419423fa..7b5a2f6e4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json @@ -171,7 +171,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_without_primary_key.sql", @@ -397,7 +400,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk.sql", @@ -650,7 +656,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "expected_sql_file": "create_table_with_pk_chk.sql", @@ -923,7 +932,10 @@ "like_constraints": false, "like_indexes": false, "like_storage": false, - "like_comments": false + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false }, "store_object_id": true, "preprocess_data": true, @@ -974,14 +986,14 @@ "added": [ { "name": "ex_constr", - "amname": "gist", + "amname": "btree", "columns": [ { "column": "col1", "is_exp": false, "order": false, "nulls_order": false, - "operator": "<>", + "operator": "=", "is_sort_nulls_applicable": false } ], @@ -1126,6 +1138,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "autovacuum_custom": true }, "store_object_id": true, @@ -1304,6 +1319,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "rlspolicy": true }, "store_object_id": true, @@ -1478,6 +1496,9 @@ "like_indexes": true, "like_storage": true, "like_comments": true, + "like_generated": true, + "like_identity": true, + "like_statistics": true, "like_relation": "public.like_tbl" }, "store_object_id": true, @@ -1636,6 +1657,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "autovacuum_custom": false }, "store_object_id": true, @@ -1785,6 +1809,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "autovacuum_custom": false }, "store_object_id": true, @@ -1935,6 +1962,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "autovacuum_custom": false }, "store_object_id": true, @@ -2087,6 +2117,9 @@ "like_indexes": false, "like_storage": false, "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, "autovacuum_custom": false }, "store_object_id": true, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..f4981881f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,20 @@ +CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + INCLUDING COMPRESSION + INCLUDING GENERATED + INCLUDING IDENTITY + INCLUDING STATISTICS + +); + +ALTER TABLE IF EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/test.json new file mode 100644 index 000000000..fb8d63e52 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/14_plus/test.json @@ -0,0 +1,2142 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "btree", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "=", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_generated": true, + "like_identity": true, + "like_statistics": true, + "like_compression": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition with collate and opclass", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "partition_table_with_collate_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small", + "values_from": "'20'", + "values_to": "'25'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status", + "collationame": "\"C\"", + "op_class": "text_pattern_ops" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "like_identity": false, + "like_statistics": false, + "like_generated": false, + "like_compression": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_partition_table_with_collate.sql", + "expected_msql_file": "create_partition_table_with_collate_msql.sql" + } + ] + } + \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql index 419ec278c..3a37ee358 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql @@ -17,8 +17,8 @@ CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/# ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE, - CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>) + CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =) ) WITH ( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql index a70e2599f..87ec46022 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql @@ -1,3 +1,3 @@ ALTER TABLE IF EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" - ADD CONSTRAINT ex_constr EXCLUDE USING gist ( - col1 WITH <>); + ADD CONSTRAINT ex_constr EXCLUDE USING btree ( + col1 WITH =); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql index 9e1f3c07c..072cc2df4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql @@ -16,6 +16,8 @@ TABLESPACE pg_default; ALTER TABLE IF EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" OWNER to enterprisedb; +REVOKE ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" FROM PUBLIC; + GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql index 38f2d914e..9b1fb27ee 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql @@ -6,6 +6,8 @@ CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS + INCLUDING IDENTITY + INCLUDING STATISTICS ) WITH ( diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json index c079c472a..bc4507846 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json @@ -974,14 +974,14 @@ "added": [ { "name": "ex_constr", - "amname": "gist", + "amname": "btree", "columns": [ { "column": "col1", "is_exp": false, "order": false, "nulls_order": false, - "operator": "<>", + "operator": "=", "is_sort_nulls_applicable": false } ], @@ -1478,6 +1478,8 @@ "like_indexes": true, "like_storage": true, "like_comments": true, + "like_identity": true, + "like_statistics": true, "like_relation": "public.like_tbl" }, "store_object_id": true, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/table_test_data.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/table_test_data.json index 109689d58..0c9301ba8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/table_test_data.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/table_test_data.json @@ -608,6 +608,131 @@ "error_msg": "Mocked Internal Server Error", "test_result_data": {} } + }, + { + "name": "Create: Add Table for like table", + "is_positive_test": true, + "inventory_data": {}, + "test_data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ] + }, + "mocking_required": false, + "mock_data": {}, + "expected_data": { + "status_code": 200, + "error_msg": null, + "test_result_data": {} + } + }, + { + "name": "Create: Add Table with like option", + "is_positive_test": true, + "inventory_data": {}, + "test_data": { + "columns": [], + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_relation": "public.like_tbl" + }, + "mocking_required": false, + "mock_data": {}, + "expected_data": { + "status_code": 200, + "error_msg": null, + "test_result_data": {} + } + }, + { + "name": "Create: Add Table with like option 12 plus", + "is_positive_test": true, + "inventory_data": { + "server_min_version": 120000, + "skip_msg": "Like generated is not supported by PPAS/PG 11.0 and below" + }, + "test_data": { + "columns": [], + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_generated": true, + "like_relation": "public.like_tbl" + }, + "mocking_required": false, + "mock_data": {}, + "expected_data": { + "status_code": 200, + "error_msg": null, + "test_result_data": {} + } + }, + { + "name": "Create: Add Table with like option 14 plus", + "is_positive_test": true, + "inventory_data": { + "server_min_version": 140000, + "skip_msg": "Like compression is not supported by PPAS/PG 14.0 and below" + }, + "test_data": { + "columns": [], + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_identity": true, + "like_statistics": true, + "like_generated": true, + "like_compression": true, + "like_relation": "public.like_tbl" + }, + "mocking_required": false, + "mock_data": {}, + "expected_data": { + "status_code": 200, + "error_msg": null, + "test_result_data": {} + } } ], "table_delete": [ diff --git a/web/regression/javascript/schema_ui_files/table.ui.spec.js b/web/regression/javascript/schema_ui_files/table.ui.spec.js index 8b41341f9..0a5b00246 100644 --- a/web/regression/javascript/schema_ui_files/table.ui.spec.js +++ b/web/regression/javascript/schema_ui_files/table.ui.spec.js @@ -95,6 +95,10 @@ describe('TableSchema', ()=>{ like_indexes: false, like_storage: false, like_comments: false, + like_compression: false, + like_generated: false, + like_identity: false, + like_statistics: false }); });