From cfe9aa71ed9a3cc9b5c9589b11d297dded60a8e9 Mon Sep 17 00:00:00 2001 From: Muhammad Taha Naveed Date: Mon, 25 Aug 2025 21:22:01 +0500 Subject: [PATCH] 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. --- age--1.5.0--y.y.y.sql | 54 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/age--1.5.0--y.y.y.sql b/age--1.5.0--y.y.y.sql index cb76b3981..346301754 100644 --- a/age--1.5.0--y.y.y.sql +++ b/age--1.5.0--y.y.y.sql @@ -94,13 +94,18 @@ ALTER EXTENSION age ALTER EXTENSION age DROP OPERATOR ?| (agtype, text[]); ALTER EXTENSION age - DROP OPERATOR ?& (agtype, agtype[]); + DROP OPERATOR ?& (agtype, agtype); ALTER EXTENSION age - DROP OPERATOR ?& (agtype, text); + DROP OPERATOR ?& (agtype, text[]); +ALTER EXTENSION age + DROP OPERATOR @> (agtype, agtype); +ALTER EXTENSION age + DROP OPERATOR <@ (agtype, agtype); DROP OPERATOR ? (agtype, agtype), ? (agtype, text), ?| (agtype, agtype), ?| (agtype, text[]), - ?& (agtype, agtype[]), ?& (agtype, text); + ?& (agtype, agtype), ?& (agtype, text[]), + @> (agtype, agtype), <@ (agtype, agtype); CREATE OPERATOR ? ( LEFTARG = agtype, @@ -150,30 +155,23 @@ CREATE OPERATOR ?& ( JOIN = matchingjoinsel ); -ALTER EXTENSION age - ADD OPERATOR ? (agtype, agtype); -ALTER EXTENSION age - ADD OPERATOR ? (agtype, text); -ALTER EXTENSION age - ADD OPERATOR ?| (agtype, agtype); -ALTER EXTENSION age - ADD OPERATOR ?| (agtype, text[]); -ALTER EXTENSION age - ADD OPERATOR ?& (agtype, agtype[]); -ALTER EXTENSION age - ADD OPERATOR ?& (agtype, text); - -ALTER OPERATOR @> (agtype, agtype) - SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); - -ALTER OPERATOR @> (agtype, agtype) - SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); - -ALTER OPERATOR <@ (agtype, agtype) - SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +CREATE OPERATOR @> ( + LEFTARG = agtype, + RIGHTARG = agtype, + FUNCTION = ag_catalog.agtype_contains, + COMMUTATOR = '<@', + RESTRICT = matchingsel, + JOIN = matchingjoinsel +); -ALTER OPERATOR <@ (agtype, agtype) - SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +CREATE OPERATOR <@ ( + LEFTARG = agtype, + RIGHTARG = agtype, + FUNCTION = ag_catalog.agtype_contained_by, + COMMUTATOR = '@>', + RESTRICT = matchingsel, + JOIN = matchingjoinsel +); /* * Since there is no option to add or drop operator from class, @@ -185,6 +183,7 @@ ALTER EXTENSION age DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin; DROP OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin; +DROP OPERATOR FAMILY ag_catalog.gin_agtype_ops USING gin; CREATE OPERATOR CLASS ag_catalog.gin_agtype_ops DEFAULT FOR TYPE agtype USING gin AS @@ -205,9 +204,6 @@ DEFAULT FOR TYPE agtype USING gin AS internal, internal, internal), STORAGE text; -ALTER EXTENSION age - ADD OPERATOR CLASS ag_catalog.gin_agtype_ops USING gin; - -- this function went from variadic "any" to just "any" type CREATE OR REPLACE FUNCTION ag_catalog.age_tostring("any") RETURNS agtype