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 1palWJ-0005Ia-BJ for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Mar 2023 22:47:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1palWH-0006Ml-Gs for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Mar 2023 22:47:25 +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 1palWH-0006Mc-7L for pgsql-hackers@lists.postgresql.org; Fri, 10 Mar 2023 22:47:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1palWE-0004qD-Pr for pgsql-hackers@lists.postgresql.org; Fri, 10 Mar 2023 22:47:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32AMlHwn1019516; Fri, 10 Mar 2023 17:47:17 -0500 From: Tom Lane To: "Regina Obe" cc: "'Gregory Stark \(as CFM\)'" , "'Sandro Santilli'" , pgsql-hackers@lists.postgresql.org, "'Regina Obe'" Subject: Re: Ability to reference other extensions by schema in extension scripts In-reply-to: <005501d953a0$906c4df0$b144e9d0$@pcorp.us> References: <003001d8f4ae$402282c0$c0678840$@pcorp.us> <000401d94bc8$48dff700$da9fe500$@pcorp.us> <167762779361.628976.14009177203307564086.pgcf@coridan.postgresql.org> <005401d95083$26ca24a0$745e6de0$@pcorp.us> <995823.1678478825@sss.pgh.pa.us> <004b01d95394$16123ee0$4236bca0$@pcorp.us> <1012975.1678486476@sss.pgh.pa.us> <005501d953a0$906c4df0$b144e9d0$@pcorp.us> Comments: In-reply-to "Regina Obe" message dated "Fri, 10 Mar 2023 17:35:05 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1019514.1678488437.1@sss.pgh.pa.us> Date: Fri, 10 Mar 2023 17:47:17 -0500 Message-ID: <1019515.1678488437@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Regina Obe" writes: >> requires = 'extfoo, extbar' >> no_relocate = 'extfoo' > So when no_relocate is specified, where would that live? In the control file. > Would I mark the extfoo as not relocatable on CREATE / ALTER of said > extension? > Or add an extra field to pg_extension We don't record dependent extensions in pg_extension now, so that doesn't seem like it would fit well. I was envisioning that ALTER EXTENSION SET SCHEMA would do something along the lines of (1) scrape the list of dependent extensions out of pg_depend (2) open and parse each of their control files (3) fail if any of their control files mentions the target one in no_relocate. Admittedly, this'd be a bit slow, but I doubt that ALTER EXTENSION SET SCHEMA is a performance bottleneck for anybody. > I had tried to do that originally, e.g. instead of even bothering with such > an extra arg, just mark it as not relocatable if the extension's script > contains references to the required extension's schema. I don't think that's a great approach, because those references might appear in places that can track a rename (ie, in an object name that's resolved to a stored OID). Short of fully parsing the script file you aren't going to get a reliable answer. I'm content to lay that problem off on the extension authors. > But then what if extfoo is upgraded? We already have mechanisms for version-dependent control files, so I don't see where there's a problem. regards, tom lane