1 /* contrib/citext/citext--unpackaged--1.0.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION citext" to load this file. \quit
6 ALTER EXTENSION citext ADD type citext;
7 ALTER EXTENSION citext ADD function citextin(cstring);
8 ALTER EXTENSION citext ADD function citextout(citext);
9 ALTER EXTENSION citext ADD function citextrecv(internal);
10 ALTER EXTENSION citext ADD function citextsend(citext);
11 ALTER EXTENSION citext ADD function citext(character);
12 ALTER EXTENSION citext ADD function citext(boolean);
13 ALTER EXTENSION citext ADD function citext(inet);
14 ALTER EXTENSION citext ADD cast (citext as text);
15 ALTER EXTENSION citext ADD cast (citext as character varying);
16 ALTER EXTENSION citext ADD cast (citext as character);
17 ALTER EXTENSION citext ADD cast (text as citext);
18 ALTER EXTENSION citext ADD cast (character varying as citext);
19 ALTER EXTENSION citext ADD cast (character as citext);
20 ALTER EXTENSION citext ADD cast (boolean as citext);
21 ALTER EXTENSION citext ADD cast (inet as citext);
22 ALTER EXTENSION citext ADD function citext_eq(citext,citext);
23 ALTER EXTENSION citext ADD function citext_ne(citext,citext);
24 ALTER EXTENSION citext ADD function citext_lt(citext,citext);
25 ALTER EXTENSION citext ADD function citext_le(citext,citext);
26 ALTER EXTENSION citext ADD function citext_gt(citext,citext);
27 ALTER EXTENSION citext ADD function citext_ge(citext,citext);
28 ALTER EXTENSION citext ADD operator <>(citext,citext);
29 ALTER EXTENSION citext ADD operator =(citext,citext);
30 ALTER EXTENSION citext ADD operator >(citext,citext);
31 ALTER EXTENSION citext ADD operator >=(citext,citext);
32 ALTER EXTENSION citext ADD operator <(citext,citext);
33 ALTER EXTENSION citext ADD operator <=(citext,citext);
34 ALTER EXTENSION citext ADD function citext_cmp(citext,citext);
35 ALTER EXTENSION citext ADD function citext_hash(citext);
36 ALTER EXTENSION citext ADD operator family citext_ops using btree;
37 ALTER EXTENSION citext ADD operator class citext_ops using btree;
38 ALTER EXTENSION citext ADD operator family citext_ops using hash;
39 ALTER EXTENSION citext ADD operator class citext_ops using hash;
40 ALTER EXTENSION citext ADD function citext_smaller(citext,citext);
41 ALTER EXTENSION citext ADD function citext_larger(citext,citext);
42 ALTER EXTENSION citext ADD function min(citext);
43 ALTER EXTENSION citext ADD function max(citext);
44 ALTER EXTENSION citext ADD function texticlike(citext,citext);
45 ALTER EXTENSION citext ADD function texticnlike(citext,citext);
46 ALTER EXTENSION citext ADD function texticregexeq(citext,citext);
47 ALTER EXTENSION citext ADD function texticregexne(citext,citext);
48 ALTER EXTENSION citext ADD operator !~(citext,citext);
49 ALTER EXTENSION citext ADD operator ~(citext,citext);
50 ALTER EXTENSION citext ADD operator !~*(citext,citext);
51 ALTER EXTENSION citext ADD operator ~*(citext,citext);
52 ALTER EXTENSION citext ADD operator !~~(citext,citext);
53 ALTER EXTENSION citext ADD operator ~~(citext,citext);
54 ALTER EXTENSION citext ADD operator !~~*(citext,citext);
55 ALTER EXTENSION citext ADD operator ~~*(citext,citext);
56 ALTER EXTENSION citext ADD function texticlike(citext,text);
57 ALTER EXTENSION citext ADD function texticnlike(citext,text);
58 ALTER EXTENSION citext ADD function texticregexeq(citext,text);
59 ALTER EXTENSION citext ADD function texticregexne(citext,text);
60 ALTER EXTENSION citext ADD operator !~(citext,text);
61 ALTER EXTENSION citext ADD operator ~(citext,text);
62 ALTER EXTENSION citext ADD operator !~*(citext,text);
63 ALTER EXTENSION citext ADD operator ~*(citext,text);
64 ALTER EXTENSION citext ADD operator !~~(citext,text);
65 ALTER EXTENSION citext ADD operator ~~(citext,text);
66 ALTER EXTENSION citext ADD operator !~~*(citext,text);
67 ALTER EXTENSION citext ADD operator ~~*(citext,text);
68 ALTER EXTENSION citext ADD function regexp_matches(citext,citext);
69 ALTER EXTENSION citext ADD function regexp_matches(citext,citext,text);
70 ALTER EXTENSION citext ADD function regexp_replace(citext,citext,text);
71 ALTER EXTENSION citext ADD function regexp_replace(citext,citext,text,text);
72 ALTER EXTENSION citext ADD function regexp_split_to_array(citext,citext);
73 ALTER EXTENSION citext ADD function regexp_split_to_array(citext,citext,text);
74 ALTER EXTENSION citext ADD function regexp_split_to_table(citext,citext);
75 ALTER EXTENSION citext ADD function regexp_split_to_table(citext,citext,text);
76 ALTER EXTENSION citext ADD function strpos(citext,citext);
77 ALTER EXTENSION citext ADD function replace(citext,citext,citext);
78 ALTER EXTENSION citext ADD function split_part(citext,citext,integer);
79 ALTER EXTENSION citext ADD function translate(citext,citext,text);
82 -- As of 9.1, type citext should be marked collatable. There is no ALTER TYPE
83 -- command for this, so we have to do it by poking the pg_type entry directly.
84 -- We have to poke any derived copies in pg_attribute or pg_index as well,
85 -- as well as those for arrays/domains based directly or indirectly on citext.
86 -- Notes: 100 is the OID of the "pg_catalog.default" collation --- it seems
87 -- easier and more reliable to hard-wire that here than to pull it out of
88 -- pg_collation. Also, we don't need to make pg_depend entries since the
89 -- default collation is pinned.
92 WITH RECURSIVE typeoids(typoid) AS
93 ( SELECT 'citext'::pg_catalog.regtype UNION
94 SELECT oid FROM pg_catalog.pg_type, typeoids
95 WHERE typelem = typoid OR typbasetype = typoid )
96 UPDATE pg_catalog.pg_type SET typcollation = 100
98 WHERE oid = typeoids.typoid;
100 WITH RECURSIVE typeoids(typoid) AS
101 ( SELECT 'citext'::pg_catalog.regtype UNION
102 SELECT oid FROM pg_catalog.pg_type, typeoids
103 WHERE typelem = typoid OR typbasetype = typoid )
104 UPDATE pg_catalog.pg_attribute SET attcollation = 100
106 WHERE atttypid = typeoids.typoid;
108 UPDATE pg_catalog.pg_index SET indcollation[0] = 100
109 WHERE indclass[0] IN (
110 WITH RECURSIVE typeoids(typoid) AS
111 ( SELECT 'citext'::pg_catalog.regtype UNION
112 SELECT oid FROM pg_catalog.pg_type, typeoids
113 WHERE typelem = typoid OR typbasetype = typoid )
114 SELECT oid FROM pg_catalog.pg_opclass, typeoids
115 WHERE opcintype = typeoids.typoid
118 UPDATE pg_catalog.pg_index SET indcollation[1] = 100
119 WHERE indclass[1] IN (
120 WITH RECURSIVE typeoids(typoid) AS
121 ( SELECT 'citext'::pg_catalog.regtype UNION
122 SELECT oid FROM pg_catalog.pg_type, typeoids
123 WHERE typelem = typoid OR typbasetype = typoid )
124 SELECT oid FROM pg_catalog.pg_opclass, typeoids
125 WHERE opcintype = typeoids.typoid
128 UPDATE pg_catalog.pg_index SET indcollation[2] = 100
129 WHERE indclass[2] IN (
130 WITH RECURSIVE typeoids(typoid) AS
131 ( SELECT 'citext'::pg_catalog.regtype UNION
132 SELECT oid FROM pg_catalog.pg_type, typeoids
133 WHERE typelem = typoid OR typbasetype = typoid )
134 SELECT oid FROM pg_catalog.pg_opclass, typeoids
135 WHERE opcintype = typeoids.typoid
138 UPDATE pg_catalog.pg_index SET indcollation[3] = 100
139 WHERE indclass[3] IN (
140 WITH RECURSIVE typeoids(typoid) AS
141 ( SELECT 'citext'::pg_catalog.regtype UNION
142 SELECT oid FROM pg_catalog.pg_type, typeoids
143 WHERE typelem = typoid OR typbasetype = typoid )
144 SELECT oid FROM pg_catalog.pg_opclass, typeoids
145 WHERE opcintype = typeoids.typoid
148 UPDATE pg_catalog.pg_index SET indcollation[4] = 100
149 WHERE indclass[4] IN (
150 WITH RECURSIVE typeoids(typoid) AS
151 ( SELECT 'citext'::pg_catalog.regtype UNION
152 SELECT oid FROM pg_catalog.pg_type, typeoids
153 WHERE typelem = typoid OR typbasetype = typoid )
154 SELECT oid FROM pg_catalog.pg_opclass, typeoids
155 WHERE opcintype = typeoids.typoid
158 UPDATE pg_catalog.pg_index SET indcollation[5] = 100
159 WHERE indclass[5] IN (
160 WITH RECURSIVE typeoids(typoid) AS
161 ( SELECT 'citext'::pg_catalog.regtype UNION
162 SELECT oid FROM pg_catalog.pg_type, typeoids
163 WHERE typelem = typoid OR typbasetype = typoid )
164 SELECT oid FROM pg_catalog.pg_opclass, typeoids
165 WHERE opcintype = typeoids.typoid
168 UPDATE pg_catalog.pg_index SET indcollation[6] = 100
169 WHERE indclass[6] IN (
170 WITH RECURSIVE typeoids(typoid) AS
171 ( SELECT 'citext'::pg_catalog.regtype UNION
172 SELECT oid FROM pg_catalog.pg_type, typeoids
173 WHERE typelem = typoid OR typbasetype = typoid )
174 SELECT oid FROM pg_catalog.pg_opclass, typeoids
175 WHERE opcintype = typeoids.typoid
178 UPDATE pg_catalog.pg_index SET indcollation[7] = 100
179 WHERE indclass[7] IN (
180 WITH RECURSIVE typeoids(typoid) AS
181 ( SELECT 'citext'::pg_catalog.regtype UNION
182 SELECT oid FROM pg_catalog.pg_type, typeoids
183 WHERE typelem = typoid OR typbasetype = typoid )
184 SELECT oid FROM pg_catalog.pg_opclass, typeoids
185 WHERE opcintype = typeoids.typoid
188 -- somewhat arbitrarily, we assume no citext indexes have more than 8 columns