mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-15 11:12:25 -06:00
Allow creation of ENUM types with no members. Fixes #2426
This commit is contained in:
parent
dba64e77f1
commit
2c9af4784e
@ -905,16 +905,6 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
||||
'Composite types require at least two members.'
|
||||
)
|
||||
)
|
||||
# If type is enum then check if it has minimum one label
|
||||
if data and data[arg] == 'e':
|
||||
if len(data['enum']) < 1:
|
||||
return make_json_response(
|
||||
status=410,
|
||||
success=0,
|
||||
errormsg=gettext(
|
||||
'Enumeration types require at least one label.'
|
||||
)
|
||||
)
|
||||
# If type is range then check if subtype is defined or not
|
||||
if data and data[arg] == 'r':
|
||||
if data['typname'] is None:
|
||||
|
@ -241,18 +241,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
|
||||
}
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null;
|
||||
|
||||
if (_.isUndefined(this.get('label') ||
|
||||
_.isNull(this.get('label')) ||
|
||||
String(this.get('label')).replace(/^\s+|\s+$/g, '') == '')) {
|
||||
errmsg = '{{ _('Please specify the value for label.') }}';
|
||||
this.errorModel.set('label', errmsg)
|
||||
return errmsg;
|
||||
} else {
|
||||
this.errorModel.unset('label');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -87,7 +87,7 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
||||
{% if c_idx == 1 %}
|
||||
{# if first new element then add it after old data enum list#}
|
||||
ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
||||
ADD VALUE {{r.label|qtLiteral}} AFTER {{o_data.enum[o_enum_len].label|qtLiteral }};
|
||||
ADD VALUE {{r.label|qtLiteral}} {% if o_enum_len > 0 %}AFTER {{o_data.enum[o_enum_len].label|qtLiteral }}{% endif %};
|
||||
{% else %}
|
||||
{# if first new element then add it after new data enum list#}
|
||||
{% set p_idx = loop.index - 2 %}
|
||||
|
Loading…
Reference in New Issue
Block a user