Skip to content

Pgvector store error #1329

Open
Open
@rhajou

Description

@rhajou

Describe the bug
I am trying to insert to Alloydb using PgVectorDocumentStore but sometimes multiple runs of the same insertion script are running at the same time (insertion of multiple documents in more than 100 different scripts)

I am seeing the following error:
Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/haystack_integrations/document_stores/pgvector/document_store.py", line 303, in _execute_sql result = cursor.execute(sql_query, params) File "/usr/local/lib/python3.10/site-packages/psycopg/cursor.py", line 97, in execute raise ex.with_traceback(None) psycopg.errors.UniqueViolation: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
as I saw online this solution (https://stackoverflow.com/questions/74261789/postgres-create-table-if-not-exists-%E2%87%92-23505)

But how should we implement this behavior in Haystack?

Noting that my parameters:

schema_name: public
table_name: mytablealloydb
embedding_dimension: 768 
vector_function: cosine_similarity
recreate_table: False
search_strategy: hnsw
hnsw_recreate_index_if_exists: False
keyword_index_name: "mytablealloydb_keyword_index"

To Reproduce
Run same script 200 times in parallel and you can reproduce it

  • OS: debian
  • Haystack version: 2.8.1
  • Integration version: 0.8.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions