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 1lWj9y-0003Qr-Kp for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Apr 2021 17:18:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lWj9x-00060x-IA for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Apr 2021 17:18:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWj9x-00060p-7U for pgsql-hackers@lists.postgresql.org; Wed, 14 Apr 2021 17:18:37 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lWj9t-00016o-LD for pgsql-hackers@lists.postgresql.org; Wed, 14 Apr 2021 17:18:36 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d124so14159446pfa.13 for ; Wed, 14 Apr 2021 10:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bG1mSQgiVu4XJD2d+HKanOeJFfzi1PqQuHjAzHICFdY=; b=PZaI6orAfprrTsjE9C/YO9XqU5SqmHMTvJt33jvPpx9EOvbYcmAWPGGrj6jZUoJTdV PfaQ3eFo+TRIpHSSXWOsZQ4f4+/b06iDnowcRonOoJbaNypnsSM96nUyS1zOPM5jl1e3 SOkPG4n0SZHM0nNhM8fZClyJPsEDbHtZjY+xSPa1PfhXCSuDuThWjOnETva1GZTW/J4C IKvbhoXmnN+XQ/CoLiG4HQ6ztRen/2WPdqxfHm2PEnOIXBQ+9lv2fknaWibYJDlDEBxu Z+fSZufSWosA8K7qn4bhHTDCLTb2LYDw82GBOvRomyrntY38AOZTq9hVClXOGrKuqkFl rdNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bG1mSQgiVu4XJD2d+HKanOeJFfzi1PqQuHjAzHICFdY=; b=Sm7NIoMC5iD/8psSclHq83mqn8DtH63JJmD+BTYdBjchCLo2omhgzivqypiPPPf++S bltufW0Zohr4ICMT2TyY6V6ONUI0Kb75eY2FvQk0tL1uuCGrMxxQa+8aZ8aWq5l5E2Ik rt6Yh0s6WANfFPehDH0nDv/g7Onn3j9IdulyGTX3y2kqYP17542jx/KsYQ+xThzmcYzq nxANyUf6sxWPMAk11hODJoYYUu6a/Sf38rJNJsBPNgTo58lyqNbVTCjhfreQcw404KCS xMbUvfcc8RJ+9HYAnWVhVlzihM2V9uM9LCCCjqadohehcnKJMVbvd/57EQFDu6pS07Ra wq1Q== X-Gm-Message-State: AOAM531dRxAz8BMYPVUtnFQyax++/DFKEIzPV3qtloOs56vDB8c465jn 0T8W8V7cN7vEusaMVLNs4IEx0mtCBLVLGwhJW8ONnqD5IuIby0OWdGcmGSiQJ+jRxju6RKski9V 2fxj5q0FybLwhD8VDrkHOqGz4BKPmaU1HROrzVmzv9i2zvDTm6JBPOSPWBFACpomzqqn7OZKDc8 XjopDZiJ9/BSgsnhZl0Hn20jNE+e0VPGvUTJBUMDX1RA7IWMxIN7A/ X-Google-Smtp-Source: ABdhPJwUMNcK7fLhzwD7T2GvsgHVP4M65viy91JZt/Xv6ri5NxOTLIN9FFNCJkPLnK5Aqz8xKd5rrw== X-Received: by 2002:a63:d146:: with SMTP id c6mr39534131pgj.131.1618420711949; Wed, 14 Apr 2021 10:18:31 -0700 (PDT) Received: from laptop280-ma-us.hitronhub.home (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id e12sm61492pfm.29.2021.04.14.10.18.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 10:18:31 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: Converting contrib SQL functions to new style From: Mark Dilger In-Reply-To: <3395418.1618352794@sss.pgh.pa.us> Date: Wed, 14 Apr 2021 10:18:30 -0700 Cc: PostgreSQL Hackers , Peter Eisentraut Content-Transfer-Encoding: quoted-printable Message-Id: References: <3395418.1618352794@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3608.120.23.2.4) X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 13, 2021, at 3:26 PM, Tom Lane wrote: >=20 > However I think we may still need an assumption that earthdistance > and cube are in the same schema --- any comments on that? This is probably not worth doing, and we are already past feature = freeze, but adding syntax to look up the namespace of an extension might = help. The problem seems to be that we can't syntactically refer to the = schema of an extension. We have to instead query = pg_catalog.pg_extension joined against pg_catalog.pg_namespace and then = interpolate the namespace name into strings that get executed, which is = ugly. This syntax is perhaps a non-starter, but conceptually something like: -CREATE DOMAIN earth AS cube +CREATE DOMAIN earthdistance::->earth AS cube::->cube Then we'd perhaps extend RangeVar with an extensionname field and have = either a schemaname or an extensionname be looked up in places where we = currently lookup schemas, adding a catcache for extensions. (Like I = said, probably not worth doing.) We could get something like this working just inside the CREATE = EXTENSION command if we expanded on the @extschema@ idea a bit. At = first I thought this idea would suffer race conditions with concurrent = modifications of pg_extension or pg_namespace, but it looks like we = already have a snapshot when processing the script file, so: -CREATE DOMAIN earth AS cube +CREATE DOMAIN @@earthdistance@@::earth AS @@cube@@::cube or such, with @@foo@@ being parsed out, looked up in pg_extension join = pg_namespace, and substituted back in. =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company