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

CREATE INDEX gives: ERROR: pgvecto.rs: The index is already existing in the background worker. #413

Closed
ergo70 opened this issue Mar 8, 2024 · 5 comments

Comments

@ergo70
Copy link

ergo70 commented Mar 8, 2024

Hello,

PostgreSQL 16.2 on Ubuntu 22.04.3 LTS. pgvector.rs binary release 0.2.1. psql CLI.

CREATE TABLE items (
id int4 GENERATED ALWAYS AS IDENTITY,
embedding vector(5) NOT NULL
);

INSERT INTO items (embedding) VALUES ('[1,2,3,4,5]');

CREATE INDEX ON items USING vectors (embedding vector_cos_ops);

ERROR: pgvecto.rs: The index is already existing in the background worker.

How can the INDEX already exist when I just tried to create it?

What am I doing wrong? Or is this a bug?

best regards

Ernst-Georg

@ergo70 ergo70 changed the title CREATE INDEX shows ERROR CREATE INDEX gives: ERROR: pgvecto.rs: The index is already existing in the background worker. Mar 8, 2024
@VoVAllen
Copy link
Member

VoVAllen commented Mar 8, 2024

Have you run the create index before? It's a bit weird. Can you try restarting the database to see whether the issue still exists?

@ergo70
Copy link
Author

ergo70 commented Mar 8, 2024

I have stopped the server, removed the data directory and set up a completely fresh cluster with:

./initdb -k -D ../data/ -E UTF8 --no-locale -U postgres -W

My postgresql.auto.conf:

# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
shared_preload_libraries = 'vectors.so'
search_path = '"$user", public, vectors'

The error persists.

@VoVAllen
Copy link
Member

VoVAllen commented Mar 8, 2024

Can you try remove all the file under pgdata/pg_vectors?

@ergo70
Copy link
Author

ergo70 commented Mar 11, 2024

As said before, I started with a empty, freshly initialized $PGDATA directory. However, I think I have found a way to reproduce it:

postgres=# CREATE TABLE items (
                id int4 GENERATED ALWAYS AS IDENTITY,
                embedding vector(5) NOT NULL
            );
postgres=# insert into items (embedding) values ('[1,2,3,4,5]');
INSERT 0 1
postgres=# CREATE INDEX ON items USING vectors (embedding vector_cos_ops);
CREATE INDEX

No problems.

postgres=# drop table items;
DROP TABLE
postgres=# CREATE UNLOGGED TABLE items (
                id int4 GENERATED ALWAYS AS IDENTITY,
                embedding vector(5) NOT NULL
            );
postgres=# insert into items (embedding) values ('[1,2,3,4,5]');
INSERT 0 1
postgres=# CREATE INDEX ON items USING vectors (embedding vector_cos_ops);
ERROR:  pgvecto.rs: The index is already existing in the background worker.

It's the UNLOGGED.

Since UNLOGGED is a supported directive for CREATE TABLE since PostgreSQL v9.1 (https://www.postgresql.org/docs/9.1/sql-createtable.html) I'd say, this is a bug. Or is it documented behavior?

best regards

Ernst-Georg

@usamoi
Copy link
Collaborator

usamoi commented Mar 11, 2024

It's intended behavior in 0.2.x. It's solved in #414 and it will work in 0.3.0.

@ergo70 ergo70 closed this as completed Mar 11, 2024
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

No branches or pull requests

3 participants