/usr/share/postgresql/9.4/extension/debversion--1.0.7.sql is in postgresql-9.4-debversion 1.0.7-4.
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 | --- Debian version type and operators -*- sql -*-
---
--- Copyright © 2008 Roger Leigh <rleigh@debian.org>
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 2 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful, but
--- WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--- General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see
--- <http://www.gnu.org/licenses/>.
CREATE TYPE debversion;
CREATE OR REPLACE FUNCTION debversionin(cstring)
RETURNS debversion
AS 'textin'
LANGUAGE internal
IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION debversionout(debversion)
RETURNS cstring
AS 'textout'
LANGUAGE internal
IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION debversionrecv(internal)
RETURNS debversion
AS 'textrecv'
LANGUAGE internal
STABLE STRICT;
CREATE OR REPLACE FUNCTION debversionsend(debversion)
RETURNS bytea
AS 'textsend'
LANGUAGE internal
STABLE STRICT;
CREATE TYPE debversion (
LIKE = text,
INPUT = debversionin,
OUTPUT = debversionout,
RECEIVE = debversionrecv,
SEND = debversionsend,
-- make it a non-preferred member of string type category
CATEGORY = 'S',
PREFERRED = false
);
COMMENT ON TYPE debversion IS 'Debian package version number';
CREATE OR REPLACE FUNCTION debversion(bpchar)
RETURNS debversion
AS 'rtrim1'
LANGUAGE internal
IMMUTABLE STRICT;
CREATE CAST (debversion AS text) WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (debversion AS varchar) WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST (debversion AS bpchar) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE CAST (text AS debversion) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE CAST (varchar AS debversion) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE CAST (bpchar AS debversion) WITH FUNCTION debversion(bpchar);
CREATE OR REPLACE FUNCTION debversion_cmp (version1 debversion,
version2 debversion)
RETURNS integer AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_cmp (debversion, debversion)
IS 'Compare Debian versions';
CREATE OR REPLACE FUNCTION debversion_eq (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_eq (debversion, debversion)
IS 'debversion equal';
CREATE OR REPLACE FUNCTION debversion_ne (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_ne (debversion, debversion)
IS 'debversion not equal';
CREATE OR REPLACE FUNCTION debversion_lt (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_lt (debversion, debversion)
IS 'debversion less-than';
CREATE OR REPLACE FUNCTION debversion_gt (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_gt (debversion, debversion)
IS 'debversion greater-than';
CREATE OR REPLACE FUNCTION debversion_le (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_le (debversion, debversion)
IS 'debversion less-than-or-equal';
CREATE OR REPLACE FUNCTION debversion_ge (version1 debversion,
version2 debversion)
RETURNS boolean AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
COMMENT ON FUNCTION debversion_ge (debversion, debversion)
IS 'debversion greater-than-or-equal';
CREATE OPERATOR = (
PROCEDURE = debversion_eq,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = =,
NEGATOR = !=
);
COMMENT ON OPERATOR = (debversion, debversion)
IS 'debversion equal';
CREATE OPERATOR != (
PROCEDURE = debversion_ne,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = !=,
NEGATOR = =
);
COMMENT ON OPERATOR != (debversion, debversion)
IS 'debversion not equal';
CREATE OPERATOR < (
PROCEDURE = debversion_lt,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = >,
NEGATOR = >=
);
COMMENT ON OPERATOR < (debversion, debversion)
IS 'debversion less-than';
CREATE OPERATOR > (
PROCEDURE = debversion_gt,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = <,
NEGATOR = >=
);
COMMENT ON OPERATOR > (debversion, debversion)
IS 'debversion greater-than';
CREATE OPERATOR <= (
PROCEDURE = debversion_le,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = >=,
NEGATOR = >
);
COMMENT ON OPERATOR <= (debversion, debversion)
IS 'debversion less-than-or-equal';
CREATE OPERATOR >= (
PROCEDURE = debversion_ge,
LEFTARG = debversion,
RIGHTARG = debversion,
COMMUTATOR = <=,
NEGATOR = <
);
COMMENT ON OPERATOR >= (debversion, debversion)
IS 'debversion greater-than-or-equal';
CREATE OPERATOR CLASS debversion_ops
DEFAULT FOR TYPE debversion USING btree AS
OPERATOR 1 < (debversion, debversion),
OPERATOR 2 <= (debversion, debversion),
OPERATOR 3 = (debversion, debversion),
OPERATOR 4 >= (debversion, debversion),
OPERATOR 5 > (debversion, debversion),
FUNCTION 1 debversion_cmp(debversion, debversion);
CREATE OR REPLACE FUNCTION debversion_hash(debversion)
RETURNS int4
AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
CREATE OPERATOR CLASS debversion_ops
DEFAULT FOR TYPE debversion USING hash AS
OPERATOR 1 = (debversion, debversion),
FUNCTION 1 debversion_hash(debversion);
CREATE OR REPLACE FUNCTION debversion_smaller(version1 debversion,
version2 debversion)
RETURNS debversion
AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION debversion_larger(version1 debversion,
version2 debversion)
RETURNS debversion
AS 'MODULE_PATHNAME'
LANGUAGE C
IMMUTABLE STRICT;
CREATE AGGREGATE min(debversion) (
SFUNC = debversion_smaller,
STYPE = debversion,
SORTOP = <
);
CREATE AGGREGATE max(debversion) (
SFUNC = debversion_larger,
STYPE = debversion,
SORTOP = >
);
|