File: pgpcre--1.sql

package info (click to toggle)
pgpcre 0.20190509-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 140 kB
  • sloc: ansic: 262; sql: 181; makefile: 19; sh: 1
file content (92 lines) | stat: -rw-r--r-- 1,875 bytes parent folder | download
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
91
92
SET client_min_messages = warning;

CREATE TYPE pcre;

CREATE FUNCTION pcre_in(cstring) RETURNS pcre
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;

CREATE FUNCTION pcre_out(pcre) RETURNS cstring
IMMUTABLE
RETURNS NULL ON NULL INPUT
AS '$libdir/pgpcre'
LANGUAGE C;

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;