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 d6d258b73fd..e3888b55011 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 @@ -81,16 +81,17 @@ CACHE {{c.seqcache|int}} {% 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 not data.coll_inherits and not data.spcname and not with_clause and not data.amname %};{% 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 %} + INHERITS ({% for val in data.coll_inherits %}{% if loop.index != 1 %}, {% endif %}{{val}}{% endfor %}){% if not data.spcname and not with_clause and not data.amname %};{% endif %} {% endif %} + {% if data.default_amname and data.default_amname != data.amname and data.amname is not none %} USING {{data.amname}} {% elif not data.default_amname and data.amname %} -USING {{data.amname}} +USING {{data.amname}}{% if not data.spcname and not with_clause %};{% endif %} {% endif %} {% if with_clause %} 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 index 578ae5afd46..f30e99a1002 100644 --- 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 @@ -83,16 +83,17 @@ CACHE {{c.seqcache|int}} {% 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 not data.coll_inherits and not data.spcname and not with_clause and not data.amname %};{% 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 %} + INHERITS ({% for val in data.coll_inherits %}{% if loop.index != 1 %}, {% endif %}{{val}}{% endfor %}){% if not data.spcname and not with_clause and not data.amname %};{% endif %} {% endif %} + {% if data.default_amname and data.default_amname != data.amname and data.amname is not none %} USING {{data.amname}} {% elif data.amname and not data.default_amname %} -USING {{data.amname}} +USING {{data.amname}}{% if not data.spcname and not with_clause %};{% endif %} {% endif %} {% if with_clause %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.ui.js index f6f36aa21cc..894615813c4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.ui.js @@ -87,8 +87,14 @@ export default class MViewSchema extends BaseUISchema { }, }, { id: 'amname', label: gettext('Access Method'), group: gettext('Definition'), - type: 'select', mode: ['create', 'properties', 'edit'], min_version: 120000, - options: obj.fieldOptions.table_amname_list, + type: (state)=>{ + return { + type: 'select', options: obj.fieldOptions.table_amname_list, + controlProps: { + allowClear: obj.isNew(state) ? true : false, + } + }; + }, mode: ['create', 'properties', 'edit'], min_version: 120000, disabled: (state) => { if (obj.getServerVersion() < 150000 && !obj.isNew(state)) { return true;