Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions web/pgadmin/utils/driver/psycopg3/typecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from psycopg.adapt import Loader
from ipaddress import ip_address, ip_interface
from psycopg._encodings import py_codecs as encodings
from psycopg.pq import Format as _pq_Format

configure_driver_encodings(encodings)

Expand Down Expand Up @@ -176,6 +177,12 @@ def register_binary_typecasters(connection):
connection.adapters.register_loader(1001,
ByteaLoader)

connection.adapters.register_loader(17,
ByteaBinaryLoader)

connection.adapters.register_loader(1001,
ByteaBinaryLoader)


def register_array_to_string_typecasters(connection=None):
type_array = PSYCOPG_SUPPORTED_BUILTIN_ARRAY_DATATYPES +\
Expand Down Expand Up @@ -212,6 +219,13 @@ def load(self, data):
return 'binary data' if data is not None else None


class ByteaBinaryLoader(Loader):
format = _pq_Format.BINARY

def load(self, data):
return 'binary data' if data is not None else None


class TextLoaderpgAdmin(TextLoader):
def load(self, data):
postgres_encoding, python_encoding = get_encoding(
Expand Down