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 1tTrES-00BL2h-UM for pgsql-general@arkaria.postgresql.org; Fri, 03 Jan 2025 23:37:33 +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 1tTrDT-006DpG-Kk for pgsql-general@arkaria.postgresql.org; Fri, 03 Jan 2025 23:36:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tTrDT-006Dp7-7A for pgsql-general@lists.postgresql.org; Fri, 03 Jan 2025 23:36:30 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tTrDQ-0006Rx-25 for pgsql-general@lists.postgresql.org; Fri, 03 Jan 2025 23:36:30 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ef748105deso13839669a91.1 for ; Fri, 03 Jan 2025 15:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735947385; x=1736552185; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Sw/Fn8KN9JSWhMBg775YLF59rbKiKAeYVG+OqWXuIao=; b=SRF9yfyzSXPsbYAhsOPpTWqWD4JjLgeobh5URjwbIXveMYGSzr2JZ9e27DNBXQpd5a vjaqpm+16Fiw/nRK1F8kHMmaXanLek16OOOa12N4T2imwmfsyNfpmD20XZ5gYeycBfGD 6ellJ4EXYOKz72yCaDvDL/rYO+7wPIqQ8Qs/M+ONKb92OIfvZIYWATEXDDJXYZh5oSbz qDFmXQw19jfbZ9F5Rz03KPfLWhx6mf0bGpdi+Hgffcnh0pipU/7MMKRx9FBedCvu9eTS 5QGc1AzQkZ2NIY0RzKfxmGNp4QPRxcq4n4BClISNQ/PE/afTkkEd31hI7CqoXVPCRSxV Qc0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735947385; x=1736552185; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Sw/Fn8KN9JSWhMBg775YLF59rbKiKAeYVG+OqWXuIao=; b=X1WzFUbDZ+FejcQnOUaMCTkdd2aqKgfMxNsou5ciEvjZmVIaI462b+tCYYwLFLjSum 9sY/q9bnZiBB26L27rLcgdtHWeSudWHfUr3rFY0ghSGs1qERnD2QHLuaqWOP7PBJW0iM C623a89C2FAh15ITWi7Qb6tEZ4rFldXO7ZEcsmrkyeb7Ht+NrD0zfkTLiBMhFDqqDj35 FMoJzy6A91Z2sdZIyBcLSBpP5nP1OR7RWjS1ZO9PdFLDWFq2YEKlrFsV7e1jAOYYHSy6 uW2ZrU79enFcD6J8Mjsvk3bBtIfmHyRUkW7M9MouIpYkg4gJA0Wp/nsszSAkuIR6BFVh lkdg== X-Forwarded-Encrypted: i=1; AJvYcCWEFyo360ogka4q40nXw27xUzZqNkvHdmaufmF/e2oeeAL4GYtBkh/LnTMkZV7QIlVBqga5arZlZsW8istV@lists.postgresql.org X-Gm-Message-State: AOJu0YzhwuqZKq7521qkQHEbL28sh0A1aCsqB89hzmP/LgfZqjCGLsbl s5U6Og65ivMgJgNAGJCdaSpGOnE7S5DbW5mfEc198Nd1VqfgQZjNj3dPlo1RQSU0X8GhYBBXXEE OvpPzpfmA8qf/yz0ssETlqIjjhl8= X-Gm-Gg: ASbGncsc4ECp375sKCPe7EbN33g2+aDHhl8EoZ+AfSoYKQldrOfl2LgBMDhKdxLEc3s i/Fi4BqUSzs9GxFGPveygdA8VbStqVf/uCHYQUQ== X-Google-Smtp-Source: AGHT+IE6BRKQ689jycWqEiLjV1yOYymUaophWprnsUtgodM3GtSgMlz3EuQyd4/AexdBlCxI6YFVk4LxeNrF/1Xls3s= X-Received: by 2002:a17:90b:2652:b0:2f2:ab09:c256 with SMTP id 98e67ed59e1d1-2f452f01cd4mr76158050a91.33.1735947385526; Fri, 03 Jan 2025 15:36:25 -0800 (PST) MIME-Version: 1.0 References: <20241227205025.1d059f72c7c08d23c9648c26@magnetkern.de> <20241228004009.267f21b78394c934f27f9974@magnetkern.de> <20250103135332.7910a008714abaa04d32e5e2@magnetkern.de> <20250103174849.f071d9c6942f76a9b812157c@magnetkern.de> <20250103223312.dde69ae482776e4f1b0c2258@magnetkern.de> <14e035fb-ab35-4a73-a637-ad0180067b07@aklaver.com> <20250104002203.2aed83d48d795ce6fbbd3b61@magnetkern.de> In-Reply-To: <20250104002203.2aed83d48d795ce6fbbd3b61@magnetkern.de> From: Isaac Morland Date: Fri, 3 Jan 2025 18:36:13 -0500 Message-ID: Subject: Re: search_path for PL/pgSQL functions partially cached? To: Jan Behrens Cc: Adrian Klaver , "David G. Johnston" , "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000043620d062ad5bffa" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000043620d062ad5bffa Content-Type: text/plain; charset="UTF-8" On Fri, 3 Jan 2025 at 18:22, Jan Behrens wrote: > Instead, I plan to expect the function to receive a query string that > will get the data that is being processed by the function. > > That query string should be allowed to refer to tables in the > search_path at the caller's side. > > Therefore, I cannot use the "SET search_path FROM CURRENT" in my > "CREATE FUNCTION" statement, because it would overwrite the current > search_path on each call of the function. > I wonder if it would help if EXECUTE took an optional search_path to use while executing the query. --00000000000043620d062ad5bffa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, 3 Jan 2025 at 18:22, Jan Behrens = <jbe-mlist@magnetkern.de&= gt; wrote:
= =C2=A0
Instead, I plan to expect the function to receive a query string that
will get the data that is being processed by the function.

That query string should be allowed to refer to tables in the
search_path at the caller's side.

Therefore, I cannot use the "SET search_path FROM CURRENT" in my<= br> "CREATE FUNCTION" statement, because it would overwrite the curre= nt
search_path on each call of the function.

=C2=A0I wonder if it would help if EXECUTE took an optional search_path = to use while executing the query.

--00000000000043620d062ad5bffa--