mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Remove arbitrary (and incorrect) requirement that composite types must have at least two members. Fixes #4451
This commit is contained in:
committed by
Dave Page
parent
a7d8b9de8c
commit
080ccdda5b
@@ -929,16 +929,6 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
||||
)
|
||||
)
|
||||
# Additional checks goes here
|
||||
# If type is composite then check if it has two members
|
||||
if data and data[arg] == 'c':
|
||||
if len(data['composite']) < 2:
|
||||
return make_json_response(
|
||||
status=410,
|
||||
success=0,
|
||||
errormsg=gettext(
|
||||
'Composite types require at least two members.'
|
||||
)
|
||||
)
|
||||
# If type is range then check if subtype is defined or not
|
||||
if data and data[arg] == 'r':
|
||||
if 'typname' not in data or data['typname'] is None:
|
||||
@@ -1285,11 +1275,6 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
||||
return "-- definition incomplete"
|
||||
|
||||
# Additional checks go here
|
||||
# If type is composite then check if it has two members
|
||||
if data and data[arg] == 'c':
|
||||
if len(data['composite']) < 2:
|
||||
return "-- definition incomplete"
|
||||
|
||||
# If type is range then check if subtype is defined or not
|
||||
if data and data[arg] == 'r':
|
||||
if 'typname' not in data or data['typname'] is None:
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Type: composite_type_$%{}[]()&*^!@"'`\/#
|
||||
|
||||
-- DROP TYPE public."composite_type_$%{}[]()&*^!@""'`\/#";
|
||||
|
||||
CREATE TYPE public."composite_type_$%{}[]()&*^!@""'`\/#" AS
|
||||
(
|
||||
mname1 bigint
|
||||
);
|
||||
|
||||
ALTER TYPE public."composite_type_$%{}[]()&*^!@""'`\/#"
|
||||
OWNER TO <OWNER>;
|
||||
@@ -108,6 +108,32 @@
|
||||
"data": {}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "create",
|
||||
"name": "Create Composite type - one field",
|
||||
"endpoint": "NODE-type.obj",
|
||||
"sql_endpoint": "NODE-type.sql_id",
|
||||
"data": {
|
||||
"name": "composite_type_$%{}[]()&*^!@\"'`\\/#",
|
||||
"is_sys_type":false,
|
||||
"typtype":"c",
|
||||
"schema":"public",
|
||||
"composite":[
|
||||
{"member_name":"mname1","type":"bigint","is_tlength":false,"is_precision":false}
|
||||
],
|
||||
"typacl":[],
|
||||
"seclabels":[],
|
||||
"description":""
|
||||
},
|
||||
"expected_sql_file": "create_composite_type_one_field.sql"
|
||||
},
|
||||
{
|
||||
"type": "delete",
|
||||
"name": "Drop Composite type - one field",
|
||||
"endpoint": "NODE-type.obj_id",
|
||||
"sql_endpoint": "NODE-type.sql_id",
|
||||
"data": {}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "create",
|
||||
|
||||
Reference in New Issue
Block a user