/usr/share/postgresql/9.5/extension/prefix--1.2.0.sql is in postgresql-9.5-prefix 1.2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | ---
--- prefix_range datatype installation
---
CREATE OR REPLACE FUNCTION prefix_range_in(cstring)
RETURNS prefix_range
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_out(prefix_range)
RETURNS cstring
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_recv(internal)
RETURNS prefix_range
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_send(prefix_range)
RETURNS bytea
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE TYPE prefix_range (
INPUT = prefix_range_in,
OUTPUT = prefix_range_out,
RECEIVE = prefix_range_recv,
SEND = prefix_range_send
);
COMMENT ON TYPE prefix_range IS 'prefix range: (prefix)?([a-b])?';
CREATE OR REPLACE FUNCTION prefix_range(text, text, text)
RETURNS prefix_range
AS '$libdir/prefix', 'prefix_range_init'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range(text)
RETURNS prefix_range
AS '$libdir/prefix', 'prefix_range_cast_from_text'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION text(prefix_range)
RETURNS text
AS '$libdir/prefix', 'prefix_range_cast_to_text'
LANGUAGE C IMMUTABLE STRICT;
CREATE CAST (text as prefix_range) WITH FUNCTION prefix_range(text) AS IMPLICIT;
CREATE CAST (prefix_range as text) WITH FUNCTION text(prefix_range);
CREATE OR REPLACE FUNCTION prefix_range_eq(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_neq(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_lt(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_le(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_gt(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_ge(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_cmp(prefix_range, prefix_range)
RETURNS integer
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_overlaps(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contains(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contains_strict(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contained_by(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_contained_by_strict(prefix_range, prefix_range)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_union(prefix_range, prefix_range)
RETURNS prefix_range
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION prefix_range_inter(prefix_range, prefix_range)
RETURNS prefix_range
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION length(prefix_range)
RETURNS int
AS '$libdir/prefix', 'prefix_range_length'
LANGUAGE C IMMUTABLE STRICT;
CREATE OPERATOR = (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_eq,
COMMUTATOR = '=',
NEGATOR = '<>',
RESTRICT = eqsel,
JOIN = eqjoinsel
);
COMMENT ON OPERATOR =(prefix_range, prefix_range) IS 'equals?';
CREATE OPERATOR <> (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_neq,
COMMUTATOR = '<>',
NEGATOR = '=',
RESTRICT = neqsel,
JOIN = neqjoinsel
);
COMMENT ON OPERATOR <>(prefix_range, prefix_range) IS 'not equals?';
CREATE OPERATOR < (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_lt,
COMMUTATOR = > ,
NEGATOR = >= ,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
COMMENT ON OPERATOR <(prefix_range, prefix_range) IS 'less-than';
CREATE OPERATOR <= (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_le,
COMMUTATOR = >= ,
NEGATOR = > ,
RESTRICT = scalarltsel,
JOIN = scalarltjoinsel
);
COMMENT ON OPERATOR <=(prefix_range, prefix_range) IS 'less-than-or-equal';
CREATE OPERATOR > (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_gt,
COMMUTATOR = < ,
NEGATOR = <= ,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
COMMENT ON OPERATOR >(prefix_range, prefix_range) IS 'greater-than';
CREATE OPERATOR >= (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_ge,
COMMUTATOR = <= ,
NEGATOR = < ,
RESTRICT = scalargtsel,
JOIN = scalargtjoinsel
);
COMMENT ON OPERATOR >=(prefix_range, prefix_range) IS 'greater-than-or-equal';
CREATE OPERATOR | (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_union
);
COMMENT ON OPERATOR |(prefix_range, prefix_range) IS 'union';
CREATE OPERATOR & (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_inter
);
COMMENT ON OPERATOR &(prefix_range, prefix_range) IS 'intersection';
CREATE OPERATOR && (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_overlaps,
COMMUTATOR = '&&',
RESTRICT = areasel,
JOIN = areajoinsel
);
COMMENT ON OPERATOR &&(prefix_range, prefix_range) IS 'overlaps?';
CREATE OPERATOR @> (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_contains,
COMMUTATOR = '<@',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR @>(prefix_range, prefix_range) IS 'contains?';
CREATE OPERATOR <@ (
LEFTARG = prefix_range,
RIGHTARG = prefix_range,
PROCEDURE = prefix_range_contained_by,
COMMUTATOR = '@>',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR <@(prefix_range, prefix_range) IS 'contained by?';
CREATE OPERATOR CLASS btree_prefix_range_ops
DEFAULT FOR TYPE prefix_range USING btree
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 prefix_range_cmp(prefix_range, prefix_range);
--
-- Up until 8.4, consistent took 3 arguments, then 5. In all cases, the
-- CREATE OPERATOR CLASS command will not check this.
--
CREATE OR REPLACE FUNCTION gpr_consistent(internal, prefix_range, smallint, oid)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_consistent(internal, prefix_range, smallint, oid, internal)
RETURNS bool
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_compress(internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_decompress(internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_penalty(internal, internal, internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION pr_penalty(prefix_range, prefix_range)
RETURNS float4
AS '$libdir/prefix'
LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit(internal, internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit_presort(internal, internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_picksplit_jordan(internal, internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_union(internal, internal)
RETURNS text
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gpr_same(prefix_range, prefix_range, internal)
RETURNS internal
AS '$libdir/prefix'
LANGUAGE C IMMUTABLE STRICT;
CREATE OPERATOR CLASS gist_prefix_range_ops
DEFAULT FOR TYPE prefix_range USING gist
AS
OPERATOR 1 @>,
OPERATOR 2 <@,
OPERATOR 3 =,
OPERATOR 4 &&,
FUNCTION 1 gpr_consistent (internal, prefix_range, smallint, oid, internal),
FUNCTION 2 gpr_union (internal, internal),
FUNCTION 3 gpr_compress (internal),
FUNCTION 4 gpr_decompress (internal),
FUNCTION 5 gpr_penalty (internal, internal, internal),
FUNCTION 6 gpr_picksplit (internal, internal),
FUNCTION 7 gpr_same (prefix_range, prefix_range, internal);
-- CREATE OPERATOR CLASS gist_prefix_range_presort_ops
-- FOR TYPE prefix_range USING gist
-- AS
-- OPERATOR 1 @>,
-- FUNCTION 1 gpr_consistent (internal, prefix_range, smallint, oid, internal),
-- FUNCTION 2 gpr_union (internal, internal),
-- FUNCTION 3 gpr_compress (internal),
-- FUNCTION 4 gpr_decompress (internal),
-- FUNCTION 5 gpr_penalty (internal, internal, internal),
-- FUNCTION 6 gpr_picksplit_presort (internal, internal),
-- FUNCTION 7 gpr_same (prefix_range, prefix_range, internal);
-- CREATE OPERATOR CLASS gist_prefix_range_jordan_ops
-- FOR TYPE prefix_range USING gist
-- AS
-- OPERATOR 1 @>,
-- FUNCTION 1 gpr_consistent (internal, prefix_range, smallint, oid, internal),
-- FUNCTION 2 gpr_union (internal, internal),
-- FUNCTION 3 gpr_compress (internal),
-- FUNCTION 4 gpr_decompress (internal),
-- FUNCTION 5 gpr_penalty (internal, internal, internal),
-- FUNCTION 6 gpr_picksplit_jordan (internal, internal),
-- FUNCTION 7 gpr_same (prefix_range, prefix_range, internal);
|