forked from lanterndata/lantern
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace vector_l2sq_dist with overloaded l2sq_dist (lanterndata#166)
- Loading branch information
1 parent
d511abf
commit d3ba5b5
Showing
4 changed files
with
24 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- drop the old implementation | ||
DROP FUNCTION IF EXISTS vector_l2sq_dist(vector, vector); | ||
|
||
-- replace is with overloaded version | ||
-- Check if the vector type from pgvector exists | ||
SELECT EXISTS ( | ||
SELECT 1 | ||
FROM pg_type | ||
WHERE typname = 'vector' | ||
) INTO pgvector_exists; | ||
|
||
IF pgvector_exists THEN | ||
CREATE FUNCTION l2sq_dist(vector, vector) RETURNS float8 | ||
AS 'MODULE_PATHNAME', 'vector_l2sq_dist' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; | ||
END IF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters