forked from pgbigm/pg_bigm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg_bigm--1.1--1.2.sql
41 lines (39 loc) · 1.98 KB
/
pg_bigm--1.1--1.2.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION pg_bigm UPDATE TO '1.2'" to load this file. \quit
/* triConsistent function is available only in 9.4 or later */
DO $$
DECLARE
pgversion INTEGER;
BEGIN
SELECT current_setting('server_version_num')::INTEGER INTO pgversion;
IF pgversion >= 90400 THEN
CREATE FUNCTION gin_bigm_triconsistent(internal, int2, text, int4, internal, internal, internal)
RETURNS "char"
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
ALTER OPERATOR FAMILY gin_bigm_ops USING gin ADD
FUNCTION 6 (text, text) gin_bigm_triconsistent (internal, int2, text, int4, internal, internal, internal);
END IF;
END;
$$;
/* Label whether the function is deemed safe for parallelism */
DO $$
DECLARE
pgversion INTEGER;
BEGIN
SELECT current_setting('server_version_num')::INTEGER INTO pgversion;
IF pgversion >= 90600 THEN
EXECUTE 'ALTER FUNCTION show_bigm(text) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION bigm_similarity(text, text) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION bigm_similarity_op(text, text) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION gin_extract_value_bigm(text, internal) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION gin_extract_query_bigm(text, internal, int2, internal, internal, internal, internal) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION gin_bigm_consistent(internal, int2, text, int4, internal, internal, internal, internal) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION gin_bigm_compare_partial(text, text, int2, internal) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION bigmtextcmp(text, text) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION likequery(text) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION pg_gin_pending_stats(index regclass) PARALLEL SAFE';
EXECUTE 'ALTER FUNCTION gin_bigm_triconsistent(internal, int2, text, int4, internal, internal, internal) PARALLEL SAFE';
END IF;
END;
$$;