Skip to content

Commit ecf6e3a

Browse files
syvbcevian
andauthored
Prepare 0.4.0 (#140)
* Prepare 0.4.0 * fix * Install pgrx 0.11.1 when building 0.0.2 --------- Co-authored-by: Matvey Arye <cevian@gmail.com>
1 parent 7af7933 commit ecf6e3a

File tree

5 files changed

+88
-35
lines changed

5 files changed

+88
-35
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.3.0"
3+
version = "0.4.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.3.0--0.4.0.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vectorscale--0.3.0--0.4.0.sql
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
-- src/access_method/mod.rs:26
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.4.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+
-- src/access_method/mod.rs:89
33+
-- requires:
34+
-- amhandler
35+
36+
37+
DO $$
38+
DECLARE
39+
c int;
40+
BEGIN
41+
SELECT count(*)
42+
INTO c
43+
FROM pg_catalog.pg_opclass c
44+
WHERE c.opcname = 'vector_cosine_ops'
45+
AND c.opcmethod = (SELECT oid FROM pg_catalog.pg_am am WHERE am.amname = 'diskann');
46+
47+
IF c = 0 THEN
48+
CREATE OPERATOR CLASS vector_cosine_ops DEFAULT
49+
FOR TYPE vector USING diskann AS
50+
OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops;
51+
END IF;
52+
END;
53+
$$;
54+
/* </end connected objects> */
55+

pgvectorscale/src/access_method/upgrade_test.rs

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub mod tests {
2525
#[ignore]
2626
///This function is only a mock to bring up the test framewokr in test_delete_vacuum
2727
fn test_upgrade() {
28+
if cfg!(feature = "pg17") {
29+
// PG17 is only supported for one version
30+
return;
31+
}
2832
pgrx_tests::run_test(
2933
"test_delete_mock_fn",
3034
None,
@@ -73,48 +77,40 @@ pub mod tests {
7377
temp_dir.path()
7478
);
7579

76-
// use latest pgrx
77-
let res = std::process::Command::new("cargo")
78-
.current_dir(temp_path.join("timescale_vector"))
79-
.args(["rm", "pgrx"])
80-
.stdout(Stdio::inherit())
81-
.stderr(Stdio::piped())
82-
.output()
83-
.unwrap();
84-
assert!(res.status.success(), "failed: {:?}", res);
85-
8680
let res = std::process::Command::new("cargo")
8781
.current_dir(temp_path.join("timescale_vector"))
88-
.args(["rm", "--dev", "pgrx-tests"])
82+
.args([
83+
"install",
84+
"cargo-pgrx",
85+
"--version",
86+
"=0.11.1",
87+
"--force",
88+
"--root",
89+
temp_path.join("pgrx-0.11.1").to_str().unwrap(),
90+
"cargo-pgrx",
91+
])
8992
.stdout(Stdio::inherit())
9093
.stderr(Stdio::piped())
9194
.output()
9295
.unwrap();
9396
assert!(res.status.success(), "failed: {:?}", res);
9497

95-
let res = std::process::Command::new("cargo")
96-
.current_dir(temp_path.join("timescale_vector"))
97-
.args(["add", "-F", &format!("pg{}", pg_version), "pgrx"])
98-
.stdout(Stdio::inherit())
99-
.stderr(Stdio::piped())
100-
.output()
101-
.unwrap();
102-
assert!(res.status.success(), "failed: {:?}", res);
103-
104-
//let contents = fs::read_to_string(temp_path.join("pgvectorscale/Cargo.toml")).unwrap();
105-
//print!("cargo {}", contents);
106-
107-
let res = std::process::Command::new("cargo")
108-
.current_dir(temp_path.join("timescale_vector"))
109-
.arg("pgrx")
110-
.arg("install")
111-
.arg("--test")
112-
.arg("--pg-config")
113-
.arg(pg_config.path().unwrap())
114-
.stdout(Stdio::inherit())
115-
.stderr(Stdio::piped())
116-
.output()
117-
.unwrap();
98+
let res = std::process::Command::new(
99+
temp_path
100+
.join("pgrx-0.11.1/bin/cargo-pgrx")
101+
.to_str()
102+
.unwrap(),
103+
)
104+
.current_dir(temp_path.join("timescale_vector"))
105+
.arg("pgrx")
106+
.arg("install")
107+
.arg("--test")
108+
.arg("--pg-config")
109+
.arg(pg_config.path().unwrap())
110+
.stdout(Stdio::inherit())
111+
.stderr(Stdio::piped())
112+
.output()
113+
.unwrap();
118114
assert!(res.status.success(), "failed: {:?}", res);
119115

120116
client

0 commit comments

Comments
 (0)