You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bit objects not supported with Psycopg 2 and pg8000 #169
Hi, pgvector.Bit works as a query parameter with Psycopg 3 (it registers a dumper), but not with Psycopg 2 or pg8000:
cur.execute('SELECT %s::bit(3)', (Bit('101'),)) # psycopg2: ProgrammingError: can't adapt type 'Bit'conn.run('SELECT CAST(:b AS bit(3))', b=Bit('101')) # pg8000: "i" is not a valid binary digit
Passing to_text() works, but it's inconsistent with Vector/HalfVector/SparseVector, which both drivers adapt. The pg8000 case is a bit worse since it sends the wrong value rather than raising a clear error.
For both drivers this is a small text adapter (same pattern as HalfvecAdapter / register_out_adapter); happy to open a PR if you'd like. (asyncpg left out on purpose, per #110.)
Tested with main (b5d9b70), Postgres 17, pgvector master.
Activity