Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Tighten pg_upgrade's new check for non-upgradable anyarray usages.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 5 Jul 2022 22:23:19 +0000 (18:23 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 5 Jul 2022 22:23:19 +0000 (18:23 -0400)
We only need to reject cases when the aggregate or operator is
itself declared with a polymorphic type.  Per buildfarm.

Discussion: https://postgr.es/m/3383880.QJadu78ljV@vejsadalnx

src/bin/pg_upgrade/check.c

index 0085557a9e6b2ee7146bbb8aff51c146b698ba75..cc4a4fd104e2473f132eebef09bdc0676669e2fe 100644 (file)
@@ -1040,6 +1040,7 @@ check_for_incompatible_polymorphics(ClusterInfo *cluster)
                                "JOIN pg_proc AS transfn ON transfn.oid=a.aggtransfn "
                                "WHERE p.oid >= 16384 "
                                "AND a.aggtransfn = ANY(ARRAY[%s]::regprocedure[]) "
+                               "AND a.aggtranstype = ANY(ARRAY['anyarray', 'anyelement']::regtype[]) "
 
        /* Aggregate final functions */
                                "UNION ALL "
@@ -1049,13 +1050,15 @@ check_for_incompatible_polymorphics(ClusterInfo *cluster)
                                "JOIN pg_proc AS finalfn ON finalfn.oid=a.aggfinalfn "
                                "WHERE p.oid >= 16384 "
                                "AND a.aggfinalfn = ANY(ARRAY[%s]::regprocedure[]) "
+                               "AND a.aggtranstype = ANY(ARRAY['anyarray', 'anyelement']::regtype[]) "
 
        /* Operators */
                                "UNION ALL "
                                "SELECT 'operator' AS objkind, op.oid::regoperator::text AS objname "
                                "FROM pg_operator AS op "
                                "WHERE op.oid >= 16384 "
-                               "AND oprcode = ANY(ARRAY[%s]::regprocedure[]);",
+                               "AND oprcode = ANY(ARRAY[%s]::regprocedure[]) "
+                               "AND oprleft = ANY(ARRAY['anyarray', 'anyelement']::regtype[]);",
                                old_polymorphics.data,
                                old_polymorphics.data,
                                old_polymorphics.data);