Skip to content

Add pgvector Vector type support#2437

Closed
MaanasSathaye wants to merge 2 commits intojackc:masterfrom
MaanasSathaye:master
Closed

Add pgvector Vector type support#2437
MaanasSathaye wants to merge 2 commits intojackc:masterfrom
MaanasSathaye:master

Conversation

@MaanasSathaye
Copy link
Copy Markdown

Implements Vector type for pgvector extension compatibility. Includes binary and text format codecs, Scanner/Valuer interfaces, JSON marshaling, and comprehensive tests.

prior art for this exists in https://github.com/pgvector/pgvector-go/tree/master/pgx. I don't see a need just yet for halfvecs or sparsevecs though.

Implements Vector type for pgvector extension compatibility. Includes binary and text format codecs, Scanner/Valuer interfaces, JSON marshaling, and comprehensive tests.
@jackc
Copy link
Copy Markdown
Owner

jackc commented Nov 28, 2025

Is there something wrong with the support provided by the official pgvector project you linked to? It appears to be maintained. I'd prefer to use that unless there is a good reason not to.

@MaanasSathaye
Copy link
Copy Markdown
Author

Is there something wrong with the support provided by the official pgvector project you linked to? It appears to be maintained. I'd prefer to use that unless there is a good reason not to.

@jackc sorry, missed this in my inbox. It's a bit of a russian doll problem. A few of my projects use genieql, which relies on the pgx driver for postgres. We've added a workaround solution to custom define a vector type in a supplemental driver, but are looking for something more native. The linked repo from @ankane contains the necessary vector types, but I can't read pgx types from two sources in genieql currently. Other solution would be for me to fork pgx + pgvector-go and maintain my own, but that becomes a bit of dependency mess.

I'm happy to close this MR and let Andrew open his own too.

@jackc
Copy link
Copy Markdown
Owner

jackc commented Feb 20, 2026

Is there something wrong with the support provided by the official pgvector project you linked to? It appears to be maintained. I'd prefer to use that unless there is a good reason not to.

@jackc sorry, missed this in my inbox. It's a bit of a russian doll problem. A few of my projects use genieql, which relies on the pgx driver for postgres. We've added a workaround solution to custom define a vector type in a supplemental driver, but are looking for something more native. The linked repo from @ankane contains the necessary vector types, but I can't read pgx types from two sources in genieql currently. Other solution would be for me to fork pgx + pgvector-go and maintain my own, but that becomes a bit of dependency mess.

I'm happy to close this MR and let Andrew open his own too.

Okay. I'm going to close this. I think that support for extensions should be outside of pgx in almost all cases. Especially in this case where the extension is providing Go support officially.

Also, extensions may have different release cycles and backwards compatibility goals than PostgreSQL and pgx. Even if we wanted wanted more or less official support in the pgx project, it would still end up being a separate package like what has been done with https://github.com/jackc/pgx-shopspring-decimal.

@jackc jackc closed this Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants