Skip to content

Commit 374cf9f

Browse files
authored
fix: extension upgrade issue with s3vectors_fdw (#530)
1 parent 0ea88c2 commit 374cf9f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

wrappers/sql/bootstrap.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ COMMENT ON COLUMN wrappers_fdw_stats.bytes_in IS 'Total bytes input from origin'
2222
COMMENT ON COLUMN wrappers_fdw_stats.bytes_out IS 'Total bytes output to Postgres';
2323
COMMENT ON COLUMN wrappers_fdw_stats.metadata IS 'Metadata specific for the FDW';
2424

25+
-- The operator '<==>' is defined in s3vectors_fdw since v0.5.6, drop it here
26+
-- to avoid conflict when upgrading wrappers extension.
27+
DROP OPERATOR IF EXISTS <==> (jsonb, jsonb);
28+

wrappers/src/fdw/s3vectors_fdw/s3vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,21 @@ impl TryFrom<*mut bytea> for S3Vec {
107107
}
108108
}
109109

110-
#[pg_operator(immutable, parallel_safe)]
110+
#[pg_operator(create_or_replace, immutable, parallel_safe)]
111111
#[opname(<==>)]
112112
fn s3vec_knn(_left: S3Vec, _right: S3Vec) -> bool {
113113
// always return true here, actual calculation will be done in the wrapper
114114
true
115115
}
116116

117-
#[pg_operator(immutable, parallel_safe)]
117+
#[pg_operator(create_or_replace, immutable, parallel_safe)]
118118
#[opname(<==>)]
119119
fn metadata_filter(_left: JsonB, _right: JsonB) -> bool {
120120
// always return true here, actual calculation will be done in the wrapper
121121
true
122122
}
123123

124-
#[pg_extern]
124+
#[pg_extern(create_or_replace)]
125125
fn s3vec_distance(s3vec: S3Vec) -> f32 {
126126
s3vec.distance
127127
}

0 commit comments

Comments
 (0)