Hi On Thu, 11 May 2023 at 09:26, Yogesh Mahajan < yogesh.maha...@enterprisedb.com> wrote:
> Hi, > > I have tried with python 3.10. 3.11 by creating fresh venv on Mac, but I > could not reproduce the problem. > As you said earlier, this could be architecture specific. > Would it be possible to provide access to above to me or if any database > server credentials that I can use to test with. > Simple problem over here is - > > pg_cursor.execute("SELECT version()") is returning, bytes object which is not > expected. > > We can add typecasting here to fix the issue if we are sure about the exact > root cause of the issue. > > Well unlike yesterday, I happen to have both Intel and M1 Macs here today, and whaddya know, it does look like a psycopg bug: Python 3.10.11 (v3.10.11:7d4cc5aa85, Apr 4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import psycopg >>> with psycopg.connect("dbname=postgres user=dpage") as conn: ... with conn.cursor() as cur: ... cur.execute("SELECT version()") ... cur.fetchone() ... <psycopg.Cursor [TUPLES_OK] [INTRANS] (user=dpage database=postgres) at 0x103a72610> (b'PostgreSQL 15.1 on aarch64-apple-darwin22.1.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.202), 64-bit',) (venv) dpage@gibson ~ % python Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import psycopg >>> with psycopg.connect("dbname=postgres user=dpage") as conn: ... with conn.cursor() as cur: ... cur.execute("SELECT version()") ... cur.fetchone() ... <psycopg.Cursor [TUPLES_OK] [INTRANS] (user=dpage database=postgres) at 0x10e6c7530> ('PostgreSQL 15.2 (Homebrew) on x86_64-apple-darwin22.3.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.202), 64-bit',) I've raised that with the psycopg devs: https://github.com/psycopg/psycopg/issues/561 Thanks! -- Dave Page Blog: https://pgsnake.blogspot.com Twitter: @pgsnake EDB: https://www.enterprisedb.com