-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency in return type format on Intel and M1 Mac #561
Comments
Can you also share |
Most definitely it should. The only way psycopg returns bytes (I mean designed, as opposite as bugs) is that the client encoding of the connection is SQL_ASCII. import psycopg
conn = psycopg.connect()
conn.execute("show client_encoding").fetchone()[0]
# 'UTF8'
conn.execute("set client_encoding to sql_ascii")
# <psycopg.Cursor [COMMAND_OK] [INTRANS] (database=piro) at 0x7fe76707e6c0>
conn.execute("show client_encoding").fetchone()[0]
# b'SQL_ASCII' What does an |
You've hit the nail on the head (as usual :-) ). My test server on Intel was initialised in UTF-8, but (for some unknown reason) SQL_ASCII on the M1 box. Returning bytes for SQL_ASCII seems perfectly reasonable; I'll fix our code to handle that case. Thanks! |
No worries :) For completeness, strings adaptation rules are explained here. |
* Handle cases when psycopg returns bytes instead of a string. See psycopg/psycopg#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.
* Handle cases when psycopg returns bytes instead of a string. See psycopg/psycopg#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.
I recently ran into an issue when working on pgAdmin where a scalar query result was returned as a string on Intel and bytes on M1. Here's a simple test case:
M1:
Intel:
It seems to me that this should be consistent.
The text was updated successfully, but these errors were encountered: