Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: alexander(dot)pavlov(dot)rus(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path
Date: 2019-09-27 17:56:39
Message-ID: 16367.1569606999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> 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=# \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=# CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
regression$# TRUE;END;$$ LANGUAGE PLPGSQL;
CREATE FUNCTION
regression=# \sf my_func
CREATE OR REPLACE FUNCTION public.my_func()
RETURNS boolean
LANGUAGE plpgsql
AS $function$ BEGIN RETURN
TRUE;END;$function$

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2019-09-27 21:35:46 Re: BUG #15929: logical decoding can not write down the analyse result when the output file is touched.
Previous Message Bruce Momjian 2019-09-27 17:34:34 Re: erro in Instaling PostegreSQL 11