Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYaTD-0008FB-Ra for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 22:02:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYaTC-0004Ra-NF for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 22:02:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYaTC-0004RL-Cf for pgsql-hackers@lists.postgresql.org; Wed, 14 Sep 2022 22:02:58 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYaT9-0003hU-EM for pgsql-hackers@postgresql.org; Wed, 14 Sep 2022 22:02:57 +0000 Received: (Authenticated sender: strk@kbt.io) by mail.gandi.net (Postfix) with ESMTPSA id 7BC13C0002; Wed, 14 Sep 2022 22:02:51 +0000 (UTC) Date: Thu, 15 Sep 2022 00:02:49 +0200 From: Sandro Santilli Sender: strk@kbt.io To: pgsql-hackers@postgresql.org, Laurenz Albe , Regina Obe , Tom Lane Subject: Re: [PATCH] Support % wildcard in extension upgrade filenames Message-ID: Mail-Followup-To: Sandro Santilli , pgsql-hackers@postgresql.org, Laurenz Albe , Regina Obe , Tom Lane References: <001d01d87211$edbd5b50$c93811f0$@pcorp.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="339zka8KxudZ+6RE" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --339zka8KxudZ+6RE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline And now with the actual patch attached ... (sorry) --strk; On Thu, Sep 15, 2022 at 12:01:04AM +0200, Sandro Santilli wrote: > I'm attaching an updated version of the patch. This time the patch > is tested. Nothing changes unless the .control file for the subject > extension doesn't have a "wildcard_upgrades = true" statement. > > When wildcard upgrades are enabled, a file with a "%" symbol as > the "source" part of the upgrade path will match any version and > will be used if a specific version upgrade does not exist. > This means that in presence of the following files: > > postgis--3.0.0--3.2.0.sql > postgis--%--3.2.0.sql > > The first one will be used for going from 3.0.0 to 3.2.0. > > This is the intention. The patch lacks automated tests and can > probably be improved. > > For more context, a previous (non-working) version of this patch was > submitted to commitfest: https://commitfest.postgresql.org/38/3654/ > > --strk; > > On Sat, Jun 04, 2022 at 11:20:55AM +0200, Sandro Santilli wrote: > > On Sat, May 28, 2022 at 04:50:20PM +0200, Laurenz Albe wrote: > > > On Fri, 2022-05-27 at 17:37 -0400, Regina Obe wrote: > > > > > > > > https://lists.osgeo.org/pipermail/postgis-devel/2022-February/029500.html > > > > > > > > Does anyone think this is such a horrible idea that we should abandon all > > > > hope? > > > > > > I don't think this idea is fundamentally wrong, but I have two worries: > > > > > > 1. It would be a good idea good to make sure that there is not both > > > "extension--%--2.0.sql" and "extension--1.0--2.0.sql" present. > > > Otherwise the behavior might be indeterministic. > > > > I'd make sure to use extension--1.0--2.0.sql in that case (more > > specific first). > > > > > 2. What if you have a "postgis--%--3.3.sql", and somebody tries to upgrade > > > their PostGIS 1.1 installation with it? Would that work? > > > > For PostGIS in particular it will NOT work as the PostGIS upgrade > > script checks for the older version and decides if the upgrade is > > valid or not. This is the same upgrade code used for non-extension > > installs. > > > > > Having a lower bound for a matching version might be a good idea, > > > although I have no idea how to do that. > > > > I was thinking of a broader pattern matching support, like: > > > > postgis--3.%--3.3.sql > > > > But it would be better to start simple and eventually if needed > > increase the complexity ? > > > > Another option could be specifying something in the control file, > > which would also probably be a good idea to still allow some > > extensions to use '%' in the version string (for example). > > > > --strk; --339zka8KxudZ+6RE Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Allow-wildcard-in-extension-upgrade-paths.patch"