diff --git a/docs/en_US/release_notes_4_21.rst b/docs/en_US/release_notes_4_21.rst index 73f7dfb07..bb7583ec2 100644 --- a/docs/en_US/release_notes_4_21.rst +++ b/docs/en_US/release_notes_4_21.rst @@ -45,6 +45,7 @@ Bug fixes | `Issue #5007 `_ - Ensure index dropdown should have existing indexes while creating unique constraints. | `Issue #5053 `_ - Fixed an issue where changing the columns in the existing view throws an error. | `Issue #5180 `_ - Fixed an issue where the autovacuum_enabled parameter is added automatically in the RE-SQL when the table has been created using the WITH clause. +| `Issue #5210 `_ - Ensure that text larger than underlying field size should not be truncated automatically. | `Issue #5227 `_ - Fixed an issue where user cannot be added if many users are already exists. | `Issue #5268 `_ - Fixed generated SQL when any token in FTS Configuration or any option in FTS Dictionary is changed. | `Issue #5270 `_ - Ensure that OID should be shown in properties for Synonyms. diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index 6d53632a1..2d1fd1a5a 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -452,9 +452,6 @@ def poll(trans_id): for col_type in types: if col_type['oid'] == col_info['type_code']: typname = col_type['typname'] - - typname = compose_type_name(col_info, typname) - col_info['type_name'] = typname # Using characters %, (, ) in the argument names is not @@ -529,22 +526,6 @@ def poll(trans_id): ) -def compose_type_name(col_info, typname): - # If column is of type character, character[], - # character varying and character varying[] - # then add internal size to it's name for the - # correct sql query. - if col_info['internal_size'] >= 0: - if typname == 'character' or typname == 'character varying': - typname = typname + '(' + str(col_info['internal_size']) + ')' - elif typname == 'character[]' or typname == 'character varying[]': - typname = '{}({})[]'.format( - typname[:-2], - str(col_info['internal_size']) - ) - return typname - - @blueprint.route( '/fetch/', methods=["GET"], endpoint='fetch' ) diff --git a/web/pgadmin/tools/sqleditor/utils/tests/test_save_changed_data.py b/web/pgadmin/tools/sqleditor/utils/tests/test_save_changed_data.py index f959b2b4b..1e5c5a7a0 100644 --- a/web/pgadmin/tools/sqleditor/utils/tests/test_save_changed_data.py +++ b/web/pgadmin/tools/sqleditor/utils/tests/test_save_changed_data.py @@ -71,6 +71,55 @@ class TestSaveChangedData(BaseTestGenerator): check_sql='SELECT * FROM %s WHERE pk_col = 3', check_result=[[3, "three"]] )), + ('When inserting row with long data', dict( + save_payload={ + "updated": {}, + "added": { + "2": { + "err": False, + "data": { + "pk_col": "3", + "__temp_PK": "2", + "normal_col": "invalid-log-string" + } + } + }, + "staged_rows": {}, + "deleted": {}, + "updated_index": {}, + "added_index": {"2": "2"}, + "columns": [ + { + "name": "pk_col", + "display_name": "pk_col", + "column_type": "[PK] integer", + "column_type_internal": "integer", + "pos": 0, + "label": "pk_col
[PK] integer", + "cell": "number", + "can_edit": True, + "type": "integer", + "not_null": True, + "has_default_val": False, + "is_array": False}, + {"name": "normal_col", + "display_name": "normal_col", + "column_type": "character varying", + "column_type_internal": "character varying", + "pos": 1, + "label": "normal_col
character varying", + "cell": "string", + "can_edit": True, + "type": "character varying", + "not_null": False, + "has_default_val": False, + "is_array": False} + ] + }, + save_status=False, + check_sql='SELECT * FROM %s WHERE pk_col = 3', + check_result='SELECT 0' + )), ('When inserting new invalid row', dict( save_payload={ "updated": {}, @@ -168,6 +217,53 @@ class TestSaveChangedData(BaseTestGenerator): check_sql='SELECT * FROM %s WHERE pk_col = 1', check_result=[[1, "ONE"]] )), + ('When updating a row in a invalid way', dict( + save_payload={ + "updated": { + "1": + {"err": False, + "data": {"normal_col": "INVALID-COL-LENGTH"}, + "primary_keys": + {"pk_col": 1} + } + }, + "added": {}, + "staged_rows": {}, + "deleted": {}, + "updated_index": {"1": "1"}, + "added_index": {}, + "columns": [ + { + "name": "pk_col", + "display_name": "pk_col", + "column_type": "[PK] integer", + "column_type_internal": "integer", + "pos": 0, + "label": "pk_col
[PK] integer", + "cell": "number", + "can_edit": True, + "type": "integer", + "not_null": True, + "has_default_val": False, + "is_array": False}, + {"name": "normal_col", + "display_name": "normal_col", + "column_type": "character varying", + "column_type_internal": "character varying", + "pos": 1, + "label": "normal_col
character varying", + "cell": "string", + "can_edit": True, + "type": "character varying", + "not_null": False, + "has_default_val": False, + "is_array": False} + ] + }, + save_status=False, + check_sql='SELECT * FROM %s WHERE pk_col = 1', + check_result=[[1, "one"]] + )), ('When updating a row in an invalid way', dict( save_payload={ "updated": { @@ -343,7 +439,7 @@ class TestSaveChangedData(BaseTestGenerator): CREATE TABLE "%s"( pk_col INT PRIMARY KEY, - normal_col VARCHAR); + normal_col VARCHAR(5)); INSERT INTO "%s" VALUES (1, 'one'),