Title: Bit objects not supported with Psycopg 2 and pg8000 · Issue #169 · pgvector/pgvector-python · GitHub
Open Graph Title: Bit objects not supported with Psycopg 2 and pg8000 · Issue #169 · pgvector/pgvector-python
X Title: Bit objects not supported with Psycopg 2 and pg8000 · Issue #169 · pgvector/pgvector-python
Description: 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 C...
Open Graph Description: 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: c...
X Description: 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: Pro...
Opengraph URL: https://github.com/pgvector/pgvector-python/issues/169
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bit objects not supported with Psycopg 2 and pg8000","articleBody":"Hi, `pgvector.Bit` works as a query parameter with Psycopg 3 (it registers a dumper), but not with Psycopg 2 or pg8000:\n\n```python\ncur.execute('SELECT %s::bit(3)', (Bit('101'),)) # psycopg2: ProgrammingError: can't adapt type 'Bit'\nconn.run('SELECT CAST(:b AS bit(3))', b=Bit('101')) # pg8000: \"i\" is not a valid binary digit\n```\n\nPassing `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.\n\nFor 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.)\n\nTested with main (b5d9b70), Postgres 17, pgvector master.\n","author":{"url":"https://github.com/astroknot-sheep","@type":"Person","name":"astroknot-sheep"},"datePublished":"2026-10-21T18:13:32Z","url":"https://github.com/pgvector/pgvector-python/issues/169"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e39c0a08-33c2-d931-893e-3a3e0523677b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8088:29B9B8:A78D93:DBCEEB:6AFE81EB |
| html-safe-nonce | b9ebf063c1a4d2bfb1a8de4aa22a21d4cc640cff4f195a1ca886a33cefe056d9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDg4OjI5QjlCODpBNzhEOTM6REJDRUVCOjZBRkU4MUVCIiwidmlzaXRvcl9pZCI6IjkxOTI2NjM5MDI5NTE3MzU3ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9333f682ae44ae6443c36b4b04ed851129911b00818853c9fc3f924c84aabaf3 |
| hovercard-subject-tag | issue:5966016398 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pgvector/pgvector-python/169/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f8acad9753410fc5487e7d3bac5de9eb16d2f611c8e7b11de724790ec88f662b/pgvector/pgvector-python/issues/169 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f8acad9753410fc5487e7d3bac5de9eb16d2f611c8e7b11de724790ec88f662b/pgvector/pgvector-python/issues/169 |
| og:image:alt | 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: c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | astroknot-sheep |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/pgvector/pgvector-python git https://github.com/pgvector/pgvector-python.git |
| octolytics-dimension-user_id | 98363230 |
| octolytics-dimension-user_login | pgvector |
| octolytics-dimension-repository_id | 376300726 |
| octolytics-dimension-repository_nwo | pgvector/pgvector-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 376300726 |
| octolytics-dimension-repository_network_root_nwo | pgvector/pgvector-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width