-
Notifications
You must be signed in to change notification settings - Fork 2
/
language--0.0.1.sql
181 lines (144 loc) · 4.47 KB
/
language--0.0.1.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
CREATE TYPE language;
CREATE FUNCTION supported_languages()
RETURNS SETOF language
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION language_in(cstring)
RETURNS language
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION language_out(language)
RETURNS cstring
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION language_recv(internal)
RETURNS language
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION language_send(language)
RETURNS bytea
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE TYPE language (
internallength = 1,
input = language_in,
output = language_out,
send = language_send,
receive = language_recv,
alignment = char,
PASSEDBYVALUE
);
COMMENT ON TYPE language
IS '1-byte adjust-specific Language Code';
CREATE FUNCTION language_lt(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_lt(language, language) IS 'implementation of < operator';
CREATE FUNCTION language_le(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_le(language, language) IS 'implementation of <= operator';
CREATE FUNCTION language_eq(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_eq(language, language) IS 'implementation of = operator';
CREATE FUNCTION language_neq(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_neq(language, language) IS 'implementation of <> operator';
CREATE FUNCTION language_ge(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_ge(language, language) IS 'implementation of >= operator';
CREATE FUNCTION language_gt(language, language)
RETURNS BOOL
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION language_gt(language, language) IS 'implementation of > operator';
CREATE FUNCTION hash_language(language)
RETURNS integer
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
COMMENT ON FUNCTION hash_language(language) IS 'hash';
CREATE OPERATOR < (
leftarg = language,
rightarg = language,
procedure = language_lt,
commutator = >,
negator = >=,
restrict = scalarltsel,
join = scalarltjoinsel
);
COMMENT ON OPERATOR <(language, language) IS 'less than';
CREATE OPERATOR <= (
leftarg = language,
rightarg = language,
procedure = language_le,
commutator = >=,
negator = >,
restrict = scalarltsel,
join = scalarltjoinsel
);
COMMENT ON OPERATOR <=(language, language) IS 'less than or equal';
CREATE OPERATOR = (
leftarg = language,
rightarg = language,
procedure = language_eq,
commutator = =,
negator = <>,
restrict = eqsel,
join = eqjoinsel,
HASHES, MERGES
);
COMMENT ON OPERATOR =(language, language) IS 'equal';
CREATE OPERATOR >= (
leftarg = language,
rightarg = language,
procedure = language_ge,
commutator = <=,
negator = <,
restrict = scalargtsel,
join = scalargtjoinsel
);
COMMENT ON OPERATOR >=(language, language) IS 'greater than or equal';
CREATE OPERATOR > (
leftarg = language,
rightarg = language,
procedure = language_gt,
commutator = <,
negator = <=,
restrict = scalargtsel,
join = scalargtjoinsel
);
COMMENT ON OPERATOR >(language, language) IS 'greater than';
CREATE OPERATOR <> (
leftarg = language,
rightarg = language,
procedure = language_neq,
commutator = <>,
negator = =,
restrict = neqsel,
join = neqjoinsel
);
COMMENT ON OPERATOR <>(language, language) IS 'not equal';
CREATE FUNCTION language_cmp(language, language)
RETURNS int4
AS '$libdir/language.so'
LANGUAGE C IMMUTABLE STRICT;
CREATE OPERATOR CLASS language_ops
DEFAULT FOR TYPE language USING btree AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 language_cmp(language, language);
CREATE OPERATOR CLASS language_ops
DEFAULT FOR TYPE language USING hash AS
OPERATOR 1 = ,
FUNCTION 1 hash_language(language);