Remove arbitrary (and incorrect) requirement that composite types must have at least two members. Fixes #4451
parent
a7d8b9de8c
commit
080ccdda5b
|
@ -27,6 +27,7 @@ Bug fixes
|
|||
| `Issue #4191 <https://redmine.postgresql.org/issues/4191>`_ - Ensure comments are shown in reverse engineered SQL for table partitions.
|
||||
| `Issue #4242 <https://redmine.postgresql.org/issues/4242>`_ - Handle NULL values appropriately when sorting backgrid tables.
|
||||
| `Issue #4341 <https://redmine.postgresql.org/issues/4341>`_ - Give appropriate error messages when the user tries to use an blank master password.
|
||||
| `Issue #4451 <https://redmine.postgresql.org/issues/4451>`_ - Remove arbitrary (and incorrect) requirement that composite types must have at least two members.
|
||||
| `Issue #4459 <https://redmine.postgresql.org/issues/4459>`_ - Don't quote bigints when copying them from the Query Tool results grid.
|
||||
| `Issue #4482 <https://redmine.postgresql.org/issues/4482>`_ - Ensure compression level is passed to pg_dump when backing up in directory format.
|
||||
| `Issue #4483 <https://redmine.postgresql.org/issues/4483>`_ - Ensure the number of jobs can be specified when backing up in directory format.
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue