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]: <Title> #185

Open
nestorSainsburys opened this issue Jan 2, 2025 · 2 comments
Open

[Bug]: <Title> #185

nestorSainsburys opened this issue Jan 2, 2025 · 2 comments
Labels
bug Something isn't working community pgvectorscale

Comments

@nestorSainsburys
Copy link

What happened?

I use a docker image timescale/timescaledb-ha:pg17

I've created a table for embeddings:

CREATE TABLE IF NOT EXISTS products.products_embedding ( embedding_id int8 NOT NULL PRIMARY KEY, "text" varchar(255), embedding vector(3072), metadata json );

I've installed a vectorscale extension:

CREATE EXTENSION IF NOT EXISTS vectorscale CASCADE;

That all worked well and I can see the extension created:

SELECT * 
FROM pg_extension; - that lists my `vectorscale` and `vector` extensions

Now, when I try to query the db, using Java JPA repository, as in:

@Query(nativeQuery = true, value = "SELECT * FROM products.products_embedding ORDER BY embedding <=> cast('[:embedding]' as vectorscale) LIMIT :limit")
List<ProductsEmbedding> findByEmbedding(List<Float> embedding, int limit);

, that breaks with the following error:

SQL Error [42704]: ERROR: type "vectorscale" does not exist

I get the same result if I plain query in Postgres:

SELECT *
FROM products.argos_products_embedding
ORDER BY embedding <=> cast ('[0.002165521029382944,..(truncated for brievety)..]' as vectorscale)
LIMIT 10;

Why the extension is not found?

BTW, it works if I try

SELECT *
FROM products.argos_products_embedding
ORDER BY embedding <=> cast ('[0.002165521029382944,..(truncated for brievety)..]' as vector)
LIMIT 10;

I have had the 'vectorextension installed earlier on on the same container, and I believevectorscaleis built on top ofvector`, so that works in Postgres.

It still doesn't work in Java though:

@Query(nativeQuery = true, value = "SELECT * FROM products.products_embedding ORDER BY embedding <=> cast('[:embedding]' as vector) LIMIT :limit")
List<ProductsEmbedding> findByEmbedding(List<Float> embedding, int limit);

Still breaks complaining that ERROR: type "vector" does not exist\n Position: 95

pgvectorscale extension affected

0.5.1

PostgreSQL version used

17

What operating system did you use?

MacOs 14.6

What installation method did you use?

Docker

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

SQL Error [42704]: ERROR: type "vectorscale" does not exist
  Position: 65766

How can we reproduce the bug?

the steps are in the description

Are you going to work on the bugfix?

🆘 No, could someone else please work on the bugfix?

@syvb
Copy link
Member

syvb commented Jan 6, 2025

There isn't a type named "vectorscale" - we use the same vector type from pgvector. You have to add USING diskann (embedding vector_cosine_ops) when you create the vector index, and then you can make vector queries as normal.

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

No branches or pull requests

2 participants