Skip to content

Commit b51f4c3

Browse files
Fix upgrade script for 1.5.0 to 1.6.0 (#2211)
- Since there are modifications to agtype gin operators, users will have to drop the gin indexes before running this script and recreate them.
1 parent c38ac06 commit b51f4c3

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

age--1.5.0--y.y.y.sql

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ ALTER EXTENSION age
9494
ALTER EXTENSION age
9595
DROP OPERATOR ?| (agtype, text[]);
9696
ALTER EXTENSION age
97-
DROP OPERATOR ?& (agtype, agtype[]);
97+
DROP OPERATOR ?& (agtype, agtype);
9898
ALTER EXTENSION age
99-
DROP OPERATOR ?& (agtype, text);
99+
DROP OPERATOR ?& (agtype, text[]);
100+
ALTER EXTENSION age
101+
DROP OPERATOR @> (agtype, agtype);
102+
ALTER EXTENSION age
103+
DROP OPERATOR <@ (agtype, agtype);
100104

101105
DROP OPERATOR ? (agtype, agtype), ? (agtype, text),
102106
?| (agtype, agtype), ?| (agtype, text[]),
103-
?& (agtype, agtype[]), ?& (agtype, text);
107+
?& (agtype, agtype), ?& (agtype, text[]),
108+
@> (agtype, agtype), <@ (agtype, agtype);
104109

105110
CREATE OPERATOR ? (
106111
LEFTARG = agtype,
@@ -150,30 +155,23 @@ CREATE OPERATOR ?& (
150155
JOIN = matchingjoinsel
151156
);
152157

153-
ALTER EXTENSION age
154-
ADD OPERATOR ? (agtype, agtype);
155-
ALTER EXTENSION age
156-
ADD OPERATOR ? (agtype, text);
157-
ALTER EXTENSION age
158-
ADD OPERATOR ?| (agtype, agtype);
159-
ALTER EXTENSION age
160-
ADD OPERATOR ?| (agtype, text[]);
161-
ALTER EXTENSION age
162-
ADD OPERATOR ?& (agtype, agtype[]);
163-
ALTER EXTENSION age
164-
ADD OPERATOR ?& (agtype, text);
165-
166-
ALTER OPERATOR @> (agtype, agtype)
167-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
168-
169-
ALTER OPERATOR @> (agtype, agtype)
170-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
171-
172-
ALTER OPERATOR <@ (agtype, agtype)
173-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
158+
CREATE OPERATOR @> (
159+
LEFTARG = agtype,
160+
RIGHTARG = agtype,
161+
FUNCTION = ag_catalog.agtype_contains,
162+
COMMUTATOR = '<@',
163+
RESTRICT = matchingsel,
164+
JOIN = matchingjoinsel
165+
);
174166

175-
ALTER OPERATOR <@ (agtype, agtype)
176-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
167+
CREATE OPERATOR <@ (
168+
LEFTARG = agtype,
169+
RIGHTARG = agtype,
170+
FUNCTION = ag_catalog.agtype_contained_by,
171+
COMMUTATOR = '@>',
172+
RESTRICT = matchingsel,
173+
JOIN = matchingjoinsel
174+
);
177175

178176
/*
179177
* Since there is no option to add or drop operator from class,
@@ -185,6 +183,7 @@ ALTER EXTENSION age
185183
DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
186184

187185
DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
186+
DROP OPERATOR FAMILY ag_catalog.gin_agtype_ops USING gin;
188187

189188
CREATE OPERATOR CLASS ag_catalog.gin_agtype_ops
190189
DEFAULT FOR TYPE agtype USING gin AS
@@ -205,9 +204,6 @@ DEFAULT FOR TYPE agtype USING gin AS
205204
internal, internal, internal),
206205
STORAGE text;
207206

208-
ALTER EXTENSION age
209-
ADD OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
210-
211207
-- this function went from variadic "any" to just "any" type
212208
CREATE OR REPLACE FUNCTION ag_catalog.age_tostring("any")
213209
RETURNS agtype

0 commit comments

Comments
 (0)