Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public.vector doesn't emit pgvector.Vector #3548

Open
newhook opened this issue Aug 15, 2024 · 3 comments
Open

public.vector doesn't emit pgvector.Vector #3548

newhook opened this issue Aug 15, 2024 · 3 comments
Labels
📚 postgresql bug Something isn't working

Comments

@newhook
Copy link

newhook commented Aug 15, 2024

Version

1.26.0

What happened?

My schema, generated from pg_dump, has:

embedding public.vector(1536)

This generates interface{} which won't scan correctly. Whereas

embedding vector(1536)

Generates pgvector.Vector which does.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

@newhook newhook added the bug Something isn't working label Aug 15, 2024
@spa5k
Copy link

spa5k commented Sep 19, 2024

Yeah, faced the same issue, change public.vector to vector works, also overriding it does not work in the sqlc

    gen:
      go:
        sql_package: "pgx/v5"
        out: "internal/database/models"
        package: "models"
        emit_db_tags: true
        emit_exported_queries: false
        emit_json_tags: true
        emit_prepared_queries: true
        emit_enum_valid_method: true
        emit_pointers_for_null_types: true
        emit_all_enum_values: true
        emit_sql_as_comment: true
        overrides:
          - db_type: "vector"
            go_type:
              import: "github.com/pgvector/pgvector-go"
              type: "pgvector.Vector"
              pointer: true

@ludusrusso
Copy link
Contributor

same issue here, I can try fix it!

@spa5k
Copy link

spa5k commented Mar 3, 2025

were you able to find the fix? is it in internal/codegen/golang/postgresql_type.go? I see that its taking the case of "vector", maybe we can add another case for "public.vector"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants