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 1pFY4L-0004cm-5q for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Jan 2023 10:10:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFY4K-0003Ca-0I for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Jan 2023 10:10:52 +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 1pFY4J-0003CR-Ne for pgsql-hackers@lists.postgresql.org; Wed, 11 Jan 2023 10:10:51 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFY4D-00036G-MQ for pgsql-hackers@lists.postgresql.org; Wed, 11 Jan 2023 10:10:51 +0000 Received: (Authenticated sender: strk@kbt.io) by mail.gandi.net (Postfix) with ESMTPSA id 4A3F3C0009; Wed, 11 Jan 2023 10:10:41 +0000 (UTC) Date: Wed, 11 Jan 2023 11:10:40 +0100 From: Sandro Santilli Sender: strk@kbt.io To: Tom Lane Cc: Regina Obe , pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Support % wildcard in extension upgrade filenames Message-ID: <20230111101040.ovihmu4rssefut2o@c19> References: <20221117095734.igldlk6kngr6ogim@c19> <166914379479.1121.7549798686571352890.pgcf@coridan.postgresql.org> <55512.1673304709@sss.pgh.pa.us> <20230110205259.htcuhg3t7shd367d@c19> <387183.1673394631@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <387183.1673394631@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jan 10, 2023 at 06:50:31PM -0500, Tom Lane wrote: > With the proposed % feature, if foo--%--3.0.sql exists then the > system will invoke it and expect the end result to be a valid > 3.0 installation, whether or not the script actually has any > ability to do a downgrade. It is sane, for the system to expect the end result to be a valid 3.0 installation if no exception is thrown by the script itself. If we ship foo--%--3.0.sql we must have been taken care of protecting from unsupported downgrades/upgrades (and we did, having the script throw an exception if anything is unexpected). > (I suppose you could add code to look at pg_extension.extversion, We actually added code looking at our own version-extracting function (which existed since before PostgreSQL added support for extensions). Is the function not there ? Raise an exception. Is the function not owned by the extension ? Raise an exception. In other cases -> trust the output of that function to tell what version we're coming from, throw an exception if upgrade to the target version is unsupported. > to add such code is that really better than having a number of > one-liner scripts implementing the same check declaratively?) Yes, it is, because no matter how many one-liner scripts we install (we currently install 87 * 6 such scripts, we always end up missing some of them upon releasing a new bug-fix release in stable branches. > almost certainly you are > going to end with an extension containing some leftover 4.0 > objects, some 3.0 objects, and maybe some objects with properties > that don't exactly match either 3.0 or 4.0. This is already possible, depending on WHO writes those upgrade scripts. This proposal just gives more expressiveness power to those script authors. > So I really think this is a case of "be careful what you ask > for, you might get it". Even if PostGIS is willing to put in > the amount of infrastructure legwork needed to make such a > design bulletproof, I'm quite sure nobody else will manage > to use such a thing successfully. This is why I initially made this something to be explicitly enabled by the .control file, which I can do again if it feels safer for you. > I'd rather spend our > development effort on a feature that has more than one use-case. Use case is any extension willing to support more than a single stable branch while still allowing upgrading from newer-stable-bugfix-release to older-feature-release (ie: 3.2.10 -> 3.4.0 ). Does not seem so uncommon to me, for a big project. Maybe there aren't enough big extension-based projects out there ? --strk; Libre GIS consultant/developer https://strk.kbt.io/services.html