Skip to content

register_vector() Fails When Only 'vector' Extension is Installed, Missing 'halfvec' and 'sparsevec #79

Description

@vatsrahul1001

Description:

After the 0.3.0 release, we have encountered an issue where the register_vector function throws an error if our PostgreSQL database only has the vector extension installed, and not halfvec or sparsevec.

Steps to Reproduce:

Install the pgvector extension in PostgreSQL without halfvec or sparsevec.
Call the register_vector function.
Error:

  File "/usr/local/lib/python3.9/site-packages/pgvector/psycopg2/register.py", line 23, in register_vector
    cur.execute('SELECT NULL::sparsevec')
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction bloc

Expected Behavior:

The function should not break if halfvec or sparsevec are not present. It should work seamlessly with only the vector extension installed.

Link to Relevant Code:

register_vector

Activity

  1. ankane commented on Jul 10, 2024

    @ankane
    Member

    Hi @vatsrahul1001, thanks for reporting! Pushed a fix in the commit above (previous code only worked when autocommit was True).

  2. ankane commented on Jul 11, 2024

    @ankane
    Member

    Just released 0.3.1 with the fix.

  3. added a commit that references this issue on Jul 11, 2024
    2e253ce
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