diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/gpdb/5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/gpdb/5_plus/properties.sql index 9bddda66..5bf10813 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/gpdb/5_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/gpdb/5_plus/properties.sql @@ -55,6 +55,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str, array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reltype, typ.typname, + typ.typrelid AS typoid, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, -- Added for pgAdmin4 (CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/pg/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/pg/10_plus/properties.sql index 4b268573..51c11987 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/pg/10_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/pg/10_plus/properties.sql @@ -52,6 +52,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str, array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname, + typ.typrelid AS typoid, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, -- Added for pgAdmin4 (CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/ppas/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/ppas/10_plus/properties.sql index 4b268573..51c11987 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/ppas/10_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partition/sql/ppas/10_plus/properties.sql @@ -52,6 +52,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str, array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname, + typ.typrelid AS typoid, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, -- Added for pgAdmin4 (CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/10_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/10_plus/create.sql index 79a6ee8b..70c38603 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/10_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/10_plus/create.sql @@ -41,8 +41,8 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data {### Add columns ###} {% if data.columns and data.columns|length > 0 %} {% for c in data.columns %} -{% if c.name and c.cltype and not c.inheritedfrom %} - {{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 %} DEFAULT {{c.defval}}{% endif %} +{% 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 %} DEFAULT {{c.defval}}{% endif %} {% if c.attidentity and c.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif c.attidentity and 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.seqincrement is defined and c.seqcycle %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql index b93cc7ca..e8204679 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql @@ -42,7 +42,7 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data {% 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 %} DEFAULT {{c.defval}}{% endif %} + {% 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 %} DEFAULT {{c.defval}}{% endif %} {% if not loop.last %}, {% endif %} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/properties.sql index 641afaf8..5096a8ab 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/properties.sql @@ -54,6 +54,7 @@ FROM ( array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str, array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, NULL AS reloftype, NULL AS typname, + typ.typrelid AS typoid, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, -- Added for pgAdmin4 (CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql index c82e72cc..86b9278d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql @@ -41,8 +41,8 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data {### Add columns ###} {% if data.columns and data.columns|length > 0 %} {% for c in data.columns %} -{% if c.name and c.cltype and not c.inheritedfrom %} - {{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 %} DEFAULT {{c.defval}}{% endif %} +{% 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 %} DEFAULT {{c.defval}}{% endif %} {% if not loop.last %}, {% endif %} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/properties.sql index 3089ab66..5701ff9d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/properties.sql @@ -60,6 +60,7 @@ FROM ( array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str, array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, NULL AS reloftype, NULL AS typname, + typ.typrelid AS typoid, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, -- Added for pgAdmin4 (CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,