-- pg_turbovec upgrade 2.16.4 -> 2.17.0 -- Run automatically by `ALTER EXTENSION pg_turbovec UPDATE TO '2.17.0';`. -- -- MINOR: filter column. A turbovec index may name one plain column after the -- vector column (CREATE INDEX ... USING turbovec (emb vec_cosine_ops, col)); a -- query's `col = v` then narrows the vector search to the rows a btree on col -- returns (src/index/filter.rs). This script adds the filter-column operator -- classes (the integer ones in one family with cross-type `=`) and -- turbovec.last_filter_mode(). No wire-format change (v8); existing -- single-column indexes are untouched and need no REINDEX. CREATE OPERATOR FAMILY filter_integer_ops USING turbovec; CREATE OPERATOR CLASS filter_int2_ops DEFAULT FOR TYPE int2 USING turbovec FAMILY filter_integer_ops AS OPERATOR 1 = (int2, int2), FUNCTION 1 btint2cmp(int2, int2); CREATE OPERATOR CLASS filter_int4_ops DEFAULT FOR TYPE int4 USING turbovec FAMILY filter_integer_ops AS OPERATOR 1 = (int4, int4), FUNCTION 1 btint4cmp(int4, int4); CREATE OPERATOR CLASS filter_int8_ops DEFAULT FOR TYPE int8 USING turbovec FAMILY filter_integer_ops AS OPERATOR 1 = (int8, int8), FUNCTION 1 btint8cmp(int8, int8); ALTER OPERATOR FAMILY filter_integer_ops USING turbovec ADD OPERATOR 1 = (int2, int4), OPERATOR 1 = (int2, int8), OPERATOR 1 = (int4, int2), OPERATOR 1 = (int4, int8), OPERATOR 1 = (int8, int2), OPERATOR 1 = (int8, int4); CREATE OPERATOR CLASS filter_text_ops DEFAULT FOR TYPE text USING turbovec AS OPERATOR 1 = (text, text), FUNCTION 1 bttextcmp(text, text); CREATE OPERATOR CLASS filter_uuid_ops DEFAULT FOR TYPE uuid USING turbovec AS OPERATOR 1 = (uuid, uuid), FUNCTION 1 uuid_cmp(uuid, uuid); CREATE OPERATOR CLASS filter_bool_ops DEFAULT FOR TYPE bool USING turbovec AS OPERATOR 1 = (bool, bool), FUNCTION 1 btboolcmp(bool, bool); CREATE OPERATOR CLASS filter_date_ops DEFAULT FOR TYPE date USING turbovec AS OPERATOR 1 = (date, date), FUNCTION 1 date_cmp(date, date); CREATE FUNCTION "last_filter_mode"() RETURNS TABLE ( "mode" TEXT, "matches" bigint, "probes" bigint ) STRICT VOLATILE PARALLEL RESTRICTED LANGUAGE c AS 'MODULE_PATHNAME', 'last_filter_mode_wrapper';