fix(postgres): register pgvector types#809
Open
rieg-ec wants to merge 1 commit into
Open
Conversation
kvch
reviewed
May 19, 2026
| }) | ||
| } | ||
|
|
||
| if err := handlePgvectorRegisterTypesErr(pgxvec.RegisterTypes(ctx, conn)); err != nil { |
Collaborator
There was a problem hiding this comment.
Could you please refactor these lines to be similar to what we do for the extension hstore?
Something along the lines of:
var vectorOID uint32
if err := conn.QueryRow(ctx, "SELECT to_regtype('vector')::oid").Scan(&vectorOID); err == nil && vectorOID != 0 {
if err := pgxvec.RegisterTypes(ctx, conn); err != nil {
return fmt.Errorf("registering pgvector types: %w", err)
}
}
kvch
reviewed
May 19, 2026
Collaborator
kvch
left a comment
There was a problem hiding this comment.
Thank you for the contribution. Asking for a small refactoring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
came across this issue when using pgstream with a database that uses
vectorextension with a custom size# embedding :vector(3072)i patched the pgstream pg_utils.go to call
pgxvec.RegisterTypesand it worked. Without this, pgx does not know how to encode/decode pgvector values and Postgres targets can fail when a replicated table containsvectorcolumns.not sure if this is the right place to do it, it was highly vibecoded, but it seemed to work for us so i'll let this PR in case it's useful
Related Issue(s)
Type of Change
Please select the relevant option(s):
Changes Made
github.com/pgvector/pgvector-go/pgxin the shared Postgres connection type setup.vector type not foundregistration error when the extension is not installed.Testing
Commands run:
Checklist
Additional Notes