On Fri, Oct 09, 2020 at 07:42:51PM -0400, Bruce Momjian wrote: > On Fri, Oct 9, 2020 at 02:23:10PM -0500, Justin Pryzby wrote: > > In my local branch, I had revised this comment to say: > > > > + * Note, v8.4 has no tablespace_suffix, which is fine so long as the > > version we > > + * being upgraded *to* has a suffix, since it's not allowed to pg_upgrade > > from > > + * a version to the same version if tablespaces are in use. > > OK, updated patch attached. Also, from your original patch, I didn't > need to call canonicalize_path() since we are not comparing paths, and I > didn't need to include common/relpath.h. I also renamed a variable.
Since I just hit it again, I'll take the opportunity to give an example of how this can happen. Here, I've pg_upgraded from a pg12 to pg13, but the pg12 cluster has postgis-3.0, and pg13 has postgis-3.1. Maybe that's not guaranteed/intended to work, but that's what's been working well so far this year, except that there's two gis functions which no longer exist. So we fail while "Restoring database schemas in the new cluster", leaving behind tablespace dirs, which then cause future pg_upgrades to fail. pg_restore: from TOC entry 13543; 1255 17106 FUNCTION pgis_geometry_union_transfn("internal", "public"."geometry") postgres pg_restore: error: could not execute query: ERROR: could not find function "pgis_geometry_union_transfn" in file "/usr/pgsql-13/lib/postgis-3.so" Command was: CREATE FUNCTION "public"."pgis_geometry_union_transfn"("internal", "public"."geometry") RETURNS "internal" LANGUAGE "c" PARALLEL SAFE AS '$libdir/postgis-3', 'pgis_geometry_union_transfn'; I imagine in previous years I hit that some other way, like maybe I installed postgres RC1 on a customer server, imported their schema (and maybe data), which then caused upgrade failure 1-2 months later when trying to upgrade their production instance. -- Justin