diff --git a/sql/install/vectors--0.2.1.sql b/sql/install/vectors--0.2.1.sql index c72f3cdea..aa482508a 100644 --- a/sql/install/vectors--0.2.1.sql +++ b/sql/install/vectors--0.2.1.sql @@ -17,7 +17,7 @@ The ordering of items is not stable, it is driven by a dependency graph. -- src/datatype/vecf32.rs:316 -- vectors::datatype::vecf32::_vectors_vecf32_out CREATE FUNCTION vectors."_vectors_vecf32_out"( - "vector" vector /* vectors::datatype::vecf32::Vecf32Input */ + "vector" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS cstring /* alloc::ffi::c_str::CString */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -26,8 +26,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_out_wrapper'; -- src/datatype/operators_f32.rs:101 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_neq CREATE FUNCTION vectors."_vectors_vecf32_operator_neq"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -36,8 +36,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_neq_wrapper'; -- src/datatype/operators_f32.rs:24 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_minus CREATE FUNCTION vectors."_vectors_vecf32_operator_minus"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS vector /* vectors::datatype::vecf32::Vecf32Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -46,8 +46,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_minus_wrapper'; -- src/datatype/operators_f32.rs:53 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_lte CREATE FUNCTION vectors."_vectors_vecf32_operator_lte"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -56,8 +56,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_lte_wrapper'; -- src/datatype/operators_f32.rs:41 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_lt CREATE FUNCTION vectors."_vectors_vecf32_operator_lt"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -66,8 +66,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_lt_wrapper'; -- src/datatype/operators_f32.rs:137 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_l2 CREATE FUNCTION vectors."_vectors_vecf32_operator_l2"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -76,8 +76,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_l2_wrapper'; -- src/datatype/operators_f32.rs:77 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_gte CREATE FUNCTION vectors."_vectors_vecf32_operator_gte"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -86,8 +86,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_gte_wrapper'; -- src/datatype/operators_f32.rs:65 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_gt CREATE FUNCTION vectors."_vectors_vecf32_operator_gt"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -96,8 +96,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_gt_wrapper'; -- src/datatype/operators_f32.rs:89 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_eq CREATE FUNCTION vectors."_vectors_vecf32_operator_eq"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -106,8 +106,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_eq_wrapper'; -- src/datatype/operators_f32.rs:125 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_dot CREATE FUNCTION vectors."_vectors_vecf32_operator_dot"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -116,8 +116,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_dot_wrapper'; -- src/datatype/operators_f32.rs:113 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_cosine CREATE FUNCTION vectors."_vectors_vecf32_operator_cosine"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -126,8 +126,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_cosine_wrapper'; -- src/datatype/operators_f32.rs:7 -- vectors::datatype::operators_f32::_vectors_vecf32_operator_add CREATE FUNCTION vectors."_vectors_vecf32_operator_add"( - "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ + "lhs" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::vecf32::Vecf32Input */ ) RETURNS vector /* vectors::datatype::vecf32::Vecf32Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -136,9 +136,9 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_add_wrapper'; -- src/datatype/vecf32.rs:252 -- vectors::datatype::vecf32::_vectors_vecf32_in CREATE FUNCTION vectors."_vectors_vecf32_in"( - "input" cstring, /* &core::ffi::c_str::CStr */ - "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ - "typmod" INT /* i32 */ + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ ) RETURNS vector /* vectors::datatype::vecf32::Vecf32Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -147,7 +147,7 @@ AS 'MODULE_PATHNAME', '_vectors_vecf32_in_wrapper'; -- src/datatype/vecf16.rs:316 -- vectors::datatype::vecf16::_vectors_vecf16_out CREATE FUNCTION vectors."_vectors_vecf16_out"( - "vector" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "vector" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS cstring /* alloc::ffi::c_str::CString */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -156,8 +156,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_out_wrapper'; -- src/datatype/operators_f16.rs:101 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_neq CREATE FUNCTION vectors."_vectors_vecf16_operator_neq"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -166,8 +166,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_neq_wrapper'; -- src/datatype/operators_f16.rs:24 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_minus CREATE FUNCTION vectors."_vectors_vecf16_operator_minus"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS vecf16 /* vectors::datatype::vecf16::Vecf16Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -176,8 +176,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_minus_wrapper'; -- src/datatype/operators_f16.rs:53 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_lte CREATE FUNCTION vectors."_vectors_vecf16_operator_lte"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -186,8 +186,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_lte_wrapper'; -- src/datatype/operators_f16.rs:41 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_lt CREATE FUNCTION vectors."_vectors_vecf16_operator_lt"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -196,8 +196,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_lt_wrapper'; -- src/datatype/operators_f16.rs:137 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_l2 CREATE FUNCTION vectors."_vectors_vecf16_operator_l2"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -206,8 +206,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_l2_wrapper'; -- src/datatype/operators_f16.rs:77 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_gte CREATE FUNCTION vectors."_vectors_vecf16_operator_gte"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -216,8 +216,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_gte_wrapper'; -- src/datatype/operators_f16.rs:65 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_gt CREATE FUNCTION vectors."_vectors_vecf16_operator_gt"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -226,8 +226,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_gt_wrapper'; -- src/datatype/operators_f16.rs:89 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_eq CREATE FUNCTION vectors."_vectors_vecf16_operator_eq"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS bool /* bool */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -236,8 +236,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_eq_wrapper'; -- src/datatype/operators_f16.rs:125 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_dot CREATE FUNCTION vectors."_vectors_vecf16_operator_dot"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -246,8 +246,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_dot_wrapper'; -- src/datatype/operators_f16.rs:113 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_cosine CREATE FUNCTION vectors."_vectors_vecf16_operator_cosine"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS real /* f32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -256,8 +256,8 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_cosine_wrapper'; -- src/datatype/operators_f16.rs:7 -- vectors::datatype::operators_f16::_vectors_vecf16_operator_add CREATE FUNCTION vectors."_vectors_vecf16_operator_add"( - "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ - "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ + "lhs" vecf16, /* vectors::datatype::vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::vecf16::Vecf16Input */ ) RETURNS vecf16 /* vectors::datatype::vecf16::Vecf16Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -266,9 +266,9 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_add_wrapper'; -- src/datatype/vecf16.rs:252 -- vectors::datatype::vecf16::_vectors_vecf16_in CREATE FUNCTION vectors."_vectors_vecf16_in"( - "input" cstring, /* &core::ffi::c_str::CStr */ - "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ - "typmod" INT /* i32 */ + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ ) RETURNS vecf16 /* vectors::datatype::vecf16::Vecf16Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -277,7 +277,7 @@ AS 'MODULE_PATHNAME', '_vectors_vecf16_in_wrapper'; -- src/datatype/typmod.rs:71 -- vectors::datatype::typmod::_vectors_typmod_out CREATE FUNCTION vectors."_vectors_typmod_out"( - "typmod" INT /* i32 */ + "typmod" INT /* i32 */ ) RETURNS cstring /* alloc::ffi::c_str::CString */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -286,7 +286,7 @@ AS 'MODULE_PATHNAME', '_vectors_typmod_out_wrapper'; -- src/datatype/typmod.rs:56 -- vectors::datatype::typmod::_vectors_typmod_in CREATE FUNCTION vectors."_vectors_typmod_in"( - "list" cstring[] /* pgrx::datum::array::Array<&core::ffi::c_str::CStr> */ + "list" cstring[] /* pgrx::datum::array::Array<&core::ffi::c_str::CStr> */ ) RETURNS INT /* i32 */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -302,7 +302,7 @@ AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; -- src/index/views.rs:5 -- vectors::index::views::_vectors_index_stat CREATE FUNCTION vectors."_vectors_index_stat"( - "oid" oid /* pgrx_pg_sys::submodules::oids::Oid */ + "oid" oid /* pgrx_pg_sys::submodules::oids::Oid */ ) RETURNS vector_index_stat /* pgrx::heap_tuple::PgHeapTuple */ STRICT VOLATILE LANGUAGE c /* Rust */ @@ -311,9 +311,9 @@ AS 'MODULE_PATHNAME', '_vectors_index_stat_wrapper'; -- src/datatype/casts_f32.rs:36 -- vectors::datatype::casts_f32::_vectors_cast_vecf32_to_vecf16 CREATE FUNCTION vectors."_vectors_cast_vecf32_to_vecf16"( - "vector" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "_typmod" INT, /* i32 */ - "_explicit" bool /* bool */ + "vector" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ ) RETURNS vecf16 /* vectors::datatype::vecf16::Vecf16Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -322,9 +322,9 @@ AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_vecf16_wrapper'; -- src/datatype/casts_f32.rs:27 -- vectors::datatype::casts_f32::_vectors_cast_vecf32_to_array CREATE FUNCTION vectors."_vectors_cast_vecf32_to_array"( - "vector" vector, /* vectors::datatype::vecf32::Vecf32Input */ - "_typmod" INT, /* i32 */ - "_explicit" bool /* bool */ + "vector" vector, /* vectors::datatype::vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ ) RETURNS real[] /* alloc::vec::Vec */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -333,9 +333,9 @@ AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_array_wrapper'; -- src/datatype/casts_f32.rs:9 -- vectors::datatype::casts_f32::_vectors_cast_array_to_vecf32 CREATE FUNCTION vectors."_vectors_cast_array_to_vecf32"( - "array" real[], /* pgrx::datum::array::Array */ - "typmod" INT, /* i32 */ - "_explicit" bool /* bool */ + "array" real[], /* pgrx::datum::array::Array */ + "typmod" INT, /* i32 */ + "_explicit" bool /* bool */ ) RETURNS vector /* vectors::datatype::vecf32::Vecf32Output */ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c /* Rust */ @@ -351,7 +351,7 @@ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_amhand -- src/embedding/udf.rs:8 -- vectors::embedding::udf::_vectors_ai_embedding_vector CREATE FUNCTION vectors."_vectors_ai_embedding_vector"( - "input" TEXT /* alloc::string::String */ + "input" TEXT /* alloc::string::String */ ) RETURNS vector /* vectors::datatype::vecf32::Vecf32Output */ STRICT VOLATILE LANGUAGE c /* Rust */ @@ -395,191 +395,191 @@ CREATE TYPE vector_index_stat AS ( -- List of operators CREATE OPERATOR + ( - PROCEDURE = _vectors_vecf32_operator_add, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = + + PROCEDURE = _vectors_vecf32_operator_add, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = + ); CREATE OPERATOR + ( - PROCEDURE = _vectors_vecf16_operator_add, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = + + PROCEDURE = _vectors_vecf16_operator_add, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = + ); CREATE OPERATOR - ( - PROCEDURE = _vectors_vecf32_operator_minus, - LEFTARG = vector, - RIGHTARG = vector + PROCEDURE = _vectors_vecf32_operator_minus, + LEFTARG = vector, + RIGHTARG = vector ); CREATE OPERATOR - ( - PROCEDURE = _vectors_vecf16_operator_minus, - LEFTARG = vecf16, - RIGHTARG = vecf16 + PROCEDURE = _vectors_vecf16_operator_minus, + LEFTARG = vecf16, + RIGHTARG = vecf16 ); CREATE OPERATOR = ( - PROCEDURE = _vectors_vecf32_operator_eq, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = =, - NEGATOR = <>, - RESTRICT = eqsel, - JOIN = eqjoinsel + PROCEDURE = _vectors_vecf32_operator_eq, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel ); CREATE OPERATOR = ( - PROCEDURE = _vectors_vecf16_operator_eq, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = =, - NEGATOR = <>, - RESTRICT = eqsel, - JOIN = eqjoinsel + PROCEDURE = _vectors_vecf16_operator_eq, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel ); CREATE OPERATOR <> ( - PROCEDURE = _vectors_vecf32_operator_neq, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <>, - NEGATOR = =, - RESTRICT = eqsel, - JOIN = eqjoinsel + PROCEDURE = _vectors_vecf32_operator_neq, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel ); CREATE OPERATOR <> ( - PROCEDURE = _vectors_vecf16_operator_neq, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <>, - NEGATOR = =, - RESTRICT = eqsel, - JOIN = eqjoinsel + PROCEDURE = _vectors_vecf16_operator_neq, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel ); CREATE OPERATOR < ( - PROCEDURE = _vectors_vecf32_operator_lt, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = >, - NEGATOR = >=, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel + PROCEDURE = _vectors_vecf32_operator_lt, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel ); CREATE OPERATOR < ( - PROCEDURE = _vectors_vecf16_operator_lt, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = >, - NEGATOR = >=, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel + PROCEDURE = _vectors_vecf16_operator_lt, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel ); CREATE OPERATOR > ( - PROCEDURE = _vectors_vecf32_operator_gt, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <, - NEGATOR = <=, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel + PROCEDURE = _vectors_vecf32_operator_gt, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel ); CREATE OPERATOR > ( - PROCEDURE = _vectors_vecf16_operator_gt, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <, - NEGATOR = <=, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel + PROCEDURE = _vectors_vecf16_operator_gt, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel ); CREATE OPERATOR <= ( - PROCEDURE = _vectors_vecf32_operator_lte, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = >=, - NEGATOR = >, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel + PROCEDURE = _vectors_vecf32_operator_lte, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel ); CREATE OPERATOR <= ( - PROCEDURE = _vectors_vecf16_operator_lte, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = >=, - NEGATOR = >, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel + PROCEDURE = _vectors_vecf16_operator_lte, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel ); CREATE OPERATOR >= ( - PROCEDURE = _vectors_vecf32_operator_gte, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <=, - NEGATOR = <, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel + PROCEDURE = _vectors_vecf32_operator_gte, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel ); CREATE OPERATOR >= ( - PROCEDURE = _vectors_vecf16_operator_gte, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <=, - NEGATOR = <, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel + PROCEDURE = _vectors_vecf16_operator_gte, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel ); CREATE OPERATOR <-> ( - PROCEDURE = _vectors_vecf32_operator_l2, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <-> + PROCEDURE = _vectors_vecf32_operator_l2, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <-> ); CREATE OPERATOR <-> ( - PROCEDURE = _vectors_vecf16_operator_l2, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <-> + PROCEDURE = _vectors_vecf16_operator_l2, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <-> ); CREATE OPERATOR <#> ( - PROCEDURE = _vectors_vecf32_operator_dot, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <#> + PROCEDURE = _vectors_vecf32_operator_dot, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <#> ); CREATE OPERATOR <#> ( - PROCEDURE = _vectors_vecf16_operator_dot, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <#> + PROCEDURE = _vectors_vecf16_operator_dot, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <#> ); CREATE OPERATOR <=> ( - PROCEDURE = _vectors_vecf32_operator_cosine, - LEFTARG = vector, - RIGHTARG = vector, - COMMUTATOR = <=> + PROCEDURE = _vectors_vecf32_operator_cosine, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <=> ); CREATE OPERATOR <=> ( - PROCEDURE = _vectors_vecf16_operator_cosine, - LEFTARG = vecf16, - RIGHTARG = vecf16, - COMMUTATOR = <=> + PROCEDURE = _vectors_vecf16_operator_cosine, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <=> ); -- List of functions diff --git a/sql/install/vectors--0.3.0.sql b/sql/install/vectors--0.3.0.sql new file mode 100644 index 000000000..fbac529e4 --- /dev/null +++ b/sql/install/vectors--0.3.0.sql @@ -0,0 +1,1806 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +/* +This file is auto generated by pgrx. + +The ordering of items is not stable, it is driven by a dependency graph. +*/ + + +-- src/lib.rs:20 +-- bootstrap +-- bootstrap begin + +-- List of shell types + +CREATE TYPE vector; +CREATE TYPE vecf16; +CREATE TYPE svector; +CREATE TYPE bvector; +CREATE TYPE veci8; +CREATE TYPE vector_index_stat; + +-- bootstrap end + + +-- src/datatype/subscript_veci8.rs:10 +-- vectors::datatype::subscript_veci8::_vectors_veci8_subscript +CREATE FUNCTION _vectors_veci8_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_subscript_wrapper'; + + + +-- src/datatype/binary_veci8.rs:11 +-- vectors::datatype::binary_veci8::_vectors_veci8_send +CREATE FUNCTION vectors."_vectors_veci8_send"( + "vector" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bytea /* vectors::datatype::binary::Bytea */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_send_wrapper'; + +-- src/datatype/binary_veci8.rs:33 +-- vectors::datatype::binary_veci8::_vectors_veci8_recv +CREATE FUNCTION vectors."_vectors_veci8_recv"( + "internal" internal, /* pgrx::datum::internal::Internal */ + "oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_recv_wrapper'; + +-- src/datatype/text_veci8.rs:41 +-- vectors::datatype::text_veci8::_vectors_veci8_out +CREATE FUNCTION vectors."_vectors_veci8_out"( + "vector" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_out_wrapper'; + +-- src/datatype/operators_veci8.rs:65 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_neq +CREATE FUNCTION vectors."_vectors_veci8_operator_neq"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_neq_wrapper'; + +-- src/datatype/operators_veci8.rs:22 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_minus +CREATE FUNCTION vectors."_vectors_veci8_operator_minus"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_minus_wrapper'; + +-- src/datatype/operators_veci8.rs:41 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_lte +CREATE FUNCTION vectors."_vectors_veci8_operator_lte"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_lte_wrapper'; + +-- src/datatype/operators_veci8.rs:35 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_lt +CREATE FUNCTION vectors."_vectors_veci8_operator_lt"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_lt_wrapper'; + +-- src/datatype/operators_veci8.rs:83 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_l2 +CREATE FUNCTION vectors."_vectors_veci8_operator_l2"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_l2_wrapper'; + +-- src/datatype/operators_veci8.rs:53 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_gte +CREATE FUNCTION vectors."_vectors_veci8_operator_gte"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_gte_wrapper'; + +-- src/datatype/operators_veci8.rs:47 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_gt +CREATE FUNCTION vectors."_vectors_veci8_operator_gt"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_gt_wrapper'; + +-- src/datatype/operators_veci8.rs:59 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_eq +CREATE FUNCTION vectors."_vectors_veci8_operator_eq"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_eq_wrapper'; + +-- src/datatype/operators_veci8.rs:77 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_dot +CREATE FUNCTION vectors."_vectors_veci8_operator_dot"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_dot_wrapper'; + +-- src/datatype/operators_veci8.rs:71 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_cosine +CREATE FUNCTION vectors."_vectors_veci8_operator_cosine"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_cosine_wrapper'; + +-- src/datatype/operators_veci8.rs:9 +-- vectors::datatype::operators_veci8::_vectors_veci8_operator_add +CREATE FUNCTION vectors."_vectors_veci8_operator_add"( + "lhs" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "rhs" veci8 /* vectors::datatype::memory_veci8::Veci8Input */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_operator_add_wrapper'; + +-- src/datatype/text_veci8.rs:9 +-- vectors::datatype::text_veci8::_vectors_veci8_in +CREATE FUNCTION vectors."_vectors_veci8_in"( + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_veci8_in_wrapper'; + +-- src/datatype/subscript_vecf32.rs:10 +-- vectors::datatype::subscript_vecf32::_vectors_vecf32_subscript +CREATE FUNCTION _vectors_vecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf32_subscript_wrapper'; + + + +-- src/datatype/binary_vecf32.rs:11 +-- vectors::datatype::binary_vecf32::_vectors_vecf32_send +CREATE FUNCTION vectors."_vectors_vecf32_send"( + "vector" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bytea /* vectors::datatype::binary::Bytea */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_send_wrapper'; + +-- src/datatype/binary_vecf32.rs:25 +-- vectors::datatype::binary_vecf32::_vectors_vecf32_recv +CREATE FUNCTION vectors."_vectors_vecf32_recv"( + "internal" internal, /* pgrx::datum::internal::Internal */ + "oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_recv_wrapper'; + +-- src/datatype/text_vecf32.rs:30 +-- vectors::datatype::text_vecf32::_vectors_vecf32_out +CREATE FUNCTION vectors."_vectors_vecf32_out"( + "vector" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_out_wrapper'; + +-- src/datatype/operators_vecf32.rs:60 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_neq +CREATE FUNCTION vectors."_vectors_vecf32_operator_neq"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_neq_wrapper'; + +-- src/datatype/operators_vecf32.rs:20 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_minus +CREATE FUNCTION vectors."_vectors_vecf32_operator_minus"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_minus_wrapper'; + +-- src/datatype/operators_vecf32.rs:36 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_lte +CREATE FUNCTION vectors."_vectors_vecf32_operator_lte"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_lte_wrapper'; + +-- src/datatype/operators_vecf32.rs:30 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_lt +CREATE FUNCTION vectors."_vectors_vecf32_operator_lt"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_lt_wrapper'; + +-- src/datatype/operators_vecf32.rs:78 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_l2 +CREATE FUNCTION vectors."_vectors_vecf32_operator_l2"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_l2_wrapper'; + +-- src/datatype/operators_vecf32.rs:48 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_gte +CREATE FUNCTION vectors."_vectors_vecf32_operator_gte"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_gte_wrapper'; + +-- src/datatype/operators_vecf32.rs:42 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_gt +CREATE FUNCTION vectors."_vectors_vecf32_operator_gt"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_gt_wrapper'; + +-- src/datatype/operators_vecf32.rs:54 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_eq +CREATE FUNCTION vectors."_vectors_vecf32_operator_eq"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_eq_wrapper'; + +-- src/datatype/operators_vecf32.rs:72 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_dot +CREATE FUNCTION vectors."_vectors_vecf32_operator_dot"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_dot_wrapper'; + +-- src/datatype/operators_vecf32.rs:66 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_cosine +CREATE FUNCTION vectors."_vectors_vecf32_operator_cosine"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_cosine_wrapper'; + +-- src/datatype/operators_vecf32.rs:10 +-- vectors::datatype::operators_vecf32::_vectors_vecf32_operator_add +CREATE FUNCTION vectors."_vectors_vecf32_operator_add"( + "lhs" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "rhs" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_operator_add_wrapper'; + +-- src/datatype/text_vecf32.rs:10 +-- vectors::datatype::text_vecf32::_vectors_vecf32_in +CREATE FUNCTION vectors."_vectors_vecf32_in"( + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf32_in_wrapper'; + +-- src/datatype/subscript_vecf16.rs:10 +-- vectors::datatype::subscript_vecf16::_vectors_vecf16_subscript +CREATE FUNCTION _vectors_vecf16_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf16_subscript_wrapper'; + + + +-- src/datatype/binary_vecf16.rs:11 +-- vectors::datatype::binary_vecf16::_vectors_vecf16_send +CREATE FUNCTION vectors."_vectors_vecf16_send"( + "vector" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bytea /* vectors::datatype::binary::Bytea */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_send_wrapper'; + +-- src/datatype/binary_vecf16.rs:25 +-- vectors::datatype::binary_vecf16::_vectors_vecf16_recv +CREATE FUNCTION vectors."_vectors_vecf16_recv"( + "internal" internal, /* pgrx::datum::internal::Internal */ + "oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS vecf16 /* vectors::datatype::memory_vecf16::Vecf16Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_recv_wrapper'; + +-- src/datatype/text_vecf16.rs:30 +-- vectors::datatype::text_vecf16::_vectors_vecf16_out +CREATE FUNCTION vectors."_vectors_vecf16_out"( + "vector" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_out_wrapper'; + +-- src/datatype/operators_vecf16.rs:60 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_neq +CREATE FUNCTION vectors."_vectors_vecf16_operator_neq"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_neq_wrapper'; + +-- src/datatype/operators_vecf16.rs:20 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_minus +CREATE FUNCTION vectors."_vectors_vecf16_operator_minus"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS vecf16 /* vectors::datatype::memory_vecf16::Vecf16Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_minus_wrapper'; + +-- src/datatype/operators_vecf16.rs:36 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_lte +CREATE FUNCTION vectors."_vectors_vecf16_operator_lte"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_lte_wrapper'; + +-- src/datatype/operators_vecf16.rs:30 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_lt +CREATE FUNCTION vectors."_vectors_vecf16_operator_lt"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_lt_wrapper'; + +-- src/datatype/operators_vecf16.rs:78 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_l2 +CREATE FUNCTION vectors."_vectors_vecf16_operator_l2"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_l2_wrapper'; + +-- src/datatype/operators_vecf16.rs:48 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_gte +CREATE FUNCTION vectors."_vectors_vecf16_operator_gte"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_gte_wrapper'; + +-- src/datatype/operators_vecf16.rs:42 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_gt +CREATE FUNCTION vectors."_vectors_vecf16_operator_gt"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_gt_wrapper'; + +-- src/datatype/operators_vecf16.rs:54 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_eq +CREATE FUNCTION vectors."_vectors_vecf16_operator_eq"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_eq_wrapper'; + +-- src/datatype/operators_vecf16.rs:72 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_dot +CREATE FUNCTION vectors."_vectors_vecf16_operator_dot"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_dot_wrapper'; + +-- src/datatype/operators_vecf16.rs:66 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_cosine +CREATE FUNCTION vectors."_vectors_vecf16_operator_cosine"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_cosine_wrapper'; + +-- src/datatype/operators_vecf16.rs:10 +-- vectors::datatype::operators_vecf16::_vectors_vecf16_operator_add +CREATE FUNCTION vectors."_vectors_vecf16_operator_add"( + "lhs" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "rhs" vecf16 /* vectors::datatype::memory_vecf16::Vecf16Input */ +) RETURNS vecf16 /* vectors::datatype::memory_vecf16::Vecf16Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_operator_add_wrapper'; + +-- src/datatype/text_vecf16.rs:10 +-- vectors::datatype::text_vecf16::_vectors_vecf16_in +CREATE FUNCTION vectors."_vectors_vecf16_in"( + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS vecf16 /* vectors::datatype::memory_vecf16::Vecf16Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_vecf16_in_wrapper'; + +-- src/datatype/typmod.rs:76 +-- vectors::datatype::typmod::_vectors_typmod_out +CREATE FUNCTION vectors."_vectors_typmod_out"( + "typmod" INT /* i32 */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_typmod_out_wrapper'; + +-- src/datatype/typmod.rs:48 +-- vectors::datatype::typmod::_vectors_typmod_in_65535 +CREATE FUNCTION vectors."_vectors_typmod_in_65535"( + "list" cstring[] /* pgrx::datum::array::Array<&core::ffi::c_str::CStr> */ +) RETURNS INT /* i32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_typmod_in_65535_wrapper'; + +-- src/datatype/typmod.rs:62 +-- vectors::datatype::typmod::_vectors_typmod_in_1048575 +CREATE FUNCTION vectors."_vectors_typmod_in_1048575"( + "list" cstring[] /* pgrx::datum::array::Array<&core::ffi::c_str::CStr> */ +) RETURNS INT /* i32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_typmod_in_1048575_wrapper'; + +-- src/datatype/functions_veci8.rs:7 +-- vectors::datatype::functions_veci8::_vectors_to_veci8 +CREATE FUNCTION vectors."_vectors_to_veci8"( + "len" INT, /* i32 */ + "alpha" real, /* f32 */ + "offset" real, /* f32 */ + "values" INT[] /* pgrx::datum::array::Array */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_to_veci8_wrapper'; + +-- src/datatype/functions_svecf32.rs:7 +-- vectors::datatype::functions_svecf32::_vectors_to_svector +CREATE FUNCTION vectors."_vectors_to_svector"( + "dims" INT, /* i32 */ + "index" INT[], /* pgrx::datum::array::Array */ + "value" real[] /* pgrx::datum::array::Array */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_to_svector_wrapper'; + +-- src/embedding/mod.rs:9 +-- vectors::embedding::_vectors_text2vec_openai +CREATE FUNCTION vectors."_vectors_text2vec_openai"( + "input" TEXT, /* alloc::string::String */ + "model" TEXT /* alloc::string::String */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +STRICT VOLATILE PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; + +-- src/datatype/subscript_svecf32.rs:10 +-- vectors::datatype::subscript_svecf32::_vectors_svecf32_subscript +CREATE FUNCTION _vectors_svecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_subscript_wrapper'; + + + +-- src/datatype/binary_svecf32.rs:12 +-- vectors::datatype::binary_svecf32::_vectors_svecf32_send +CREATE FUNCTION vectors."_vectors_svecf32_send"( + "vector" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bytea /* vectors::datatype::binary::Bytea */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_send_wrapper'; + +-- src/datatype/binary_svecf32.rs:31 +-- vectors::datatype::binary_svecf32::_vectors_svecf32_recv +CREATE FUNCTION vectors."_vectors_svecf32_recv"( + "internal" internal, /* pgrx::datum::internal::Internal */ + "oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_recv_wrapper'; + +-- src/datatype/text_svecf32.rs:42 +-- vectors::datatype::text_svecf32::_vectors_svecf32_out +CREATE FUNCTION vectors."_vectors_svecf32_out"( + "vector" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_out_wrapper'; + +-- src/datatype/operators_svecf32.rs:122 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_neq +CREATE FUNCTION vectors."_vectors_svecf32_operator_neq"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_neq_wrapper'; + +-- src/datatype/operators_svecf32.rs:51 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_minus +CREATE FUNCTION vectors."_vectors_svecf32_operator_minus"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_minus_wrapper'; + +-- src/datatype/operators_svecf32.rs:98 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_lte +CREATE FUNCTION vectors."_vectors_svecf32_operator_lte"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_lte_wrapper'; + +-- src/datatype/operators_svecf32.rs:92 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_lt +CREATE FUNCTION vectors."_vectors_svecf32_operator_lt"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_lt_wrapper'; + +-- src/datatype/operators_svecf32.rs:140 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_l2 +CREATE FUNCTION vectors."_vectors_svecf32_operator_l2"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_l2_wrapper'; + +-- src/datatype/operators_svecf32.rs:110 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_gte +CREATE FUNCTION vectors."_vectors_svecf32_operator_gte"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_gte_wrapper'; + +-- src/datatype/operators_svecf32.rs:104 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_gt +CREATE FUNCTION vectors."_vectors_svecf32_operator_gt"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_gt_wrapper'; + +-- src/datatype/operators_svecf32.rs:116 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_eq +CREATE FUNCTION vectors."_vectors_svecf32_operator_eq"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_eq_wrapper'; + +-- src/datatype/operators_svecf32.rs:134 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_dot +CREATE FUNCTION vectors."_vectors_svecf32_operator_dot"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_dot_wrapper'; + +-- src/datatype/operators_svecf32.rs:128 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_cosine +CREATE FUNCTION vectors."_vectors_svecf32_operator_cosine"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_cosine_wrapper'; + +-- src/datatype/operators_svecf32.rs:10 +-- vectors::datatype::operators_svecf32::_vectors_svecf32_operator_add +CREATE FUNCTION vectors."_vectors_svecf32_operator_add"( + "lhs" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "rhs" svector /* vectors::datatype::memory_svecf32::SVecf32Input */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_add_wrapper'; + +-- src/datatype/text_svecf32.rs:12 +-- vectors::datatype::text_svecf32::_vectors_svecf32_in +CREATE FUNCTION vectors."_vectors_svecf32_in"( + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_svecf32_in_wrapper'; + +-- src/index/functions.rs:2 +-- vectors::index::functions::_vectors_pgvectors_upgrade +CREATE FUNCTION vectors."_vectors_pgvectors_upgrade"() RETURNS void +STRICT VOLATILE PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; + +-- src/index/views.rs:6 +-- vectors::index::views::_vectors_index_stat +CREATE FUNCTION vectors."_vectors_index_stat"( + "oid" oid /* pgrx_pg_sys::submodules::oids::Oid */ +) RETURNS vectors.vector_index_stat /* pgrx::heap_tuple::PgHeapTuple */ +STRICT VOLATILE PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_index_stat_wrapper'; + +-- src/datatype/casts.rs:122 +-- vectors::datatype::casts::_vectors_cast_veci8_to_vecf32 +CREATE FUNCTION vectors."_vectors_cast_veci8_to_vecf32"( + "vector" veci8, /* vectors::datatype::memory_veci8::Veci8Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_veci8_to_vecf32_wrapper'; + +-- src/datatype/casts.rs:134 +-- vectors::datatype::casts::_vectors_cast_vecf32_to_veci8 +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_veci8"( + "vector" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS veci8 /* vectors::datatype::memory_veci8::Veci8Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_veci8_wrapper'; + +-- src/datatype/casts.rs:36 +-- vectors::datatype::casts::_vectors_cast_vecf32_to_vecf16 +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_vecf16"( + "vector" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vecf16 /* vectors::datatype::memory_vecf16::Vecf16Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_vecf16_wrapper'; + +-- src/datatype/casts.rs:56 +-- vectors::datatype::casts::_vectors_cast_vecf32_to_svecf32 +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_svecf32"( + "vector" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS svector /* vectors::datatype::memory_svecf32::SVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_svecf32_wrapper'; + +-- src/datatype/casts.rs:91 +-- vectors::datatype::casts::_vectors_cast_vecf32_to_bvecf32 +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_bvecf32"( + "vector" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_bvecf32_wrapper'; + +-- src/datatype/casts.rs:27 +-- vectors::datatype::casts::_vectors_cast_vecf32_to_array +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_array"( + "vector" vector, /* vectors::datatype::memory_vecf32::Vecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS real[] /* alloc::vec::Vec */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_array_wrapper'; + +-- src/datatype/casts.rs:46 +-- vectors::datatype::casts::_vectors_cast_vecf16_to_vecf32 +CREATE FUNCTION vectors."_vectors_cast_vecf16_to_vecf32"( + "vector" vecf16, /* vectors::datatype::memory_vecf16::Vecf16Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_vecf16_to_vecf32_wrapper'; + +-- src/datatype/casts.rs:81 +-- vectors::datatype::casts::_vectors_cast_svecf32_to_vecf32 +CREATE FUNCTION vectors."_vectors_cast_svecf32_to_vecf32"( + "vector" svector, /* vectors::datatype::memory_svecf32::SVecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_svecf32_to_vecf32_wrapper'; + +-- src/datatype/casts.rs:108 +-- vectors::datatype::casts::_vectors_cast_bvecf32_to_vecf32 +CREATE FUNCTION vectors."_vectors_cast_bvecf32_to_vecf32"( + "vector" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "_typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_bvecf32_to_vecf32_wrapper'; + +-- src/datatype/casts.rs:12 +-- vectors::datatype::casts::_vectors_cast_array_to_vecf32 +CREATE FUNCTION vectors."_vectors_cast_array_to_vecf32"( + "array" real[], /* pgrx::datum::array::Array */ + "typmod" INT, /* i32 */ + "_explicit" bool /* bool */ +) RETURNS vector /* vectors::datatype::memory_vecf32::Vecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_cast_array_to_vecf32_wrapper'; + +-- src/datatype/subscript_bvecf32.rs:10 +-- vectors::datatype::subscript_bvecf32::_vectors_bvecf32_subscript +CREATE FUNCTION _vectors_bvecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_subscript_wrapper'; + + + +-- src/datatype/binary_bvecf32.rs:11 +-- vectors::datatype::binary_bvecf32::_vectors_bvecf32_send +CREATE FUNCTION vectors."_vectors_bvecf32_send"( + "vector" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bytea /* vectors::datatype::binary::Bytea */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_send_wrapper'; + +-- src/datatype/binary_bvecf32.rs:25 +-- vectors::datatype::binary_bvecf32::_vectors_bvecf32_recv +CREATE FUNCTION vectors."_vectors_bvecf32_recv"( + "internal" internal, /* pgrx::datum::internal::Internal */ + "oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_recv_wrapper'; + +-- src/datatype/text_bvecf32.rs:42 +-- vectors::datatype::text_bvecf32::_vectors_bvecf32_out +CREATE FUNCTION vectors."_vectors_bvecf32_out"( + "vector" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS cstring /* alloc::ffi::c_str::CString */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_out_wrapper'; + +-- src/datatype/operators_bvecf32.rs:31 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_xor +CREATE FUNCTION vectors."_vectors_bvecf32_operator_xor"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_xor_wrapper'; + +-- src/datatype/operators_bvecf32.rs:20 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_or +CREATE FUNCTION vectors."_vectors_bvecf32_operator_or"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_or_wrapper'; + +-- src/datatype/operators_bvecf32.rs:72 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_neq +CREATE FUNCTION vectors."_vectors_bvecf32_operator_neq"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_neq_wrapper'; + +-- src/datatype/operators_bvecf32.rs:48 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_lte +CREATE FUNCTION vectors."_vectors_bvecf32_operator_lte"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_lte_wrapper'; + +-- src/datatype/operators_bvecf32.rs:42 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_lt +CREATE FUNCTION vectors."_vectors_bvecf32_operator_lt"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_lt_wrapper'; + +-- src/datatype/operators_bvecf32.rs:90 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_l2 +CREATE FUNCTION vectors."_vectors_bvecf32_operator_l2"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_l2_wrapper'; + +-- src/datatype/operators_bvecf32.rs:96 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_jaccard +CREATE FUNCTION vectors."_vectors_bvecf32_operator_jaccard"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_jaccard_wrapper'; + +-- src/datatype/operators_bvecf32.rs:60 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_gte +CREATE FUNCTION vectors."_vectors_bvecf32_operator_gte"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_gte_wrapper'; + +-- src/datatype/operators_bvecf32.rs:54 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_gt +CREATE FUNCTION vectors."_vectors_bvecf32_operator_gt"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_gt_wrapper'; + +-- src/datatype/operators_bvecf32.rs:66 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_eq +CREATE FUNCTION vectors."_vectors_bvecf32_operator_eq"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bool /* bool */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_eq_wrapper'; + +-- src/datatype/operators_bvecf32.rs:84 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_dot +CREATE FUNCTION vectors."_vectors_bvecf32_operator_dot"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_dot_wrapper'; + +-- src/datatype/operators_bvecf32.rs:78 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_cosine +CREATE FUNCTION vectors."_vectors_bvecf32_operator_cosine"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS real /* f32 */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_cosine_wrapper'; + +-- src/datatype/operators_bvecf32.rs:9 +-- vectors::datatype::operators_bvecf32::_vectors_bvecf32_operator_and +CREATE FUNCTION vectors."_vectors_bvecf32_operator_and"( + "lhs" bvector, /* vectors::datatype::memory_bvecf32::BVecf32Input */ + "rhs" bvector /* vectors::datatype::memory_bvecf32::BVecf32Input */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_and_wrapper'; + +-- src/datatype/text_bvecf32.rs:10 +-- vectors::datatype::text_bvecf32::_vectors_bvecf32_in +CREATE FUNCTION vectors."_vectors_bvecf32_in"( + "input" cstring, /* &core::ffi::c_str::CStr */ + "_oid" oid, /* pgrx_pg_sys::submodules::oids::Oid */ + "typmod" INT /* i32 */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_bvecf32_in_wrapper'; + +-- src/datatype/functions_bvecf32.rs:7 +-- vectors::datatype::functions_bvecf32::_vectors_binarize +CREATE FUNCTION vectors."_vectors_binarize"( + "vector" vector /* vectors::datatype::memory_vecf32::Vecf32Input */ +) RETURNS bvector /* vectors::datatype::memory_bvecf32::BVecf32Output */ +IMMUTABLE STRICT PARALLEL SAFE +LANGUAGE c /* Rust */ +AS 'MODULE_PATHNAME', '_vectors_binarize_wrapper'; + +-- src/index/am.rs:32 +-- vectors::index::am::_vectors_amhandler +CREATE FUNCTION _vectors_amhandler(internal) RETURNS index_am_handler +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_amhandler_wrapper'; + + + +-- src/lib.rs:21 +-- finalize +-- finalize begin + +-- List of data types + +CREATE TYPE vector ( + INPUT = _vectors_vecf32_in, + OUTPUT = _vectors_vecf32_out, + RECEIVE = _vectors_vecf32_recv, + SEND = _vectors_vecf32_send, + SUBSCRIPT = _vectors_vecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE vecf16 ( + INPUT = _vectors_vecf16_in, + OUTPUT = _vectors_vecf16_out, + RECEIVE = _vectors_vecf16_recv, + SEND = _vectors_vecf16_send, + SUBSCRIPT = _vectors_vecf16_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE svector ( + INPUT = _vectors_svecf32_in, + OUTPUT = _vectors_svecf32_out, + RECEIVE = _vectors_svecf32_recv, + SEND = _vectors_svecf32_send, + SUBSCRIPT = _vectors_svecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_1048575, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE bvector ( + INPUT = _vectors_bvecf32_in, + OUTPUT = _vectors_bvecf32_out, + RECEIVE = _vectors_bvecf32_recv, + SEND = _vectors_bvecf32_send, + SUBSCRIPT = _vectors_bvecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE veci8 ( + INPUT = _vectors_veci8_in, + OUTPUT = _vectors_veci8_out, + RECEIVE = _vectors_veci8_recv, + SEND = _vectors_veci8_send, + SUBSCRIPT = _vectors_veci8_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE vector_index_stat AS ( + idx_status TEXT, + idx_indexing BOOL, + idx_tuples BIGINT, + idx_sealed BIGINT[], + idx_growing BIGINT[], + idx_write BIGINT, + idx_size BIGINT, + idx_options TEXT +); + +-- List of operators + +CREATE OPERATOR + ( + PROCEDURE = _vectors_vecf32_operator_add, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = + +); + +CREATE OPERATOR + ( + PROCEDURE = _vectors_vecf16_operator_add, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = + +); + +CREATE OPERATOR + ( + PROCEDURE = _vectors_svecf32_operator_add, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = + +); + +CREATE OPERATOR + ( + PROCEDURE = _vectors_veci8_operator_add, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = + +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_vecf32_operator_minus, + LEFTARG = vector, + RIGHTARG = vector +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_vecf16_operator_minus, + LEFTARG = vecf16, + RIGHTARG = vecf16 +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_svecf32_operator_minus, + LEFTARG = svector, + RIGHTARG = svector +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_veci8_operator_minus, + LEFTARG = veci8, + RIGHTARG = veci8 +); + +CREATE OPERATOR & ( + PROCEDURE = _vectors_bvecf32_operator_and, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR | ( + PROCEDURE = _vectors_bvecf32_operator_or, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR ^ ( + PROCEDURE = _vectors_bvecf32_operator_xor, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_vecf32_operator_eq, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_vecf16_operator_eq, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_svecf32_operator_eq, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_bvecf32_operator_eq, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_veci8_operator_eq, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_vecf32_operator_neq, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_vecf16_operator_neq, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_svecf32_operator_neq, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_bvecf32_operator_neq, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_veci8_operator_neq, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_vecf32_operator_lt, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_vecf16_operator_lt, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_svecf32_operator_lt, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_bvecf32_operator_lt, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_veci8_operator_lt, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_vecf32_operator_gt, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_vecf16_operator_gt, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_svecf32_operator_gt, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_bvecf32_operator_gt, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_veci8_operator_gt, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_vecf32_operator_lte, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_vecf16_operator_lte, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_svecf32_operator_lte, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_bvecf32_operator_lte, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_veci8_operator_lte, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_vecf32_operator_gte, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_vecf16_operator_gte, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_svecf32_operator_gte, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_bvecf32_operator_gte, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_veci8_operator_gte, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_vecf32_operator_l2, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_vecf16_operator_l2, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_svecf32_operator_l2, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_bvecf32_operator_l2, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_veci8_operator_l2, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <-> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_vecf32_operator_dot, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_vecf16_operator_dot, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_svecf32_operator_dot, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_bvecf32_operator_dot, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_veci8_operator_dot, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <#> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_vecf32_operator_cosine, + LEFTARG = vector, + RIGHTARG = vector, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_vecf16_operator_cosine, + LEFTARG = vecf16, + RIGHTARG = vecf16, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_svecf32_operator_cosine, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_bvecf32_operator_cosine, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_veci8_operator_cosine, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <=> +); + +CREATE OPERATOR <~> ( + PROCEDURE = _vectors_bvecf32_operator_jaccard, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <~> +); + +-- List of functions + +CREATE FUNCTION pgvectors_upgrade() RETURNS void +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; + +CREATE FUNCTION to_svector("dims" INT, "indexes" INT[], "values" real[]) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_svector_wrapper'; + +CREATE FUNCTION to_veci8("len" INT, "alpha" real, "offset" real, "values" INT[]) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_veci8_wrapper'; + +CREATE FUNCTION binarize("vector" vector) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_binarize_wrapper'; + +CREATE FUNCTION text2vec_openai("input" TEXT, "model" TEXT) RETURNS vector +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; + +CREATE FUNCTION text2vec_openai_v3(input TEXT) RETURNS vector +STRICT PARALLEL SAFE LANGUAGE plpgsql AS +$$ +DECLARE +variable vectors.vector; +BEGIN + variable := vectors.text2vec_openai(input, 'text-embedding-3-small'); + RETURN variable; +END; +$$; + +-- List of casts + +CREATE CAST (real[] AS vector) + WITH FUNCTION _vectors_cast_array_to_vecf32(real[], integer, boolean) AS IMPLICIT; + +CREATE CAST (vector AS real[]) + WITH FUNCTION _vectors_cast_vecf32_to_array(vector, integer, boolean) AS IMPLICIT; + +CREATE CAST (vector AS vecf16) + WITH FUNCTION _vectors_cast_vecf32_to_vecf16(vector, integer, boolean); + +CREATE CAST (vecf16 AS vector) + WITH FUNCTION _vectors_cast_vecf16_to_vecf32(vecf16, integer, boolean); + +CREATE CAST (vector AS svector) + WITH FUNCTION _vectors_cast_vecf32_to_svecf32(vector, integer, boolean); + +CREATE CAST (svector AS vector) + WITH FUNCTION _vectors_cast_svecf32_to_vecf32(svector, integer, boolean); + +CREATE CAST (vector AS bvector) + WITH FUNCTION _vectors_cast_vecf32_to_bvecf32(vector, integer, boolean); + +CREATE CAST (bvector AS vector) + WITH FUNCTION _vectors_cast_bvecf32_to_vecf32(bvector, integer, boolean); + +CREATE CAST (veci8 AS vector) + WITH FUNCTION _vectors_cast_veci8_to_vecf32(veci8, integer, boolean); + +CREATE CAST (vector AS veci8) + WITH FUNCTION _vectors_cast_vecf32_to_veci8(vector, integer, boolean); + +-- List of access methods + +CREATE ACCESS METHOD vectors TYPE INDEX HANDLER _vectors_amhandler; +COMMENT ON ACCESS METHOD vectors IS 'pgvecto.rs index access method'; + +-- List of operator families + +CREATE OPERATOR FAMILY vector_l2_ops USING vectors; + +CREATE OPERATOR FAMILY vector_dot_ops USING vectors; + +CREATE OPERATOR FAMILY vector_cos_ops USING vectors; + +CREATE OPERATOR FAMILY vecf16_l2_ops USING vectors; + +CREATE OPERATOR FAMILY vecf16_dot_ops USING vectors; + +CREATE OPERATOR FAMILY vecf16_cos_ops USING vectors; + +CREATE OPERATOR FAMILY svector_l2_ops USING vectors; + +CREATE OPERATOR FAMILY svector_dot_ops USING vectors; + +CREATE OPERATOR FAMILY svector_cos_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_l2_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_dot_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_cos_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_jaccard_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_l2_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_dot_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_cos_ops USING vectors; + +-- List of operator classes + +CREATE OPERATOR CLASS vector_l2_ops + FOR TYPE vector USING vectors FAMILY vector_l2_ops AS + OPERATOR 1 <-> (vector, vector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS vector_dot_ops + FOR TYPE vector USING vectors FAMILY vector_dot_ops AS + OPERATOR 1 <#> (vector, vector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS vector_cos_ops + FOR TYPE vector USING vectors FAMILY vector_cos_ops AS + OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS vecf16_l2_ops + FOR TYPE vecf16 USING vectors FAMILY vecf16_l2_ops AS + OPERATOR 1 <-> (vecf16, vecf16) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS vecf16_dot_ops + FOR TYPE vecf16 USING vectors FAMILY vecf16_dot_ops AS + OPERATOR 1 <#> (vecf16, vecf16) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS vecf16_cos_ops + FOR TYPE vecf16 USING vectors FAMILY vecf16_cos_ops AS + OPERATOR 1 <=> (vecf16, vecf16) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS svector_l2_ops + FOR TYPE svector USING vectors FAMILY svector_l2_ops AS + OPERATOR 1 <-> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS svector_dot_ops + FOR TYPE svector USING vectors FAMILY svector_dot_ops AS + OPERATOR 1 <#> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS svector_cos_ops + FOR TYPE svector USING vectors FAMILY svector_cos_ops AS + OPERATOR 1 <=> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_l2_ops + FOR TYPE bvector USING vectors FAMILY bvector_l2_ops AS + OPERATOR 1 <-> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_dot_ops + FOR TYPE bvector USING vectors FAMILY bvector_dot_ops AS + OPERATOR 1 <#> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_cos_ops + FOR TYPE bvector USING vectors FAMILY bvector_cos_ops AS + OPERATOR 1 <=> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_jaccard_ops + FOR TYPE bvector USING vectors FAMILY bvector_jaccard_ops AS + OPERATOR 1 <~> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_l2_ops + FOR TYPE veci8 USING vectors FAMILY veci8_l2_ops AS + OPERATOR 1 <-> (veci8, veci8) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_dot_ops + FOR TYPE veci8 USING vectors FAMILY veci8_dot_ops AS + OPERATOR 1 <#> (veci8, veci8) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_cos_ops + FOR TYPE veci8 USING vectors FAMILY veci8_cos_ops AS + OPERATOR 1 <=> (veci8, veci8) FOR ORDER BY float_ops; + +-- List of views + +CREATE VIEW pg_vector_index_stat AS + SELECT + C.oid AS tablerelid, + I.oid AS indexrelid, + C.relname AS tablename, + I.relname AS indexname, + (_vectors_index_stat(I.oid)).* + FROM pg_class C JOIN + pg_index X ON C.oid = X.indrelid JOIN + pg_class I ON I.oid = X.indexrelid JOIN + pg_am A ON A.oid = I.relam + WHERE A.amname = 'vectors'; + +GRANT SELECT ON TABLE pg_vector_index_stat TO PUBLIC; + +-- finalize end + diff --git a/sql/upgrade/vectors--0.2.1--0.3.0.sql b/sql/upgrade/vectors--0.2.1--0.3.0.sql new file mode 100644 index 000000000..f24a16d81 --- /dev/null +++ b/sql/upgrade/vectors--0.2.1--0.3.0.sql @@ -0,0 +1,911 @@ +-- List of shell types + +CREATE TYPE svector; +CREATE TYPE bvector; +CREATE TYPE veci8; + +-- List of internal functions + +CREATE FUNCTION _vectors_veci8_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_subscript_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_send"( + "vector" veci8 +) RETURNS bytea +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_send_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_recv"( + "internal" internal, + "oid" oid, + "typmod" INT +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_recv_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_out"( + "vector" veci8 +) RETURNS cstring +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_out_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_neq"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_neq_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_minus"( + "lhs" veci8, + "rhs" veci8 +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_minus_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_lte"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_lte_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_lt"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_lt_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_l2"( + "lhs" veci8, + "rhs" veci8 +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_l2_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_gte"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_gte_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_gt"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_gt_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_eq"( + "lhs" veci8, + "rhs" veci8 +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_eq_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_dot"( + "lhs" veci8, + "rhs" veci8 +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_dot_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_cosine"( + "lhs" veci8, + "rhs" veci8 +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_cosine_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_operator_add"( + "lhs" veci8, + "rhs" veci8 +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_operator_add_wrapper'; + +CREATE FUNCTION vectors."_vectors_veci8_in"( + "input" cstring, + "_oid" oid, + "typmod" INT +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_veci8_in_wrapper'; + +CREATE FUNCTION _vectors_vecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf32_subscript_wrapper'; + +CREATE FUNCTION vectors."_vectors_vecf32_send"( + "vector" vector +) RETURNS bytea +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf32_send_wrapper'; + +CREATE FUNCTION vectors."_vectors_vecf32_recv"( + "internal" internal, + "oid" oid, + "typmod" INT +) RETURNS vector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf32_recv_wrapper'; + +CREATE FUNCTION _vectors_vecf16_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf16_subscript_wrapper'; + +CREATE FUNCTION vectors."_vectors_vecf16_send"( + "vector" vecf16 +) RETURNS bytea +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf16_send_wrapper'; + +CREATE FUNCTION vectors."_vectors_vecf16_recv"( + "internal" internal, + "oid" oid, + "typmod" INT +) RETURNS vecf16 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_vecf16_recv_wrapper'; + +CREATE FUNCTION vectors."_vectors_typmod_in_65535"( + "list" cstring[] +) RETURNS INT +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_typmod_in_65535_wrapper'; + +CREATE FUNCTION vectors."_vectors_typmod_in_1048575"( + "list" cstring[] +) RETURNS INT +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_typmod_in_1048575_wrapper'; + +CREATE FUNCTION vectors."_vectors_to_veci8"( + "len" INT, + "alpha" real, + "offset" real, + "values" INT[] +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_veci8_wrapper'; + +CREATE FUNCTION vectors."_vectors_to_svector"( + "dims" INT, + "index" INT[], + "value" real[] +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_svector_wrapper'; + +CREATE FUNCTION vectors."_vectors_text2vec_openai"( + "input" TEXT, + "model" TEXT +) RETURNS vector +STRICT VOLATILE PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; + +CREATE FUNCTION _vectors_svecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_subscript_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_send"( + "vector" svector +) RETURNS bytea +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_send_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_recv"( + "internal" internal, + "oid" oid, + "typmod" INT +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_recv_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_out"( + "vector" svector +) RETURNS cstring +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_out_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_neq"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_neq_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_minus"( + "lhs" svector, + "rhs" svector +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_minus_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_lte"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_lte_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_lt"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_lt_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_l2"( + "lhs" svector, + "rhs" svector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_l2_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_gte"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_gte_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_gt"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_gt_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_eq"( + "lhs" svector, + "rhs" svector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_eq_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_dot"( + "lhs" svector, + "rhs" svector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_dot_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_cosine"( + "lhs" svector, + "rhs" svector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_cosine_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_operator_add"( + "lhs" svector, + "rhs" svector +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_operator_add_wrapper'; + +CREATE FUNCTION vectors."_vectors_svecf32_in"( + "input" cstring, + "_oid" oid, + "typmod" INT +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_svecf32_in_wrapper'; + +CREATE OR REPLACE FUNCTION vectors."_vectors_pgvectors_upgrade"() RETURNS void +STRICT VOLATILE PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; + +CREATE OR REPLACE FUNCTION vectors."_vectors_index_stat"( + "oid" oid +) RETURNS vectors.vector_index_stat /* pgrx::heap_tuple::PgHeapTuple */ +STRICT VOLATILE PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_index_stat_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_veci8_to_vecf32"( + "vector" veci8, + "_typmod" INT, + "_explicit" bool +) RETURNS vector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_veci8_to_vecf32_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_veci8"( + "vector" vector, + "_typmod" INT, + "_explicit" bool +) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_veci8_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_svecf32"( + "vector" vector, + "_typmod" INT, + "_explicit" bool +) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_svecf32_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_vecf32_to_bvecf32"( + "vector" vector, + "_typmod" INT, + "_explicit" bool +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_vecf32_to_bvecf32_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_vecf16_to_vecf32"( + "vector" vecf16, + "_typmod" INT, + "_explicit" bool +) RETURNS vector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_vecf16_to_vecf32_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_svecf32_to_vecf32"( + "vector" svector, + "_typmod" INT, + "_explicit" bool +) RETURNS vector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_svecf32_to_vecf32_wrapper'; + +CREATE FUNCTION vectors."_vectors_cast_bvecf32_to_vecf32"( + "vector" bvector, + "_typmod" INT, + "_explicit" bool +) RETURNS vector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_cast_bvecf32_to_vecf32_wrapper'; + +CREATE FUNCTION _vectors_bvecf32_subscript(internal) RETURNS internal +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_subscript_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_send"( + "vector" bvector +) RETURNS bytea +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_send_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_recv"( + "internal" internal, + "oid" oid, + "typmod" INT +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_recv_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_out"( + "vector" bvector +) RETURNS cstring +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_out_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_xor"( + "lhs" bvector, + "rhs" bvector +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_xor_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_or"( + "lhs" bvector, + "rhs" bvector +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_or_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_neq"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_neq_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_lte"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_lte_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_lt"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_lt_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_l2"( + "lhs" bvector, + "rhs" bvector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_l2_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_jaccard"( + "lhs" bvector, + "rhs" bvector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_jaccard_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_gte"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_gte_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_gt"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_gt_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_eq"( + "lhs" bvector, + "rhs" bvector +) RETURNS bool +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_eq_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_dot"( + "lhs" bvector, + "rhs" bvector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_dot_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_cosine"( + "lhs" bvector, + "rhs" bvector +) RETURNS real +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_cosine_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_operator_and"( + "lhs" bvector, + "rhs" bvector +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_operator_and_wrapper'; + +CREATE FUNCTION vectors."_vectors_bvecf32_in"( + "input" cstring, + "_oid" oid, + "typmod" INT +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_bvecf32_in_wrapper'; + +CREATE FUNCTION vectors."_vectors_binarize"( + "vector" vector +) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_binarize_wrapper'; + +-- List of data types + +ALTER TYPE vector SET ( + RECEIVE = _vectors_vecf32_recv, + SEND = _vectors_vecf32_send, + SUBSCRIPT = _vectors_vecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + STORAGE = EXTERNAL +); + +ALTER TYPE vecf16 SET ( + RECEIVE = _vectors_vecf16_recv, + SEND = _vectors_vecf16_send, + SUBSCRIPT = _vectors_vecf16_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + STORAGE = EXTERNAL +); + +CREATE TYPE svector ( + INPUT = _vectors_svecf32_in, + OUTPUT = _vectors_svecf32_out, + RECEIVE = _vectors_svecf32_recv, + SEND = _vectors_svecf32_send, + SUBSCRIPT = _vectors_svecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_1048575, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE bvector ( + INPUT = _vectors_bvecf32_in, + OUTPUT = _vectors_bvecf32_out, + RECEIVE = _vectors_bvecf32_recv, + SEND = _vectors_bvecf32_send, + SUBSCRIPT = _vectors_bvecf32_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +CREATE TYPE veci8 ( + INPUT = _vectors_veci8_in, + OUTPUT = _vectors_veci8_out, + RECEIVE = _vectors_veci8_recv, + SEND = _vectors_veci8_send, + SUBSCRIPT = _vectors_veci8_subscript, + TYPMOD_IN = _vectors_typmod_in_65535, + TYPMOD_OUT = _vectors_typmod_out, + STORAGE = EXTERNAL, + INTERNALLENGTH = VARIABLE, + ALIGNMENT = double +); + +-- List of operators + +CREATE OPERATOR + ( + PROCEDURE = _vectors_svecf32_operator_add, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = + +); + +CREATE OPERATOR + ( + PROCEDURE = _vectors_veci8_operator_add, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = + +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_svecf32_operator_minus, + LEFTARG = svector, + RIGHTARG = svector +); + +CREATE OPERATOR - ( + PROCEDURE = _vectors_veci8_operator_minus, + LEFTARG = veci8, + RIGHTARG = veci8 +); + +CREATE OPERATOR & ( + PROCEDURE = _vectors_bvecf32_operator_and, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR | ( + PROCEDURE = _vectors_bvecf32_operator_or, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR ^ ( + PROCEDURE = _vectors_bvecf32_operator_xor, + LEFTARG = bvector, + RIGHTARG = bvector +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_svecf32_operator_eq, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_bvecf32_operator_eq, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR = ( + PROCEDURE = _vectors_veci8_operator_eq, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_svecf32_operator_neq, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_bvecf32_operator_neq, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR <> ( + PROCEDURE = _vectors_veci8_operator_neq, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = eqsel, + JOIN = eqjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_svecf32_operator_lt, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_bvecf32_operator_lt, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR < ( + PROCEDURE = _vectors_veci8_operator_lt, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_svecf32_operator_gt, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_bvecf32_operator_gt, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR > ( + PROCEDURE = _vectors_veci8_operator_gt, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_svecf32_operator_lte, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_bvecf32_operator_lte, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR <= ( + PROCEDURE = _vectors_veci8_operator_lte, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_svecf32_operator_gte, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_bvecf32_operator_gte, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR >= ( + PROCEDURE = _vectors_veci8_operator_gte, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_svecf32_operator_l2, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_bvecf32_operator_l2, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <-> +); + +CREATE OPERATOR <-> ( + PROCEDURE = _vectors_veci8_operator_l2, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <-> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_svecf32_operator_dot, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_bvecf32_operator_dot, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <#> +); + +CREATE OPERATOR <#> ( + PROCEDURE = _vectors_veci8_operator_dot, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <#> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_svecf32_operator_cosine, + LEFTARG = svector, + RIGHTARG = svector, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_bvecf32_operator_cosine, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <=> +); + +CREATE OPERATOR <=> ( + PROCEDURE = _vectors_veci8_operator_cosine, + LEFTARG = veci8, + RIGHTARG = veci8, + COMMUTATOR = <=> +); + +CREATE OPERATOR <~> ( + PROCEDURE = _vectors_bvecf32_operator_jaccard, + LEFTARG = bvector, + RIGHTARG = bvector, + COMMUTATOR = <~> +); + +-- List of functions + +CREATE OR REPLACE FUNCTION pgvectors_upgrade() RETURNS void +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; + +CREATE FUNCTION to_svector("dims" INT, "indexes" INT[], "values" real[]) RETURNS svector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_svector_wrapper'; + +CREATE FUNCTION to_veci8("len" INT, "alpha" real, "offset" real, "values" INT[]) RETURNS veci8 +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_veci8_wrapper'; + +CREATE FUNCTION binarize("vector" vector) RETURNS bvector +IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_binarize_wrapper'; + +CREATE FUNCTION text2vec_openai("input" TEXT, "model" TEXT) RETURNS vector +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; + +CREATE FUNCTION text2vec_openai_v3(input TEXT) RETURNS vector +STRICT PARALLEL SAFE LANGUAGE plpgsql AS +$$ +DECLARE +variable vectors.vector; +BEGIN + variable := vectors.text2vec_openai(input, 'text-embedding-3-small'); + RETURN variable; +END; +$$; + +-- List of casts + +CREATE CAST (vecf16 AS vector) + WITH FUNCTION _vectors_cast_vecf16_to_vecf32(vecf16, integer, boolean); + +CREATE CAST (vector AS svector) + WITH FUNCTION _vectors_cast_vecf32_to_svecf32(vector, integer, boolean); + +CREATE CAST (svector AS vector) + WITH FUNCTION _vectors_cast_svecf32_to_vecf32(svector, integer, boolean); + +CREATE CAST (vector AS bvector) + WITH FUNCTION _vectors_cast_vecf32_to_bvecf32(vector, integer, boolean); + +CREATE CAST (bvector AS vector) + WITH FUNCTION _vectors_cast_bvecf32_to_vecf32(bvector, integer, boolean); + +CREATE CAST (veci8 AS vector) + WITH FUNCTION _vectors_cast_veci8_to_vecf32(veci8, integer, boolean); + +CREATE CAST (vector AS veci8) + WITH FUNCTION _vectors_cast_vecf32_to_veci8(vector, integer, boolean); + +-- List of operator families + +CREATE OPERATOR FAMILY svector_l2_ops USING vectors; + +CREATE OPERATOR FAMILY svector_dot_ops USING vectors; + +CREATE OPERATOR FAMILY svector_cos_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_l2_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_dot_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_cos_ops USING vectors; + +CREATE OPERATOR FAMILY bvector_jaccard_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_l2_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_dot_ops USING vectors; + +CREATE OPERATOR FAMILY veci8_cos_ops USING vectors; + +-- List of operator classes + +CREATE OPERATOR CLASS svector_l2_ops + FOR TYPE svector USING vectors FAMILY svector_l2_ops AS + OPERATOR 1 <-> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS svector_dot_ops + FOR TYPE svector USING vectors FAMILY svector_dot_ops AS + OPERATOR 1 <#> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS svector_cos_ops + FOR TYPE svector USING vectors FAMILY svector_cos_ops AS + OPERATOR 1 <=> (svector, svector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_l2_ops + FOR TYPE bvector USING vectors FAMILY bvector_l2_ops AS + OPERATOR 1 <-> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_dot_ops + FOR TYPE bvector USING vectors FAMILY bvector_dot_ops AS + OPERATOR 1 <#> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_cos_ops + FOR TYPE bvector USING vectors FAMILY bvector_cos_ops AS + OPERATOR 1 <=> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS bvector_jaccard_ops + FOR TYPE bvector USING vectors FAMILY bvector_jaccard_ops AS + OPERATOR 1 <~> (bvector, bvector) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_l2_ops + FOR TYPE veci8 USING vectors FAMILY veci8_l2_ops AS + OPERATOR 1 <-> (veci8, veci8) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_dot_ops + FOR TYPE veci8 USING vectors FAMILY veci8_dot_ops AS + OPERATOR 1 <#> (veci8, veci8) FOR ORDER BY float_ops; + +CREATE OPERATOR CLASS veci8_cos_ops + FOR TYPE veci8 USING vectors FAMILY veci8_cos_ops AS + OPERATOR 1 <=> (veci8, veci8) FOR ORDER BY float_ops; + +-- List of views + +CREATE OR REPLACE VIEW pg_vector_index_stat AS + SELECT + C.oid AS tablerelid, + I.oid AS indexrelid, + C.relname AS tablename, + I.relname AS indexname, + (_vectors_index_stat(I.oid)).* + FROM pg_class C JOIN + pg_index X ON C.oid = X.indrelid JOIN + pg_class I ON I.oid = X.indexrelid JOIN + pg_am A ON A.oid = I.relam + WHERE A.amname = 'vectors'; + +GRANT SELECT ON TABLE pg_vector_index_stat TO PUBLIC; + +-- Cleanup + +DROP FUNCTION _vectors_ai_embedding_vector; +DROP FUNCTION _vectors_typmod_in; diff --git a/src/datatype/binary_bvecf32.rs b/src/datatype/binary_bvecf32.rs index 71902d54b..ef11d2786 100644 --- a/src/datatype/binary_bvecf32.rs +++ b/src/datatype/binary_bvecf32.rs @@ -7,7 +7,7 @@ use pgrx::datum::Internal; use pgrx::datum::IntoDatum; use pgrx::pg_sys::Oid; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_send(vector: BVecf32Input<'_>) -> Bytea { use pgrx::pg_sys::StringInfoData; unsafe { @@ -21,8 +21,9 @@ fn _vectors_bvecf32_send(vector: BVecf32Input<'_>) -> Bytea { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] -fn _vectors_bvecf32_recv(internal: Internal, _oid: Oid, _typmod: i32) -> BVecf32Output { +#[pgrx::pg_extern(immutable, strict, parallel_safe)] +fn _vectors_bvecf32_recv(internal: Internal, oid: Oid, typmod: i32) -> BVecf32Output { + let _ = (oid, typmod); use pgrx::pg_sys::StringInfo; unsafe { let buf: StringInfo = internal.into_datum().unwrap().cast_mut_ptr(); diff --git a/src/datatype/binary_svecf32.rs b/src/datatype/binary_svecf32.rs index 7f2936516..a7c2cbec0 100644 --- a/src/datatype/binary_svecf32.rs +++ b/src/datatype/binary_svecf32.rs @@ -8,7 +8,7 @@ use pgrx::datum::IntoDatum; use pgrx::pg_sys::Oid; use std::ffi::c_char; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_send(vector: SVecf32Input<'_>) -> Bytea { use pgrx::pg_sys::StringInfoData; unsafe { @@ -27,8 +27,9 @@ fn _vectors_svecf32_send(vector: SVecf32Input<'_>) -> Bytea { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] -fn _vectors_svecf32_recv(internal: Internal, _oid: Oid, _typmod: i32) -> SVecf32Output { +#[pgrx::pg_extern(immutable, strict, parallel_safe)] +fn _vectors_svecf32_recv(internal: Internal, oid: Oid, typmod: i32) -> SVecf32Output { + let _ = (oid, typmod); use pgrx::pg_sys::StringInfo; unsafe { let buf: StringInfo = internal.into_datum().unwrap().cast_mut_ptr(); diff --git a/src/datatype/binary_vecf16.rs b/src/datatype/binary_vecf16.rs index 45d044d27..7a75567e8 100644 --- a/src/datatype/binary_vecf16.rs +++ b/src/datatype/binary_vecf16.rs @@ -7,7 +7,7 @@ use pgrx::datum::IntoDatum; use pgrx::pg_sys::Oid; use std::ffi::c_char; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_send(vector: Vecf16Input<'_>) -> Bytea { use pgrx::pg_sys::StringInfoData; unsafe { @@ -21,8 +21,9 @@ fn _vectors_vecf16_send(vector: Vecf16Input<'_>) -> Bytea { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] -fn _vectors_vecf16_recv(internal: Internal, _oid: Oid, _typmod: i32) -> Vecf16Output { +#[pgrx::pg_extern(immutable, strict, parallel_safe)] +fn _vectors_vecf16_recv(internal: Internal, oid: Oid, typmod: i32) -> Vecf16Output { + let _ = (oid, typmod); use pgrx::pg_sys::StringInfo; unsafe { let buf: StringInfo = internal.into_datum().unwrap().cast_mut_ptr(); diff --git a/src/datatype/binary_vecf32.rs b/src/datatype/binary_vecf32.rs index 8955d7951..150201442 100644 --- a/src/datatype/binary_vecf32.rs +++ b/src/datatype/binary_vecf32.rs @@ -7,7 +7,7 @@ use pgrx::datum::IntoDatum; use pgrx::pg_sys::Oid; use std::ffi::c_char; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_send(vector: Vecf32Input<'_>) -> Bytea { use pgrx::pg_sys::StringInfoData; unsafe { @@ -21,8 +21,9 @@ fn _vectors_vecf32_send(vector: Vecf32Input<'_>) -> Bytea { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] -fn _vectors_vecf32_recv(internal: Internal, _oid: Oid, _typmod: i32) -> Vecf32Output { +#[pgrx::pg_extern(immutable, strict, parallel_safe)] +fn _vectors_vecf32_recv(internal: Internal, oid: Oid, typmod: i32) -> Vecf32Output { + let _ = (oid, typmod); use pgrx::pg_sys::StringInfo; unsafe { let buf: StringInfo = internal.into_datum().unwrap().cast_mut_ptr(); diff --git a/src/datatype/binary_veci8.rs b/src/datatype/binary_veci8.rs index 888fcf261..33f0ad98b 100644 --- a/src/datatype/binary_veci8.rs +++ b/src/datatype/binary_veci8.rs @@ -7,7 +7,7 @@ use pgrx::datum::IntoDatum; use pgrx::pg_sys::Oid; use std::ffi::c_char; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_send(vector: Veci8Input<'_>) -> Bytea { use pgrx::pg_sys::StringInfoData; unsafe { @@ -29,8 +29,9 @@ fn _vectors_veci8_send(vector: Veci8Input<'_>) -> Bytea { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] -fn _vectors_veci8_recv(internal: Internal, _oid: Oid, _typmod: i32) -> Veci8Output { +#[pgrx::pg_extern(immutable, strict, parallel_safe)] +fn _vectors_veci8_recv(internal: Internal, oid: Oid, typmod: i32) -> Veci8Output { + let _ = (oid, typmod); use pgrx::pg_sys::StringInfo; unsafe { let buf: StringInfo = internal.into_datum().unwrap().cast_mut_ptr(); diff --git a/src/datatype/casts.rs b/src/datatype/casts.rs index d2e3216c8..63e22418b 100644 --- a/src/datatype/casts.rs +++ b/src/datatype/casts.rs @@ -8,12 +8,13 @@ use base::scalar::*; use base::vector::*; use num_traits::Zero; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_array_to_vecf32( array: pgrx::Array, - _typmod: i32, + typmod: i32, _explicit: bool, ) -> Vecf32Output { + let _ = typmod; check_value_dims_65535(array.len()); let mut slice = vec![F32::zero(); array.len()]; for (i, x) in array.iter().enumerate() { @@ -22,7 +23,7 @@ fn _vectors_cast_array_to_vecf32( Vecf32Output::new(Vecf32Borrowed::new(&slice)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf32_to_array( vector: Vecf32Input<'_>, _typmod: i32, @@ -31,29 +32,27 @@ fn _vectors_cast_vecf32_to_array( vector.slice().iter().map(|x| x.to_f32()).collect() } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf32_to_vecf16( vector: Vecf32Input<'_>, _typmod: i32, _explicit: bool, ) -> Vecf16Output { let slice: Vec = vector.slice().iter().map(|&x| F16::from_f(x)).collect(); - Vecf16Output::new(Vecf16Borrowed::new(&slice)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf16_to_vecf32( vector: Vecf16Input<'_>, _typmod: i32, _explicit: bool, ) -> Vecf32Output { let slice: Vec = vector.slice().iter().map(|&x| x.to_f()).collect(); - Vecf32Output::new(Vecf32Borrowed::new(&slice)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf32_to_svecf32( vector: Vecf32Input<'_>, _typmod: i32, @@ -78,18 +77,17 @@ fn _vectors_cast_vecf32_to_svecf32( )) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_svecf32_to_vecf32( vector: SVecf32Input<'_>, _typmod: i32, _explicit: bool, ) -> Vecf32Output { let slice = vector.for_borrow().to_vec(); - Vecf32Output::new(Vecf32Borrowed::new(&slice)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf32_to_bvecf32( vector: Vecf32Input<'_>, _typmod: i32, @@ -103,11 +101,10 @@ fn _vectors_cast_vecf32_to_bvecf32( _ => bad_literal("The vector contains a non-binary value."), } } - BVecf32Output::new(values.for_borrow()) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_bvecf32_to_vecf32( vector: BVecf32Input<'_>, _typmod: i32, @@ -121,7 +118,7 @@ fn _vectors_cast_bvecf32_to_vecf32( Vecf32Output::new(Vecf32Borrowed::new(&data)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_veci8_to_vecf32( vector: Veci8Input<'_>, _typmod: i32, @@ -133,7 +130,7 @@ fn _vectors_cast_veci8_to_vecf32( Vecf32Output::new(Vecf32Borrowed::new(&data)) } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_cast_vecf32_to_veci8( vector: Vecf32Input<'_>, _typmod: i32, diff --git a/src/datatype/functions_bvecf32.rs b/src/datatype/functions_bvecf32.rs index fa4cdd4a9..9ada4185d 100644 --- a/src/datatype/functions_bvecf32.rs +++ b/src/datatype/functions_bvecf32.rs @@ -3,7 +3,7 @@ use super::memory_vecf32::Vecf32Input; use base::scalar::*; use base::vector::*; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_binarize(vector: Vecf32Input<'_>) -> BVecf32Output { let mut values = BVecf32Owned::new_zeroed(vector.len() as u16); for (i, &F32(x)) in vector.slice().iter().enumerate() { @@ -11,6 +11,5 @@ fn _vectors_binarize(vector: Vecf32Input<'_>) -> BVecf32Output { values.set(i, true); } } - BVecf32Output::new(values.for_borrow()) } diff --git a/src/datatype/functions_svecf32.rs b/src/datatype/functions_svecf32.rs index 6cbe6405b..3dda59430 100644 --- a/src/datatype/functions_svecf32.rs +++ b/src/datatype/functions_svecf32.rs @@ -3,7 +3,7 @@ use crate::error::*; use base::scalar::*; use base::vector::*; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_to_svector( dims: i32, index: pgrx::Array, diff --git a/src/datatype/functions_veci8.rs b/src/datatype/functions_veci8.rs index 17191bb8d..422021d01 100644 --- a/src/datatype/functions_veci8.rs +++ b/src/datatype/functions_veci8.rs @@ -3,7 +3,7 @@ use crate::error::*; use base::scalar::*; use base::vector::*; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_to_veci8(len: i32, alpha: f32, offset: f32, values: pgrx::Array) -> Veci8Output { check_value_dims_65535(len as usize); if (len as usize) != values.len() { diff --git a/src/datatype/operators_bvecf32.rs b/src/datatype/operators_bvecf32.rs index 9d7964267..7681eac06 100644 --- a/src/datatype/operators_bvecf32.rs +++ b/src/datatype/operators_bvecf32.rs @@ -5,7 +5,7 @@ use base::scalar::*; use base::vector::*; use std::ops::Deref; -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_and(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> BVecf32Output { let n = check_matched_dims(lhs.dims() as _, rhs.dims() as _); let mut results = BVecf32Owned::new_zeroed(n.try_into().unwrap()); @@ -16,7 +16,7 @@ fn _vectors_bvecf32_operator_and(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) - BVecf32Output::new(results.for_borrow()) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_or(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> BVecf32Output { check_matched_dims(lhs.dims() as _, rhs.dims() as _); let mut results = BVecf32Owned::new_zeroed(lhs.dims().try_into().unwrap()); @@ -27,7 +27,7 @@ fn _vectors_bvecf32_operator_or(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> BVecf32Output::new(results.for_borrow()) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_xor(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> BVecf32Output { check_matched_dims(lhs.dims() as _, rhs.dims() as _); let mut results = BVecf32Owned::new_zeroed(lhs.dims().try_into().unwrap()); @@ -38,61 +38,61 @@ fn _vectors_bvecf32_operator_xor(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) - BVecf32Output::new(results.for_borrow()) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_lt(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() < rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_lte(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() <= rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_gt(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() > rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_gte(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() >= rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_eq(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() == rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_neq(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() != rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_cosine(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); BVecf32Cos::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_dot(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); BVecf32Dot::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_l2(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); BVecf32L2::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_operator_jaccard(lhs: BVecf32Input<'_>, rhs: BVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); BVecf32Jaccard::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() diff --git a/src/datatype/operators_svecf32.rs b/src/datatype/operators_svecf32.rs index 8abe02817..413cd71dd 100644 --- a/src/datatype/operators_svecf32.rs +++ b/src/datatype/operators_svecf32.rs @@ -6,7 +6,7 @@ use base::vector::*; use num_traits::Zero; use std::ops::Deref; -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_add(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> SVecf32Output { check_matched_dims(lhs.dims() as _, rhs.dims() as _); @@ -47,7 +47,7 @@ fn _vectors_svecf32_operator_add(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) - SVecf32Output::new(SVecf32Borrowed::new(lhs.dims(), &indexes, &values)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_minus(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> SVecf32Output { check_matched_dims(lhs.dims() as _, rhs.dims() as _); @@ -88,55 +88,55 @@ fn _vectors_svecf32_operator_minus(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) SVecf32Output::new(SVecf32Borrowed::new(lhs.dims(), &indexes, &values)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_lt(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); compare(lhs, rhs).is_lt() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_lte(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); compare(lhs, rhs).is_le() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_gt(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); compare(lhs, rhs).is_gt() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_gte(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); compare(lhs, rhs).is_ge() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_eq(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() == rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_neq(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> bool { check_matched_dims(lhs.dims() as _, rhs.dims() as _); lhs.deref().for_borrow() != rhs.deref().for_borrow() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_cosine(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); SVecf32Cos::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_dot(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); SVecf32Dot::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_operator_l2(lhs: SVecf32Input<'_>, rhs: SVecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims() as _, rhs.dims() as _); SVecf32L2::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() diff --git a/src/datatype/operators_vecf16.rs b/src/datatype/operators_vecf16.rs index 5f4210449..d2ea2d8c2 100644 --- a/src/datatype/operators_vecf16.rs +++ b/src/datatype/operators_vecf16.rs @@ -6,7 +6,7 @@ use base::vector::*; use num_traits::Zero; use std::ops::Deref; -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_add(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> Vecf16Output { let n = check_matched_dims(lhs.dims(), rhs.dims()); let mut v = vec![F16::zero(); n]; @@ -16,7 +16,7 @@ fn _vectors_vecf16_operator_add(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> V Vecf16Output::new(Vecf16Borrowed::new(&v)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_minus(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> Vecf16Output { let n = check_matched_dims(lhs.dims(), rhs.dims()); let mut v = vec![F16::zero(); n]; @@ -26,55 +26,55 @@ fn _vectors_vecf16_operator_minus(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> Vecf16Output::new(Vecf16Borrowed::new(&v)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_lt(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() < rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_lte(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() <= rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_gt(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() > rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_gte(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() >= rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_eq(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() == rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_neq(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() != rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_cosine(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf16Cos::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_dot(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf16Dot::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_operator_l2(lhs: Vecf16Input<'_>, rhs: Vecf16Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf16L2::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() diff --git a/src/datatype/operators_vecf32.rs b/src/datatype/operators_vecf32.rs index ba469340c..136616366 100644 --- a/src/datatype/operators_vecf32.rs +++ b/src/datatype/operators_vecf32.rs @@ -6,7 +6,7 @@ use base::vector::*; use num_traits::Zero; use std::ops::Deref; -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_add(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> Vecf32Output { let n = check_matched_dims(lhs.dims(), rhs.dims()); let mut v = vec![F32::zero(); n]; @@ -16,7 +16,7 @@ fn _vectors_vecf32_operator_add(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> V Vecf32Output::new(Vecf32Borrowed::new(&v)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_minus(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> Vecf32Output { let n = check_matched_dims(lhs.dims(), rhs.dims()); let mut v = vec![F32::zero(); n]; @@ -26,55 +26,55 @@ fn _vectors_vecf32_operator_minus(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> Vecf32Output::new(Vecf32Borrowed::new(&v)) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_lt(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() < rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_lte(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() <= rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_gt(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() > rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_gte(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() >= rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_eq(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() == rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_neq(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> bool { check_matched_dims(lhs.dims(), rhs.dims()); lhs.deref().slice() != rhs.deref().slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_cosine(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf32Cos::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_dot(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf32Dot::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_operator_l2(lhs: Vecf32Input<'_>, rhs: Vecf32Input<'_>) -> f32 { check_matched_dims(lhs.dims(), rhs.dims()); Vecf32L2::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() diff --git a/src/datatype/operators_veci8.rs b/src/datatype/operators_veci8.rs index 9cc35fd3e..46c894649 100644 --- a/src/datatype/operators_veci8.rs +++ b/src/datatype/operators_veci8.rs @@ -5,7 +5,7 @@ use base::scalar::*; use base::vector::*; use std::ops::Deref; -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_add(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> Veci8Output { check_matched_dims(lhs.len(), rhs.len()); let data = (0..lhs.len()) @@ -18,7 +18,7 @@ fn _vectors_veci8_operator_add(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> Veci ) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_minus(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> Veci8Output { check_matched_dims(lhs.len(), rhs.len()); let data = (0..lhs.len()) @@ -31,55 +31,55 @@ fn _vectors_veci8_operator_minus(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> Ve ) } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_lt(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() < rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_lte(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() <= rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_gt(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() > rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_gte(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() >= rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_eq(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() == rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_neq(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> bool { check_matched_dims(lhs.len(), rhs.len()); lhs.deref().dequantization().as_slice() != rhs.deref().dequantization().as_slice() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_cosine(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> f32 { check_matched_dims(lhs.len(), rhs.len()); Veci8Cos::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_dot(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> f32 { check_matched_dims(lhs.len(), rhs.len()); Veci8Dot::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() } -#[pgrx::pg_extern(immutable, parallel_safe)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_operator_l2(lhs: Veci8Input<'_>, rhs: Veci8Input<'_>) -> f32 { check_matched_dims(lhs.len(), rhs.len()); Veci8L2::distance(lhs.for_borrow(), rhs.for_borrow()).to_f32() diff --git a/src/datatype/text_bvecf32.rs b/src/datatype/text_bvecf32.rs index 73510f443..7c0724100 100644 --- a/src/datatype/text_bvecf32.rs +++ b/src/datatype/text_bvecf32.rs @@ -6,7 +6,7 @@ use pgrx::pg_sys::Oid; use std::ffi::{CStr, CString}; use std::fmt::Write; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> BVecf32Output { use crate::utils::parse::parse_vector; let reserve = Typmod::parse_from_i32(typmod) @@ -38,7 +38,7 @@ fn _vectors_bvecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> BVecf32Output { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_bvecf32_out(vector: BVecf32Input<'_>) -> CString { let mut buffer = String::new(); buffer.push('['); diff --git a/src/datatype/text_svecf32.rs b/src/datatype/text_svecf32.rs index f3ae33056..f2a0d6bb4 100644 --- a/src/datatype/text_svecf32.rs +++ b/src/datatype/text_svecf32.rs @@ -8,7 +8,7 @@ use num_traits::Zero; use pgrx::pg_sys::Oid; use std::ffi::{CStr, CString}; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> SVecf32Output { use crate::utils::parse::parse_vector; let reserve = Typmod::parse_from_i32(typmod) @@ -38,7 +38,7 @@ fn _vectors_svecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> SVecf32Output { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_svecf32_out(vector: SVecf32Input<'_>) -> CString { let mut buffer = String::new(); buffer.push('['); diff --git a/src/datatype/text_vecf16.rs b/src/datatype/text_vecf16.rs index ac3b4c100..60852ce16 100644 --- a/src/datatype/text_vecf16.rs +++ b/src/datatype/text_vecf16.rs @@ -6,7 +6,7 @@ use base::vector::*; use pgrx::pg_sys::Oid; use std::ffi::{CStr, CString}; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf16Output { use crate::utils::parse::parse_vector; let reserve = Typmod::parse_from_i32(typmod) @@ -26,7 +26,7 @@ fn _vectors_vecf16_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf16Output { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf16_out(vector: Vecf16Input<'_>) -> CString { let mut buffer = String::new(); buffer.push('['); diff --git a/src/datatype/text_vecf32.rs b/src/datatype/text_vecf32.rs index 297f80e33..d6b3b7922 100644 --- a/src/datatype/text_vecf32.rs +++ b/src/datatype/text_vecf32.rs @@ -6,7 +6,7 @@ use base::vector::*; use pgrx::pg_sys::Oid; use std::ffi::{CStr, CString}; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf32Output { use crate::utils::parse::parse_vector; let reserve = Typmod::parse_from_i32(typmod) @@ -26,7 +26,7 @@ fn _vectors_vecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf32Output { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_vecf32_out(vector: Vecf32Input<'_>) -> CString { let mut buffer = String::new(); buffer.push('['); diff --git a/src/datatype/text_veci8.rs b/src/datatype/text_veci8.rs index e5c44f070..a537ef2e2 100644 --- a/src/datatype/text_veci8.rs +++ b/src/datatype/text_veci8.rs @@ -5,7 +5,7 @@ use base::vector::*; use pgrx::pg_sys::Oid; use std::ffi::{CStr, CString}; -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_in(input: &CStr, _oid: Oid, typmod: i32) -> Veci8Output { use crate::utils::parse::parse_vector; let reserve = Typmod::parse_from_i32(typmod) @@ -37,7 +37,7 @@ fn _vectors_veci8_in(input: &CStr, _oid: Oid, typmod: i32) -> Veci8Output { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_veci8_out(vector: Veci8Input<'_>) -> CString { let vector = veci8::i8_dequantization(vector.data(), vector.alpha(), vector.offset()); let mut buffer = String::new(); diff --git a/src/datatype/typmod.rs b/src/datatype/typmod.rs index f75ce6f02..db3a8be99 100644 --- a/src/datatype/typmod.rs +++ b/src/datatype/typmod.rs @@ -44,7 +44,7 @@ impl Typmod { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_typmod_in_65535(list: Array<&CStr>) -> i32 { if list.is_empty() { -1 @@ -58,7 +58,7 @@ fn _vectors_typmod_in_65535(list: Array<&CStr>) -> i32 { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_typmod_in_1048575(list: Array<&CStr>) -> i32 { if list.is_empty() { -1 @@ -72,7 +72,7 @@ fn _vectors_typmod_in_1048575(list: Array<&CStr>) -> i32 { } } -#[pgrx::pg_extern(immutable, parallel_safe, strict)] +#[pgrx::pg_extern(immutable, strict, parallel_safe)] fn _vectors_typmod_out(typmod: i32) -> CString { let typmod = Typmod::parse_from_i32(typmod).unwrap(); match typmod.into_option_string() { diff --git a/src/embedding/mod.rs b/src/embedding/mod.rs index b88b366d1..28491b41b 100644 --- a/src/embedding/mod.rs +++ b/src/embedding/mod.rs @@ -5,7 +5,7 @@ use base::vector::*; use embedding::openai_embedding; use pgrx::error; -#[pgrx::pg_extern(volatile, strict)] +#[pgrx::pg_extern(volatile, strict, parallel_safe)] fn _vectors_text2vec_openai(input: String, model: String) -> Vecf32Output { let options = openai_options(); let resp = match openai_embedding(input, model, options) { diff --git a/src/index/functions.rs b/src/index/functions.rs index bc88556b2..701fa1b89 100644 --- a/src/index/functions.rs +++ b/src/index/functions.rs @@ -1,4 +1,4 @@ -#[pgrx::pg_extern(volatile, strict)] +#[pgrx::pg_extern(volatile, strict, parallel_safe)] fn _vectors_pgvectors_upgrade() { let _ = std::fs::remove_dir_all("pg_vectors"); } diff --git a/src/index/views.rs b/src/index/views.rs index 98dab9c9d..63495ef25 100644 --- a/src/index/views.rs +++ b/src/index/views.rs @@ -2,7 +2,7 @@ use crate::error::*; use crate::index::utils::get_handle; use base::index::*; -#[pgrx::pg_extern(volatile, strict)] +#[pgrx::pg_extern(volatile, strict, parallel_safe)] fn _vectors_index_stat( oid: pgrx::pg_sys::Oid, ) -> pgrx::composite_type!('static, "vectors.vector_index_stat") { diff --git a/src/lib.rs b/src/lib.rs index d753d5514..5d4112703 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,6 +13,7 @@ mod error; mod gucs; mod index; mod ipc; +mod upgrade; mod utils; pgrx::pg_module_magic!(); diff --git a/src/sql/bootstrap.sql b/src/sql/bootstrap.sql index 7f2a8c524..7f9620bec 100644 --- a/src/sql/bootstrap.sql +++ b/src/sql/bootstrap.sql @@ -5,6 +5,7 @@ CREATE TYPE vector; CREATE TYPE vecf16; CREATE TYPE svector; +CREATE TYPE bvector; CREATE TYPE veci8; CREATE TYPE vector_index_stat; diff --git a/src/sql/finalize.sql b/src/sql/finalize.sql index 84da3b931..3dc8e9c63 100644 --- a/src/sql/finalize.sql +++ b/src/sql/finalize.sql @@ -565,9 +565,9 @@ CREATE OPERATOR <~> ( -- List of functions CREATE FUNCTION pgvectors_upgrade() RETURNS void -STRICT LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_pgvectors_upgrade_wrapper'; -CREATE FUNCTION to_svector(dims INT, indexes INT[], "values" real[]) RETURNS svector +CREATE FUNCTION to_svector("dims" INT, "indexes" INT[], "values" real[]) RETURNS svector IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_svector_wrapper'; CREATE FUNCTION to_veci8("len" INT, "alpha" real, "offset" real, "values" INT[]) RETURNS veci8 @@ -576,11 +576,11 @@ IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_to_vec CREATE FUNCTION binarize("vector" vector) RETURNS bvector IMMUTABLE STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_binarize_wrapper'; -CREATE FUNCTION text2vec_openai(input TEXT, model TEXT) RETURNS vector -STRICT LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; +CREATE FUNCTION text2vec_openai("input" TEXT, "model" TEXT) RETURNS vector +STRICT PARALLEL SAFE LANGUAGE c AS 'MODULE_PATHNAME', '_vectors_text2vec_openai_wrapper'; CREATE FUNCTION text2vec_openai_v3(input TEXT) RETURNS vector -STRICT LANGUAGE plpgsql AS +STRICT PARALLEL SAFE LANGUAGE plpgsql AS $$ DECLARE variable vectors.vector; diff --git a/src/upgrade/mod.rs b/src/upgrade/mod.rs new file mode 100644 index 000000000..6eb441dbe --- /dev/null +++ b/src/upgrade/mod.rs @@ -0,0 +1 @@ +mod symbols; diff --git a/src/upgrade/symbols.rs b/src/upgrade/symbols.rs new file mode 100644 index 000000000..1a6a05fb1 --- /dev/null +++ b/src/upgrade/symbols.rs @@ -0,0 +1,33 @@ +// Referenced symbols must exist in the dynamic library when dropping functions. +// So we should never remove symbols used by schema, otherwise there will be errors in upgrade. +// Reference: +// * https://www.postgresql.org/message-id/CACX+KaPOzzRHEt4w_=iqKbTpMKjyrUGVng1C749yP3r6dprtcg@mail.gmail.com +// * https://github.com/tensorchord/pgvecto.rs/issues/397 + +macro_rules! symbol { + ($t:ident) => { + paste::paste! { + #[no_mangle] + #[doc(hidden)] + #[pgrx::pg_guard] + extern "C" fn [<$t _wrapper>](_fcinfo: pgrx::pg_sys::FunctionCallInfo) -> pgrx::pg_sys::Datum { + pgrx::error!( + "the symbol {} is removed in the extension; please run extension update scripts", + stringify!($t), + ); + } + #[no_mangle] + #[doc(hidden)] + pub extern "C" fn []() -> &'static ::pgrx::pg_sys::Pg_finfo_record { + const V1_API: ::pgrx::pg_sys::Pg_finfo_record = ::pgrx::pg_sys::Pg_finfo_record { + api_version: 1, + }; + &V1_API + } + } + }; +} + +// 0.2.1--0.3.0 +symbol!(_vectors_ai_embedding_vector); +symbol!(_vectors_typmod_in);