Skip to content

Commit bcc9e27

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 db47990 commit bcc9e27

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
@@ -75,13 +75,18 @@ ALTER EXTENSION age
7575
ALTER EXTENSION age
7676
DROP OPERATOR ?| (agtype, text[]);
7777
ALTER EXTENSION age
78-
DROP OPERATOR ?& (agtype, agtype[]);
78+
DROP OPERATOR ?& (agtype, agtype);
7979
ALTER EXTENSION age
80-
DROP OPERATOR ?& (agtype, text);
80+
DROP OPERATOR ?& (agtype, text[]);
81+
ALTER EXTENSION age
82+
DROP OPERATOR @> (agtype, agtype);
83+
ALTER EXTENSION age
84+
DROP OPERATOR <@ (agtype, agtype);
8185

8286
DROP OPERATOR ? (agtype, agtype), ? (agtype, text),
8387
?| (agtype, agtype), ?| (agtype, text[]),
84-
?& (agtype, agtype[]), ?& (agtype, text);
88+
?& (agtype, agtype), ?& (agtype, text[]),
89+
@> (agtype, agtype), <@ (agtype, agtype);
8590

8691
CREATE OPERATOR ? (
8792
LEFTARG = agtype,
@@ -131,30 +136,23 @@ CREATE OPERATOR ?& (
131136
JOIN = matchingjoinsel
132137
);
133138

134-
ALTER EXTENSION age
135-
ADD OPERATOR ? (agtype, agtype);
136-
ALTER EXTENSION age
137-
ADD OPERATOR ? (agtype, text);
138-
ALTER EXTENSION age
139-
ADD OPERATOR ?| (agtype, agtype);
140-
ALTER EXTENSION age
141-
ADD OPERATOR ?| (agtype, text[]);
142-
ALTER EXTENSION age
143-
ADD OPERATOR ?& (agtype, agtype[]);
144-
ALTER EXTENSION age
145-
ADD OPERATOR ?& (agtype, text);
146-
147-
ALTER OPERATOR @> (agtype, agtype)
148-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
149-
150-
ALTER OPERATOR @> (agtype, agtype)
151-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
152-
153-
ALTER OPERATOR <@ (agtype, agtype)
154-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
139+
CREATE OPERATOR @> (
140+
LEFTARG = agtype,
141+
RIGHTARG = agtype,
142+
FUNCTION = ag_catalog.agtype_contains,
143+
COMMUTATOR = '<@',
144+
RESTRICT = matchingsel,
145+
JOIN = matchingjoinsel
146+
);
155147

156-
ALTER OPERATOR <@ (agtype, agtype)
157-
SET (RESTRICT = matchingsel, JOIN = matchingjoinsel);
148+
CREATE OPERATOR <@ (
149+
LEFTARG = agtype,
150+
RIGHTARG = agtype,
151+
FUNCTION = ag_catalog.agtype_contained_by,
152+
COMMUTATOR = '@>',
153+
RESTRICT = matchingsel,
154+
JOIN = matchingjoinsel
155+
);
158156

159157
/*
160158
* Since there is no option to add or drop operator from class,
@@ -166,6 +164,7 @@ ALTER EXTENSION age
166164
DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
167165

168166
DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
167+
DROP OPERATOR FAMILY ag_catalog.gin_agtype_ops USING gin;
169168

170169
CREATE OPERATOR CLASS ag_catalog.gin_agtype_ops
171170
DEFAULT FOR TYPE agtype USING gin AS
@@ -186,9 +185,6 @@ DEFAULT FOR TYPE agtype USING gin AS
186185
internal, internal, internal),
187186
STORAGE text;
188187

189-
ALTER EXTENSION age
190-
ADD OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin;
191-
192188
-- this function went from variadic "any" to just "any" type
193189
CREATE OR REPLACE FUNCTION ag_catalog.age_tostring("any")
194190
RETURNS agtype

0 commit comments

Comments
 (0)