-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpgpcre--0.sql
90 lines (75 loc) · 1.77 KB
/
pgpcre--0.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
SET client_min_messages = warning;
CREATE TYPE pcre;
CREATE FUNCTION pcre_in(cstring)
RETURNS pcre
AS '$libdir/pgpcre'
LANGUAGE C STRICT;
CREATE FUNCTION pcre_out(pcre)
RETURNS cstring
AS '$libdir/pgpcre'
LANGUAGE C STRICT;
CREATE TYPE pcre (
INTERNALLENGTH = -1,
INPUT = pcre_in,
OUTPUT = pcre_out,
STORAGE = extended
);
CREATE FUNCTION pcre_text_matches(subject text, pattern pcre) RETURNS boolean
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;
CREATE FUNCTION pcre_matches_text(pattern pcre, subject text) RETURNS boolean
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;
CREATE FUNCTION pcre_text_matches_not(subject text, pattern pcre) RETURNS boolean
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;
CREATE FUNCTION pcre_matches_text_not(pattern pcre, subject text) RETURNS boolean
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;
CREATE OPERATOR =~ (
PROCEDURE = pcre_text_matches,
LEFTARG = text,
RIGHTARG = pcre
);
CREATE OPERATOR ~ (
PROCEDURE = pcre_text_matches,
LEFTARG = text,
RIGHTARG = pcre
);
CREATE OPERATOR ~ (
PROCEDURE = pcre_matches_text,
LEFTARG = pcre,
RIGHTARG = text,
COMMUTATOR = ~
);
CREATE OPERATOR !~ (
PROCEDURE = pcre_text_matches_not,
LEFTARG = text,
RIGHTARG = pcre,
NEGATOR = ~
);
CREATE OPERATOR !~ (
PROCEDURE = pcre_matches_text_not,
LEFTARG = pcre,
RIGHTARG = text,
COMMUTATOR = !~,
NEGATOR = ~
);
CREATE FUNCTION pcre_match(pattern pcre, subject text) RETURNS text
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;
CREATE FUNCTION pcre_captured_substrings(pattern pcre, subject text) RETURNS text[]
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;