mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Using the correct type name (along with the internal name) while
generating the query for update/insert table data (Data grid). Modified by Ashesh for array support. Fixes #2830
This commit is contained in:
committed by
Ashesh Vashi
parent
f10733e8d4
commit
281b6c91b5
@@ -708,6 +708,7 @@ def poll(trans_id):
|
||||
col_type = dict()
|
||||
col_type['type_code'] = col['type_code']
|
||||
col_type['type_name'] = None
|
||||
col_type['internal_size'] = col['internal_size']
|
||||
columns[col['name']] = col_type
|
||||
|
||||
if rset:
|
||||
@@ -727,7 +728,29 @@ def poll(trans_id):
|
||||
for col_info in columns.values():
|
||||
for col_type in types:
|
||||
if col_type['oid'] == col_info['type_code']:
|
||||
col_info['type_name'] = col_type['typname']
|
||||
typname = col_type['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 = typname[:-2] + '(' + \
|
||||
str(col_info['internal_size']) + \
|
||||
')[]'
|
||||
|
||||
col_info['type_name'] = typname
|
||||
|
||||
session_obj['columns_info'] = columns
|
||||
# status of async_fetchmany_2darray is True and result is none
|
||||
|
Reference in New Issue
Block a user