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 1jZkJ9-0002KF-Fc for pgsql-general@arkaria.postgresql.org; Sat, 16 May 2020 00:04:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jZkJ8-0000zv-D3 for pgsql-general@arkaria.postgresql.org; Sat, 16 May 2020 00:04:02 +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 1jZkJ8-0000zk-5R for pgsql-general@lists.postgresql.org; Sat, 16 May 2020 00:04:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZkJ6-00029k-4B for pgsql-general@lists.postgresql.org; Sat, 16 May 2020 00:04:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 04G03uQm019493; Fri, 15 May 2020 20:03:56 -0400 From: Tom Lane To: Rob Sargent cc: "David G. Johnston" , Adrian Klaver , "pgsql-generallists.postgresql.org" Subject: Re: schema agnostic functions in language sql In-reply-to: <23231c96-2ddb-92dd-5539-08925bfcf314@gmail.com> References: <92aa43c7-6b96-ab7f-ddde-61346f957801@gmail.com> <17840.1589586084@sss.pgh.pa.us> <23231c96-2ddb-92dd-5539-08925bfcf314@gmail.com> Comments: In-reply-to Rob Sargent message dated "Fri, 15 May 2020 17:58:46 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19491.1589587436.1@sss.pgh.pa.us> Date: Fri, 15 May 2020 20:03:56 -0400 Message-ID: <19492.1589587436@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Rob Sargent writes: > I cannot create a plain sql function unless the search_path covers any > table mentioned. Not the case when using plpgsql - no path needed. Oh, one of the things that's quite a lot different is the checking applied at function creation time ;-). For a SQL function, by default we'll try to parse and analyze the body, so any unknown tables will draw an error. plpgsql doesn't go further than a very crude syntax check. If you don't like that, you can set check_function_bodies = off while creating your SQL functions. But in any case, it's only related to what happens at execution if the search path is the same. regards, tom lane