GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bit objects not supported with Psycopg 2 and pg8000 · Issue #169 · pgvector/pgvector-python

Bit objects not supported with Psycopg 2 and pg8000 #169

New issue
Copy link
New issue
Copy link
Open
#170
Open
Bit objects not supported with Psycopg 2 and pg8000#169
#170
Copy link

Description

@astroknot-sheep
astroknot-sheep
opened on Oct 21, 2026
Issue body actions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.