Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJbYY-005pRP-IX for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 16:19:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJbYV-00Fx3g-DL for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 16:19:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJbYV-00Fx3X-2O for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 16:19:35 +0000 Received: from fout3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJbYT-001wP5-19 for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 16:19:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 5A3971380252; Tue, 18 Jun 2024 12:19:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 18 Jun 2024 12:19:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1718727572; x=1718813972; bh=Gc2fAVxJbj3Ghf0PZYmxcr0Yt5G9i14W2gGOkuSZwWc=; b= qDwMOlj02ZgmBbvFrt//JuK7KB5wntu/l5yIqfWZcnhS50ymQMT7tbEWN6ZXzJfF sTlJKu/k29SgprsfIAUQOaZltrNx/2t9T00dabfGdz/1EO4ml3JG8fRkoBX0PUZb JiHG+YYbYMcIe++gYqUVUvpp3QcZ/ZxZctXpS3c2/FiAa20CSsLAwMP1eTY9XNb+ xYN6lpcdTUl61XFkjol3kYSNYjsEgQcZ1mtLJWuIU4Lt5hVh/gXz/LPSsyYTufNx j582XJrDkuGmbeMCP/wbhLBXElZgnDiqggoeZq1s0OgklstbbibYKqzTFZrLPVH1 o9I5RV+EVipNh5EhCBt1gg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1718727572; x= 1718813972; bh=Gc2fAVxJbj3Ghf0PZYmxcr0Yt5G9i14W2gGOkuSZwWc=; b=s Nv/4Y2bPqPDOn8OjDEX0I5XIqUmf9PE/iLXuez9E/LOlTUQYa5Ys+OBEa3wnglut mnrjjlE3/FgW/q+TC7fJdB2EPQkx3XKTtlS2ZM4SO1Lbc7xEoP+olDbK4Pk/2XF1 jByYK4x98DQPiNuUeVadKcxc04tXrDcLBBjUIIfc2nDEtASGnCFnetTjaPP5srr0 0bDmpnloMBVzXY6jNUiK0xmyTzFSGAUN15TCLwtKM3Ar/NMDp1fbmXYpEjoMzL5N 5GgonqL0aLppX3iTB+iX3foAYvdLd+6H3mZVJswefHXAHF4Hm+DsiA2pewjg2NVm I379b0CvtzouPnJd1cTOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvkedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeekfeehuddvjeeigfeifeejtdduudffledvfeelheef tdeiffeugfdvkeelgedtvdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jun 2024 12:19:31 -0400 (EDT) Message-ID: Date: Tue, 18 Jun 2024 09:19:30 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: set search_path "$owner". And name versus literal for schemas. To: Dominique Devienne , pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/18/24 01:35, Dominique Devienne wrote: > Hi. Two things related to the search_path. > > First, [the doc][1] mentions one can use a variable like "$user" for > the search_path. But setting the search_path is also for FUNCTIONs and > PROCEDUREs, and there what I really REALLY would like, is the ability > to use "$owner", to limit the search_path to the OWNER schema of that > func/proc, instead of having to explicitly spell it out. When I want > to *clone* a schema, having to "patch" the search_path of all those > funcs/procs (to replace the old schema with the new one), is a real > PITA. > > Has this ever been considered? And if so, why was it refused? > It would simplify my life so much, I wonder why this doesn't already exist. I could see this. I would choose something other then $owner as you are not really concerned with the func/proc owner but it's location. Something like $home would seem more on point. > > Second, and related to the first point, when I introspect a schema, > the search_path > of functions/procedures seems to be rewritten with literals, instead of names. > Even the doc uses names, so why is it rewritten as literals? Or > accepts both in fact. > > To actually simplify schema cloning, the introspected proc/func > search_path should remain "$owner" (or '$owner' I guess...) and not be > expanded. Otherwise we'd back to "manual" patching of the search_path, > which again is a PITA. > > I'm curious to hear/read what PostgreSQL experts have to say on this subject. > > Thanks, --DD > > [1]: https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH > > -- Adrian Klaver adrian.klaver@aklaver.com