Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDuU4-0003Zt-3G for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Sep 2019 17:56:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDuU2-0002n6-UN for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Sep 2019 17:56:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDuU2-0002kF-Ks for pgsql-bugs@lists.postgresql.org; Fri, 27 Sep 2019 17:56:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDuU0-0005n0-5D for pgsql-bugs@lists.postgresql.org; Fri, 27 Sep 2019 17:56:46 +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 x8RHudRh016368; Fri, 27 Sep 2019 13:56:39 -0400 From: Tom Lane To: Bruce Momjian cc: alexander.pavlov.rus@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path In-reply-to: <20190927173241.GI31412@momjian.us> References: <15993-a0c0026150beb40a@postgresql.org> <20190927173241.GI31412@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Fri, 27 Sep 2019 13:32:41 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16366.1569606999.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 27 Sep 2019 13:56:39 -0400 Message-ID: <16367.1569606999@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bruce Momjian writes: > So you are saying that CREATE OR REPLACE FUNCTION should not preserve > the SEARCH_PATH. Makes sense to me. Any idea why we coded it this way? We didn't. For me, it works as expected: ... follow example, \sf after each step regression=3D# \sf my_func CREATE OR REPLACE FUNCTION public.my_func() RETURNS boolean LANGUAGE plpgsql SET search_path TO 'my_schema' AS $function$ BEGIN RETURN TRUE;END;$function$ regression=3D# CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$= BEGIN RETURN regression$# TRUE;END;$$ LANGUAGE PLPGSQL; CREATE FUNCTION regression=3D# \sf my_func CREATE OR REPLACE FUNCTION public.my_func() RETURNS boolean LANGUAGE plpgsql AS $function$ BEGIN RETURN TRUE;END;$function$ regards, tom lane