Fixed an issue where the PSQL tool would hang when the database encoding was set to SQL_ASCII and certain commands were executed.

pull/8753/head
Akshay Joshi 2025-05-14 14:05:29 +05:30
parent abcb5f8830
commit eece396b30
3 changed files with 18 additions and 8 deletions

View File

@ -31,6 +31,7 @@ Bug fixes
*********
| `Issue #6564 <https://github.com/pgadmin-org/pgadmin4/issues/6564>`_ - Fix the issue where an error is displayed when a table is dropped while a query is running.
| `Issue #6968 <https://github.com/pgadmin-org/pgadmin4/issues/6968>`_ - Fixed an issue where the options key was not working as expected in the PSQL tool.
| `Issue #8595 <https://github.com/pgadmin-org/pgadmin4/issues/8595>`_ - Enhance contrast for selected and hovered items in the Object Explorer to improve visibility and accessibility.
| `Issue #8607 <https://github.com/pgadmin-org/pgadmin4/issues/8607>`_ - Fixed an issue where the query tool returns "cannot unpack non-iterable Response object" when running any query with a database name change.
| `Issue #8608 <https://github.com/pgadmin-org/pgadmin4/issues/8608>`_ - Handle result grid data changes in View/Edit Data mode by automatically reconnecting to the server if a disconnection occurs.

View File

@ -205,9 +205,16 @@ def read_terminal_data(parent, data_ready, max_read_bytes, sid):
if parent in data_ready:
# Read the output from parent fd (terminal).
output = os.read(parent, max_read_bytes)
try:
decode_data = output.decode()
except Exception:
try:
decode_data = output.decode('UTF-8')
except Exception:
decode_data = output.decode('UTF-8', errors='replace')
sio.emit('pty-output',
{'result': output.decode(),
{'result': decode_data,
'error': False},
namespace='/pty', room=sid)

View File

@ -246,10 +246,12 @@ class TextLoaderpgAdmin(TextLoader):
return bytes(data).decode(python_encoding)
return data.decode(python_encoding)
except Exception:
if isinstance(data, memoryview):
return bytes(data).decode('UTF-8')
return data.decode('UTF-8')
else:
if isinstance(data, memoryview):
return bytes(data).decode('ascii', errors='replace')
return data.decode('ascii', errors='replace')
try:
if isinstance(data, memoryview):
return bytes(data).decode('UTF-8')
return data.decode('UTF-8')
except Exception:
if isinstance(data, memoryview):
return bytes(data).decode('ascii',
errors='replace')
return data.decode('ascii', errors='replace')