mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
87b8db3774
method to pass extra data to the consistent() and comparePartial() methods. This is the core infrastructure needed to support the soon-to-appear contrib/btree_gin module. The APIs are still upward compatible with the definitions used in 8.3 and before, although *not* with the previous 8.4devel function definitions. catversion bump for changes in pg_proc entries (although these are just cosmetic, since GIN doesn't actually look at the function signature before calling it...) Teodor Sigaev and Oleg Bartunov
133 lines
3.7 KiB
MySQL
133 lines
3.7 KiB
MySQL
/* $PostgreSQL: pgsql/contrib/pg_trgm/pg_trgm.sql.in,v 1.9 2009/03/25 22:19:01 tgl Exp $ */
|
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
SET search_path = public;
|
|
|
|
CREATE OR REPLACE FUNCTION set_limit(float4)
|
|
RETURNS float4
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT VOLATILE;
|
|
|
|
CREATE OR REPLACE FUNCTION show_limit()
|
|
RETURNS float4
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT STABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION show_trgm(text)
|
|
RETURNS _text
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION similarity(text,text)
|
|
RETURNS float4
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION similarity_op(text,text)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT STABLE;
|
|
|
|
CREATE OPERATOR % (
|
|
LEFTARG = text,
|
|
RIGHTARG = text,
|
|
PROCEDURE = similarity_op,
|
|
COMMUTATOR = '%',
|
|
RESTRICT = contsel,
|
|
JOIN = contjoinsel
|
|
);
|
|
|
|
-- gist key
|
|
CREATE OR REPLACE FUNCTION gtrgm_in(cstring)
|
|
RETURNS gtrgm
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_out(gtrgm)
|
|
RETURNS cstring
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT;
|
|
|
|
CREATE TYPE gtrgm (
|
|
INTERNALLENGTH = -1,
|
|
INPUT = gtrgm_in,
|
|
OUTPUT = gtrgm_out
|
|
);
|
|
|
|
-- support functions for gist
|
|
CREATE OR REPLACE FUNCTION gtrgm_consistent(internal,text,int,oid,internal)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_compress(internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_decompress(internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_penalty(internal,internal,internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C STRICT IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_picksplit(internal, internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_union(bytea, internal)
|
|
RETURNS _int4
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gtrgm_same(gtrgm, gtrgm, internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
-- create the operator class for gist
|
|
CREATE OPERATOR CLASS gist_trgm_ops
|
|
FOR TYPE text USING gist
|
|
AS
|
|
OPERATOR 1 % (text, text),
|
|
FUNCTION 1 gtrgm_consistent (internal, text, int, oid, internal),
|
|
FUNCTION 2 gtrgm_union (bytea, internal),
|
|
FUNCTION 3 gtrgm_compress (internal),
|
|
FUNCTION 4 gtrgm_decompress (internal),
|
|
FUNCTION 5 gtrgm_penalty (internal, internal, internal),
|
|
FUNCTION 6 gtrgm_picksplit (internal, internal),
|
|
FUNCTION 7 gtrgm_same (gtrgm, gtrgm, internal),
|
|
STORAGE gtrgm;
|
|
|
|
-- support functions for gin
|
|
CREATE OR REPLACE FUNCTION gin_extract_trgm(text, internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gin_extract_trgm(text, internal, int2, internal, internal)
|
|
RETURNS internal
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
CREATE OR REPLACE FUNCTION gin_trgm_consistent(internal, int2, text, int4, internal, internal)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE C IMMUTABLE;
|
|
|
|
-- create the operator class for gin
|
|
CREATE OPERATOR CLASS gin_trgm_ops
|
|
FOR TYPE text USING gin
|
|
AS
|
|
OPERATOR 1 % (text, text),
|
|
FUNCTION 1 btint4cmp (int4, int4),
|
|
FUNCTION 2 gin_extract_trgm (text, internal),
|
|
FUNCTION 3 gin_extract_trgm (text, internal, int2, internal, internal),
|
|
FUNCTION 4 gin_trgm_consistent (internal, int2, text, int4, internal, internal),
|
|
STORAGE int4;
|