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 1otCVY-00064J-Pp for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Nov 2022 18:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1otCVW-0004V0-LK for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Nov 2022 18:42:34 +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 1otCVW-0004Uq-97 for pgsql-hackers@lists.postgresql.org; Thu, 10 Nov 2022 18:42:34 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1otCVT-00070b-HW for pgsql-hackers@postgresql.org; Thu, 10 Nov 2022 18:42:33 +0000 Received: by mail-qk1-x72c.google.com with SMTP id z1so1677285qkl.9 for ; Thu, 10 Nov 2022 10:42:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pcorp-us.20210112.gappssmtp.com; s=20210112; h=content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Y1hmR+yFvNwx+Un21nYATKYMYufES/gPu41LCR7Q1yM=; b=17fWSgbanuDtDs5UXXLKdjXbwH/tpvAfGX1YS7zn7Pppvgf6jthYsrlihYTY4VE0vQ 4frhJ1EVnfRCV4OF/Bbo+bTu/+jW+Hh1PM4YxJbxqT3E8pMqPXGHKYQEhWfW/0nCR3/L RJnrA5HBotHASR+9IP5lSg5OY7ziG2dL6xsauvotrsciN9WdQVB/FIgemXQv5FjCRl+x MQAYabxraqQFOJTMbFJF0L/XJYk/IwdzIY3AZt1qQfNQhM94ycyjhTfTRByiQs3N7dR9 4bSXltHxoaQu7h73KMhtnZpvMS7SPl8pHDorOPA7x1QUNOBCDuLxuVuPeMgNrFpBnKKS TYbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y1hmR+yFvNwx+Un21nYATKYMYufES/gPu41LCR7Q1yM=; b=r8ciHaQ5aTiNFu3Twd4ALMTjrp1R6XbArfQkSn28pj/4alAyA1JLpBmU6rU58NoW93 wR/KuKcRRzl3cI7HVYsDi/OTgNTMKzNA14DrPcvzdUXQtnm+vExbt96qZJD35ZlaCO4I zJjxZpWM+5WzHxPTOL60WJCEPj2nlRSGjVdGJqc6pu6ue/C4n8vkJtb2K+u4aBMaRf7L lDJvZLY4Uyt8ixDNxeYw00hfdj/4nSNIYtfuHFQ6ItOwmUpwm1RHqzTyEtiyMP6ng0ea Km8slTvz6iAi7o7V01g0Utjj6hGD+o/ggJoOVlCBa2hmNi59Tx+nfcl4sp+uIvjKcNlr hi9w== X-Gm-Message-State: ANoB5pkz3+MMGY07qZSJhw+gVj/ueLwDOoSLb8Vj3MV0Bugv3HRWLrLZ VCcBzlXJ41Khiuw1ey0SG5KbsSQu5115pw== X-Google-Smtp-Source: AA0mqf48tpQR2cKfnNOUSe/DWmXPA5Pv1mV9IiQqr05Jc+P9ejQ1KcSQJh2fu21a0iHRtAW9XMYThg== X-Received: by 2002:ae9:e215:0:b0:6fb:a01:d9e1 with SMTP id c21-20020ae9e215000000b006fb0a01d9e1mr9621181qkc.351.1668105749775; Thu, 10 Nov 2022 10:42:29 -0800 (PST) Received: from F (50-78-240-110-static.hfc.comcastbusiness.net. [50.78.240.110]) by smtp.gmail.com with ESMTPSA id bp16-20020a05620a459000b006cbcdc6efedsm42638qkb.41.2022.11.10.10.42.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2022 10:42:29 -0800 (PST) From: "Regina Obe" To: "'Tom Lane'" Cc: References: <003001d8f4ae$402282c0$c0678840$@pcorp.us> <79300.1668052170@sss.pgh.pa.us> <004501d8f4bf$1213fba0$363bf2e0$@pcorp.us> <175298.1668101858@sss.pgh.pa.us> In-Reply-To: <175298.1668101858@sss.pgh.pa.us> Subject: RE: Ability to reference other extensions by schema in extension scripts Date: Thu, 10 Nov 2022 13:42:28 -0500 Message-ID: <000001d8f534$2fd7dc90$8f8795b0$@pcorp.us> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQFgXZxpr0yOB+9uS1Xwc1lFBKthIAHDgsBQATMNnPQCHx2Jfa8A9rVQ Content-Language: en-us List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > "Regina Obe" writes: > >> I have a distinct sense of deja vu here. I think this idea, or > >> something isomorphic to it, was previously discussed with some other > syntax details. > > > I found the old discussion I recalled having and Stephen had suggested > > using @extschema{'postgis'}@ On this thread -- > > https://www.postgresql.org/message- > id/20160425232251.GR10850@tamriel.s > > nowman.net > > Is that the one you remember? > > Hmmm ... no, ISTM it was considerably more recent than that. > [ ...digs... ] Here we go, it was in the discussion around converting contrib SQL > functions to new-style: > > https://www.postgresql.org/message- > id/flat/3395418.1618352794%40sss.pgh.pa.us > > There are a few different ideas bandied around in there. > Personally I still like the @extschema:extensionname@ option the best, > though. > > regards, tom lane I had initially thought of a syntax that could always be used even outside of extension install as some mentioned. Like the PG_EXTENSION_SCHEMA(cube) example. Main benefit I see with that is that even if an extension is moved, all the dependent extensions that reference it would still work fine. I had dismissed that because it seemed too invasive. Seems like it would require changes to the parser and possibly add query performance overhead to resolve the schema. Not to mention the added testing required to do no harm. The other reason I dismissed it is because at least for PostGIS it would be harder to conditionally replace. The issue with PG_EXTENSION_SCHEMA(cube) is we can't support that in lower PG versions so we'd need to strip for lower versions, and that would introduce the possibility of missing PG_EXTENSION_SCHEMA(cube) vs. PG_EXTENSION_SCHEMA( cube ), not a huge deal though, but not quite as easy and precise as just stripping @extschema:extensionname@. References. With the @extschema:extensionname@, it doesn't solve all problems, but the key ones we care about like breakage of functions used in indexes, materialized views, and added security and is a little easier to strip out. I'll work on producing a patch. Thanks, Regina