Handle SQL_ASCII databases when running test cases.

* Handle cases when psycopg returns bytes instead of a string.

See https://github.com/psycopg/psycopg/issues/561

* A more appropriate fix, suggested by Daniele Varrazzo

* Fix typo.

* Re-think this check. Our own driver effectively monkey-patches the psycopg encoding mappings.
This commit is contained in:
Dave Page 2023-05-16 04:50:01 +01:00 committed by GitHub
parent c067289012
commit 8ea3346a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1186,6 +1186,10 @@ def get_server_type(server):
if isinstance(version_string, tuple):
version_string = version_string[0]
# Handle SQL_ASCII (https://github.com/psycopg/psycopg/issues/561)
version_string = version_string.decode() if \
hasattr(version_string, 'decode') else version_string
if "EnterpriseDB" in version_string:
return 'ppas'