pgvector / pgvector

Open-source vector similarity search for Postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I found a bug. There are no constraints on the index-related parameter settings.

frg01 opened this issue · comments

commented

postgres=# SET ivfflat.probes = 1;
SET
Time: 0.253 ms
postgres=# SET ivfflat.probess = 1;
SET
Time: 0.431 ms
postgres=# SET ivfflat.probess = 2;
SET
Time: 0.244 ms
postgres=# show ivfflat.probess;
ivfflat.probess

2
(1 row)

Time: 0.366 ms

The above are my steps. You can see that probes is an error parameter. It has one more letter s than probes, and it shows success. This can easily lead to the retrieval parameters not being set properly.
Related parameter settings have such problems,like:
(one more letter s)
postgres=# set hnsw.ef_searchs = 100;
SET
Time: 0.588 ms

Hi @frg01, starting with 0.6.0, pgvector handles this the same way as other Postgres extensions.

If set before the extension is loaded:

SET ivfflat.probess = 1; -- no output

SELECT '[1,2,3]'::vector; -- warning
WARNING:  invalid configuration parameter name "ivfflat.probess", removing it

If set after the extension is loaded:

SELECT '[1,2,3]'::vector; -- load extension

SET ivfflat.probess = 1;
ERROR:  invalid configuration parameter name "ivfflat.probess"
DETAIL:  "ivfflat" is a reserved prefix.
commented

Hi @frg01, starting with 0.6.0, pgvector handles this the same way as other Postgres extensions.

If set before the extension is loaded:

SET ivfflat.probess = 1; -- no output

SELECT '[1,2,3]'::vector; -- warning
WARNING:  invalid configuration parameter name "ivfflat.probess", removing it

If set after the extension is loaded:

SELECT '[1,2,3]'::vector; -- load extension

SET ivfflat.probess = 1;
ERROR:  invalid configuration parameter name "ivfflat.probess"
DETAIL:  "ivfflat" is a reserved prefix.

Are you sure this issue has been resolved? The version I use is 0.6.2

postgres=# create extension vector;
ERROR: extension "vector" already exists
postgres=# SELECT extname, extversion
FROM pg_extension;
extname | extversion
---------+------------
plpgsql | 1.0
vector | 0.6.2
(2 rows)

postgres=# SELECT '[1,2,3]'::vector; -- load extension
vector

[1,2,3]
(1 row)

postgres=# SET ivfflat.probess = 1;
SET

I'm not sure if there are other factors causing this phenomenon.

It looks like Postgres 14 and below has different behavior (it was changed in postgres/postgres@8810356). If set before the extension is loaded, there's a warning when it's loaded.

SET ivfflat.probess = 1;

SELECT '[1,2,3]'::vector;
WARNING:  unrecognized configuration parameter "ivfflat.probess"

If set after, there's no error or warning. In any case, this is the same behavior as other extensions.

commented

看起来 Postgres 14 及以下版本有不同的行为(在postgres/postgres@ 8810356中进行了更改)。如果在加载扩展之前设置,则加载时会出现警告。

SET ivfflat.probess = 1;

SELECT '[1,2,3]'::vector;
WARNING:  unrecognized configuration parameter "ivfflat.probess"

如果之后设置,则不会出现错误或警告。无论如何,这与其他扩展的行为相同。

got it , thanks for your reply!!