Skip to content

Commit 3e66b6f

Browse files
authored
1) Added "MULTIRANGE_TYPE_NAME" option while creating a Range Type. #6394
2) Added "SUBSCRIPT" option while creating an External Type. #6395
1 parent 2fd2a14 commit 3e66b6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1868
-71
lines changed

docs/en_US/images/type_range.png

33.3 KB
Loading

docs/en_US/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ notes for it.
1212
:maxdepth: 1
1313

1414

15+
release_notes_9_9
1516
release_notes_9_8
1617
release_notes_9_7
1718
release_notes_9_6

docs/en_US/release_notes_9_9.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
***********
2+
Version 9.9
3+
***********
4+
5+
Release date: 2025-10-16
6+
7+
This release contains a number of bug fixes and new features since the release of pgAdmin 4 v9.8.
8+
9+
Supported Database Servers
10+
**************************
11+
**PostgreSQL**: 13, 14, 15, 16 and 17
12+
13+
**EDB Advanced Server**: 13, 14, 15, 16 and 17
14+
15+
Bundled PostgreSQL Utilities
16+
****************************
17+
**psql**, **pg_dump**, **pg_dumpall**, **pg_restore**: 17.5
18+
19+
20+
New features
21+
************
22+
23+
| `Issue #6394 <https://github.com/pgadmin-org/pgadmin4/issues/6394>`_ - Added "MULTIRANGE_TYPE_NAME" option while creating a Range Type.
24+
| `Issue #6395 <https://github.com/pgadmin-org/pgadmin4/issues/6395>`_ - Added "SUBSCRIPT" option while creating a External Type.
25+
26+
27+
Housekeeping
28+
************
29+
30+
31+
Bug fixes
32+
*********
33+

docs/en_US/type_dialog.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ On the *Optional-1* tab:
109109
to select a type_modifier_output_function. It is allowed to omit the
110110
type_modifier_output_function, in which case the default display format is the
111111
stored typmod integer value enclosed in parentheses.
112+
* Use the drop-down listbox next to the optional *Analyze function* field to
113+
select a function for performing type-specific statistics collection for
114+
columns of the data type.
115+
* Use the drop-down listbox next to the optional *Subscript function* field to
116+
select a function for allows the data type to be subscripted in SQL commands.
112117
* Use the optional *Internal length* to specify a value for internal
113118
representation.
114-
* Move the *Variable?* switch to specify the internal representation is of
115-
variable length (VARIABLE). The default is a fixed length positive integer.
116119
* Specify a default value in the optional *Default* field in cases where a
117120
column of the data type defaults to something other than the null value.
118121
Specify the default with the DEFAULT key word. (A default can be overridden
119122
by an explicit DEFAULT clause attached to a particular column.)
120-
* Use the drop-down listbox next to the optional *Analyze function* field to
121-
select a function for performing type-specific statistics collection for
122-
columns of the data type.
123123
* Use the drop-down listbox next to the optional *Category type* field to help
124124
control which implicit cast will be applied in ambiguous situations.
125125
* Move the *Preferred?* switch to *Yes* to specify the selected category type is
@@ -162,6 +162,9 @@ disabled.
162162
values to a canonical form.
163163
* Use the drop-down listbox next to *Sub-type diff function* to select a
164164
user-defined subtype_diff function.
165+
* Specify the optional *Multirange type name* parameter to specifies the
166+
name of the corresponding multirange type. If not specified, this name is
167+
chosen automatically.
165168

166169
If you select *Shell* in the *Type* field, the *Definition* tab displays the
167170
*Shell* panel:

web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ def wrap(*args, **kwargs):
249249

250250
return wrap
251251

