Skip to content

Commit 6c01899

Browse files
authored
Release 0.6.0 (#206)
1 parent c92d418 commit 6c01899

8 files changed

+140
-1
lines changed

pgvectorscale/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vectorscale"
3-
version = "0.6.0-dev"
3+
version = "0.6.0"
44
edition = "2021"
55

66
[lib]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.5.1--0.6.0.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.5.1--0.6.0.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.5.1--0.6.0.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.5.1--0.6.0.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.5.1--0.6.0.sql
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/* <begin connected objects> */
2+
/*
3+
This file is auto generated by pgrx.
4+
5+
The ordering of items is not stable, it is driven by a dependency graph.
6+
*/
7+
/* </end connected objects> */
8+
9+
/* <begin connected objects> */
10+
-- pgvectorscale/src/access_method/mod.rs:33
11+
-- vectorscale::access_method::amhandler
12+
13+
CREATE OR REPLACE FUNCTION diskann_amhandler(internal) RETURNS index_am_handler PARALLEL SAFE IMMUTABLE STRICT COST 0.0001 LANGUAGE c AS '$libdir/vectorscale-0.6.0', 'amhandler_wrapper';
14+
15+
DO $$
16+
DECLARE
17+
c int;
18+
BEGIN
19+
SELECT count(*)
20+
INTO c
21+
FROM pg_catalog.pg_am a
22+
WHERE a.amname = 'diskann';
23+
24+
IF c = 0 THEN
25+
CREATE ACCESS METHOD diskann TYPE INDEX HANDLER diskann_amhandler;
26+
END IF;
27+
END;
28+
$$;
29+
/* </end connected objects> */
30+
31+
/* <begin connected objects> */
32+
-- pgvectorscale/src/access_method/distance.rs:47
33+
-- vectorscale::access_method::distance::distance_type_cosine
34+
CREATE OR REPLACE FUNCTION "distance_type_cosine"() RETURNS smallint /* i16 */
35+
IMMUTABLE STRICT PARALLEL SAFE
36+
LANGUAGE c /* Rust */
37+
AS '$libdir/vectorscale-0.6.0', 'distance_type_cosine_wrapper';
38+
/* </end connected objects> */
39+
40+
/* <begin connected objects> */
41+
-- pgvectorscale/src/access_method/distance.rs:57
42+
-- vectorscale::access_method::distance::distance_type_inner_product
43+
CREATE OR REPLACE FUNCTION "distance_type_inner_product"() RETURNS smallint /* i16 */
44+
IMMUTABLE STRICT PARALLEL SAFE
45+
LANGUAGE c /* Rust */
46+
AS '$libdir/vectorscale-0.6.0', 'distance_type_inner_product_wrapper';
47+
/* </end connected objects> */
48+
49+
/* <begin connected objects> */
50+
-- pgvectorscale/src/access_method/distance.rs:52
51+
-- vectorscale::access_method::distance::distance_type_l2
52+
CREATE OR REPLACE FUNCTION "distance_type_l2"() RETURNS smallint /* i16 */
53+
IMMUTABLE STRICT PARALLEL SAFE
54+
LANGUAGE c /* Rust */
55+
AS '$libdir/vectorscale-0.6.0', 'distance_type_l2_wrapper';
56+
/* </end connected objects> */
57+
58+
/* <begin connected objects> */
59+
-- pgvectorscale/src/access_method/mod.rs:167
60+
-- requires:
61+
-- amhandler
62+
-- distance_type_cosine
63+
-- distance_type_l2
64+
-- distance_type_inner_product
65+
66+
67+
DO $$
68+
DECLARE
69+
have_cos_ops int;
70+
have_l2_ops int;
71+
have_ip_ops int;
72+
BEGIN
73+
-- Has cosine operator class been installed previously?
74+
SELECT count(*)
75+
INTO have_cos_ops
76+
FROM pg_catalog.pg_opclass c
77+
WHERE c.opcname = 'vector_cosine_ops'
78+
AND c.opcmethod = (SELECT oid FROM pg_catalog.pg_am am WHERE am.amname = 'diskann')
79+
AND c.opcnamespace = (SELECT oid FROM pg_catalog.pg_namespace where nspname='@extschema@');
80+
81+
-- Has L2 operator class been installed previously?
82+
SELECT count(*)
83+
INTO have_l2_ops
84+
FROM pg_catalog.pg_opclass c
85+
WHERE c.opcname = 'vector_l2_ops'
86+
AND c.opcmethod = (SELECT oid FROM pg_catalog.pg_am am WHERE am.amname = 'diskann')
87+
AND c.opcnamespace = (SELECT oid FROM pg_catalog.pg_namespace where nspname='@extschema@');
88+
89+
-- Has inner product operator class been installed previously?
90+
SELECT count(*)
91+
INTO have_ip_ops
92+
FROM pg_catalog.pg_opclass c
93+
WHERE c.opcname = 'vector_ip_ops'
94+
AND c.opcmethod = (SELECT oid FROM pg_catalog.pg_am am WHERE am.amname = 'diskann')
95+
AND c.opcnamespace = (SELECT oid FROM pg_catalog.pg_namespace where nspname='@extschema@');
96+
97+
IF have_cos_ops = 0 THEN
98+
CREATE OPERATOR CLASS vector_cosine_ops DEFAULT
99+
FOR TYPE vector USING diskann AS
100+
OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops,
101+
FUNCTION 1 distance_type_cosine();
102+
ELSIF have_l2_ops = 0 THEN
103+
-- Upgrade from 0.4.0 to 0.5.0. Update cosine opclass to include
104+
-- the distance_type_cosine function.
105+
INSERT INTO pg_amproc (oid, amprocfamily, amproclefttype, amprocrighttype, amprocnum, amproc)
106+
SELECT (select (max(oid)::int + 1)::oid from pg_amproc), c.opcfamily, c.opcintype, c.opcintype, 1, '@extschema@.distance_type_l2'::regproc
107+
FROM pg_opclass c, pg_am a
108+
WHERE a.oid = c.opcmethod AND c.opcname = 'vector_cosine_ops' AND a.amname = 'diskann';
109+
END IF;
110+
111+
IF have_l2_ops = 0 THEN
112+
CREATE OPERATOR CLASS vector_l2_ops
113+
FOR TYPE vector USING diskann AS
114+
OPERATOR 1 <-> (vector, vector) FOR ORDER BY float_ops,
115+
FUNCTION 1 distance_type_l2();
116+
END IF;
117+
118+
IF have_ip_ops = 0 THEN
119+
CREATE OPERATOR CLASS vector_ip_ops
120+
FOR TYPE vector USING diskann AS
121+
OPERATOR 1 <#> (vector, vector) FOR ORDER BY float_ops,
122+
FUNCTION 1 distance_type_inner_product();
123+
END IF;
124+
END;
125+
$$;
126+
/* </end connected objects> */
127+

pgvectorscale/src/access_method/upgrade_test.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,11 @@ pub mod tests {
278278
fn test_upgrade_from_0_5_0() {
279279
test_upgrade_base("0.5.0", "0.12.5", "pgvectorscale", "vectorscale", "diskann");
280280
}
281+
282+
#[ignore]
283+
#[serial]
284+
#[test]
285+
fn test_upgrade_from_0_5_1() {
286+
test_upgrade_base("0.5.1", "0.12.5", "pgvectorscale", "vectorscale", "diskann");
287+
}
281288
}

0 commit comments

Comments
 (0)