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

bug: install at schema would fail at create index #270

Closed
cutecutecat opened this issue Jan 15, 2024 · 1 comment · Fixed by #273
Closed

bug: install at schema would fail at create index #270

cutecutecat opened this issue Jan 15, 2024 · 1 comment · Fixed by #273

Comments

@cutecutecat
Copy link
Member

cutecutecat commented Jan 15, 2024

Now we could not install pgvector.rs at schema.

CREATE SCHEMA tschema;
CREATE EXTENSION vectors WITH SCHEMA tschema;

CREATE TABLE tschema.t (val tschema.vector(3));
INSERT INTO tschema.t (val) SELECT ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 1000);

CREATE INDEX native_index ON tschema.t USING vectors (val tschema.vector_cos_ops)
WITH (options = "[indexing.hnsw]");
ERROR:  type "vector" does not exist

Related function:

  • pgrx::wrappers::regtypein("vector")
  • regoperatorin("<#>(vector,vector)")
@usamoi
Copy link
Collaborator

usamoi commented Jan 15, 2024

ref: https://www.postgresql.org/docs/current/sql-createextension.html

We can force schema vectors and set search_path to vectors, ... to solve it.

SET COMMAND can be invoked by function. See https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADMIN-SET.

In this way, we can just use vectors.vector and vectors.<->(vectors.vector,vectors.vector) in our code.

@usamoi usamoi added the good first issue ❤️ Good for newcomers label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants