Skip to content

Commit 78d9aa5

Browse files
Fixed issue found while testing PostGIS spatial type constructor support. #2256
1 parent 038029e commit 78d9aa5

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/12_plus/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{### Add column ###}
66
{% if data.name and data.cltype %}
77
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
8-
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.collspcname %}
8+
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.geometry and not is_sql %}({{data.geometry}}{% if data.srid %},{{data.srid}}{% endif %}){% endif %}{% if data.collspcname %}
99
COLLATE {{data.collspcname}}{% endif %}{% if data.attnotnull %}
1010
NOT NULL{% endif %}{% if data.defval is defined and data.defval is not none and data.defval != '' and data.colconstype != 'g' %}
1111
DEFAULT {{data.defval}}{% endif %}{% if data.colconstype == 'i' %}{% if data.attidentity and data.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif data.attidentity and data.attidentity == 'd' %} GENERATED BY DEFAULT AS IDENTITY{% endif %}

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{### Add column ###}
66
{% if data.name and data.cltype %}
77
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
8-
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.collspcname %}
8+
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.geometry and not is_sql %}({{data.geometry}}{% if data.srid %},{{data.srid}}{% endif %}){% endif %}{% if data.collspcname %}
99
COLLATE {{data.collspcname}}{% endif %}{% if data.attnotnull %}
1010
NOT NULL{% endif %}{% if data.defval is defined and data.defval is not none and data.defval != '' and data.colconstype != 'g' %}
1111
DEFAULT {{data.defval}}{% endif %}{% if data.colconstype == 'i' %}{% if data.attidentity and data.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif data.attidentity and data.attidentity == 'd' %} GENERATED BY DEFAULT AS IDENTITY{% endif %}

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/update.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
99

1010
{% endif %}
1111
{### Alter column type and collation ###}
12-
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
12+
{% if (data.cltype and data.cltype != o_data.cltype) or (data.geometry is defined and data.geometry != o_data.geometry) or (data.srid is defined and data.srid != o_data.srid) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
1313
{% if data.col_type_conversion is defined and data.col_type_conversion == False %}
1414
-- WARNING:
1515
-- The SQL statement below would normally be used to alter the datatype for the {{o_data.name}} column, however,

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{### Add column ###}
66
{% if data.name and data.cltype %}
77
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
8-
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.collspcname %}
8+
ADD COLUMN {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.geometry and not is_sql %}({{data.geometry}}{% if data.srid %},{{data.srid}}{% endif %}){% endif %}{% if data.collspcname %}
99
COLLATE {{data.collspcname}}{% endif %}{% if data.attnotnull %}
1010
NOT NULL{% endif %}{% if data.defval is defined and data.defval is not none and data.defval != '' and data.colconstype != 'g' %}
1111
DEFAULT {{data.defval}}{% endif %}{% if data.colconstype == 'i' %}{% if data.attidentity and data.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif data.attidentity and data.attidentity == 'd' %} GENERATED BY DEFAULT AS IDENTITY{% endif %}

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/update.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
99

1010
{% endif %}
1111
{### Alter column type and collation ###}
12-
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
12+
{% if (data.cltype and data.cltype != o_data.cltype) or (data.geometry is defined and data.geometry != o_data.geometry) or (data.srid is defined and data.srid != o_data.srid) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
1313
{% if data.col_type_conversion is defined and data.col_type_conversion == False %}
1414
-- WARNING:
1515
-- The SQL statement below would normally be used to alter the datatype for the {{o_data.name}} column, however,

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{### Add column ###}
66
{% if data.name and data.cltype %}
77
ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
8-
ADD COLUMN IF NOT EXISTS {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.collspcname %}
8+
ADD COLUMN IF NOT EXISTS {{conn|qtIdent(data.name)}} {% if is_sql %}{{data.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, data.cltype, data.attlen, data.attprecision, data.hasSqrBracket) }}{% endif %}{% if data.geometry and not is_sql %}({{data.geometry}}{% if data.srid %},{{data.srid}}{% endif %}){% endif %}{% if data.collspcname %}
99
COLLATE {{data.collspcname}}{% endif %}{% if data.attnotnull %}
1010
NOT NULL{% endif %}{% if data.defval is defined and data.defval is not none and data.defval != '' %}
1111
DEFAULT {{data.defval}}{% endif %}{% if data.colconstype == 'i' %}{% if data.attidentity and data.attidentity == 'a' %} GENERATED ALWAYS AS IDENTITY{% elif data.attidentity and data.attidentity == 'd' %} GENERATED BY DEFAULT AS IDENTITY{% endif %}

web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/update.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
99

1010
{% endif %}
1111
{### Alter column type and collation ###}
12-
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
12+
{% if (data.cltype and data.cltype != o_data.cltype) or (data.geometry is defined and data.geometry != o_data.geometry) or (data.srid is defined and data.srid != o_data.srid) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) or data.col_type_conversion is defined %}
1313
{% if data.col_type_conversion is defined and data.col_type_conversion == False %}
1414
-- WARNING:
1515
-- The SQL statement below would normally be used to alter the datatype for the {{o_data.name}} column, however,

web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/macros/get_full_type_sql_format.macros

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ time({{ data.attlen }}) with time zone {% endif %}{% if o_data.hasSqrBracket %}[
7373
{% if data.attlen and data.attlen is not none %}
7474
({{ data.attlen }}{% elif old_length and old_length is not none %}({{ old_length }}{% endif %}{% if data_precision and data_precision is not none %}
7575
, {{ data_precision }}){% elif old_precision and old_precision is not none %}, {{ old_precision }}){% else %}){% endif %}
76-
{% endif %}{% if o_data.hasSqrBracket %}[]{% endif %}
76+
{% endif %}{% if data.geometry %}({{ data.geometry }}{% elif o_data.geometry %}({{ o_data.geometry }}{% endif %}{% if data.srid %},{{ data.srid }}){% elif o_data.srid %},{{ o_data.srid }}){% endif %}{% if o_data.hasSqrBracket %}[]{% endif %}
7777
{% endif %}
7878
{% endmacro %}

web/pgadmin/tools/erd/static/js/erd_tool/dialogs/TableDialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class EmptySchema extends BaseUISchema {
2323
}
2424
}
2525

26-
export function getTableDialogSchema(attributes, isNew, tableNodesDict, colTypes, schemas) {
26+
export function getTableDialogSchema(attributes, isNew, tableNodesDict, colTypes, schemas, geometryTypes) {
2727
let treeNodeInfo;
2828

2929
let columnSchema = new ColumnSchema(
3030
()=>{/*This is intentional (SonarQube)*/},
3131
treeNodeInfo,
3232
()=>colTypes,
3333
()=>[],
34-
()=>[],
34+
()=>geometryTypes,
3535
true,
3636
);
3737

0 commit comments

Comments
 (0)