252+
def has_dependent_type(self, data):
253+
"""
254+
This function is used to check the type has dependent
255+
on another type.
256+
"""
257+
return ('rngmultirangetype' in data and
258+
data['rngmultirangetype'] is not None and
259+
data['rngmultirangetype'] != '')
260+
252261
@check_precondition
253262
def list(self, gid, sid, did, scid):
254263
"""
@@ -317,7 +326,8 @@ def node(self, gid, sid, did, scid, tid):
317326
rset['rows'][0]['oid'],
318327
scid,
319328
rset['rows'][0]['name'],
320-
icon=self.icon_str % self.node_type
329+
icon=self.icon_str % self.node_type,
330+
has_dependent=self.has_dependent_type(rset['rows'][0])
321331
)
322332

323333
return make_json_response(
@@ -359,7 +369,8 @@ def nodes(self, gid, sid, did, scid):
359369
scid,
360370
row['name'],
361371
icon=self.icon_str % self.node_type,
362-
description=row['description']
372+
description=row['description'],
373+
has_dependent=self.has_dependent_type(row)
363374
))
364375

365376
return make_json_response(
@@ -536,7 +547,8 @@ def additional_properties(self, copy_dict, tid):
536547
enum_list = []
537548
for row in rset['rows']:
538549
properties_list.append(row['enumlabel'])
539-
enum_list.append({'label': row['enumlabel']})
550+
enum_list.append({'label': row['enumlabel'],
551+
'old_label': row['enumlabel']})
540552

541553
# Adding both results in ouput
542554
res['enum_list'] = ', '.join(properties_list)
@@ -1063,7 +1075,8 @@ def create(self, gid, sid, did, scid):
10631075
tid,
10641076
scid,
10651077
data['name'],
1066-
icon="icon-type"
1078+
icon="icon-type",
1079+
has_dependent=self.has_dependent_type(data)
10671080
)
10681081
)
10691082
except Exception as e:
@@ -1086,7 +1099,7 @@ def update(self, gid, sid, did, scid, tid):
10861099
request.data
10871100
)
10881101
try:
1089-
SQL, name = self.get_sql(gid, sid, data, scid, tid)
1102+
SQL, name, has_dependent = self.get_sql(gid, sid, data, scid, tid)
10901103
# Most probably this is due to error
10911104
if not isinstance(SQL, str):
10921105
return SQL
@@ -1114,6 +1127,7 @@ def update(self, gid, sid, did, scid, tid):
11141127
scid,
11151128
name,
11161129
icon=self.icon_str % self.node_type,
1130+
has_dependent=has_dependent,
11171131
**other_node_info
11181132
)
11191133
)
@@ -1226,11 +1240,15 @@ def msql(self, gid, sid, did, scid, tid=None):
12261240
for key, val in req.items():
12271241
if key in ['composite', 'enum', 'seclabels', 'typacl']:
12281242
data[key] = json.loads(val)
1243+
elif key in ['typreceive', 'typsend', 'typmodin', 'typmodout',
1244+
'typanalyze', 'typsubscript','typstorage'] and \
1245+
val == 'null':
1246+
data[key] = json.loads(val)
12291247
else:
12301248
data[key] = val
12311249

12321250
try:
1233-
sql, _ = self.get_sql(gid, sid, data, scid, tid)
1251+
sql, _, _ = self.get_sql(gid, sid, data, scid, tid)
12341252
# Most probably this is due to error
12351253
if not isinstance(sql, str):
12361254
return sql
@@ -1330,7 +1348,7 @@ def _get_new_sql(self, data, is_sql):
13301348
self._CREATE_SQL]),
13311349
data=data, conn=self.conn, is_sql=is_sql)
13321350

1333-
return SQL, data['name']
1351+
return SQL, data['name'], False
13341352

13351353
def get_sql(self, gid, sid, data, scid, tid=None, is_sql=False):
13361354
"""
@@ -1339,6 +1357,8 @@ def get_sql(self, gid, sid, data, scid, tid=None, is_sql=False):
13391357
if tid is None:
13401358
return self._get_new_sql(data, is_sql)
13411359

1360+
data = self._convert_for_sql(data)
1361+
13421362
for key in ['added', 'changed', 'deleted']:
13431363
if key in data.get('typacl', []):
13441364
data['typacl'][key] = parse_priv_to_db(
@@ -1411,7 +1431,8 @@ def get_sql(self, gid, sid, data, scid, tid=None, is_sql=False):
14111431
data=data, o_data=old_data, conn=self.conn
14121432
)
14131433

1414-
return SQL, old_data['name']
1434+
return (SQL, data['name'] if 'name' in data else old_data['name'],
1435+
self.has_dependent_type(old_data))
14151436

14161437
@check_precondition
14171438
def sql(self, gid, sid, did, scid, tid, **kwargs):
@@ -1478,7 +1499,7 @@ def sql(self, gid, sid, did, scid, tid, **kwargs):
14781499
if data[k] == '-':
14791500
data[k] = None
14801501

1481-
SQL, _ = self.get_sql(gid, sid, data, scid, tid=None, is_sql=True)
1502+
SQL, _, _ = self.get_sql(gid, sid, data, scid, tid=None, is_sql=True)
14821503
# Most probably this is due to error
14831504
if not isinstance(SQL, str):
14841505
return SQL
@@ -1588,8 +1609,8 @@ def get_sql_from_diff(self, **kwargs):
15881609
if data:
15891610
if target_schema:
15901611
data['schema'] = target_schema
1591-
sql, _ = self.get_sql(gid=gid, sid=sid, scid=scid, data=data,
1592-
tid=oid)
1612+
sql, _, _ = self.get_sql(gid=gid, sid=sid, scid=scid, data=data,
1613+
tid=oid)
15931614
else:
15941615
if drop_sql:
15951616
sql = self.delete(gid=gid, sid=sid, did=did,

web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ define('pgadmin.node.type', [
4242
hasSQL: true,
4343
hasDepends: true,
4444
width: pgBrowser.stdW.md + 'px',
45+
refreshParent: function(node) {
46+
return node?._metadata?.data?.has_dependent;
47+
},
4548
Init: function() {
4649
/* Avoid multiple registration of menus */
4750
if (this.initialized)

0 commit comments

Comments
 (0)