Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clearsearch_path - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clearsearch_path
Date
Msg-id 20190927173241.GI31412@momjian.us
Whole thread Raw
In response to BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path
List pgsql-bugs
On Fri, Sep  6, 2019 at 08:42:02PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      15993
> Logged by:          Alexander Pavlov
> Email address:      alexander.pavlov.rus@gmail.com
> PostgreSQL version: 10.9
> Operating system:   Debian
> Description:        
> 
> -- this will correctly create function with empty search_path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL;
> 
> -- this will correctly update function to have "PUBLIC, MY_SCHEMA" search
> path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL SET SEARCH_PATH TO PUBLIC, MY_SCHEMA;
> 
> -- this will correctly update function to have "MY_SCHEMA" search path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL SET SEARCH_PATH TO MY_SCHEMA;
> 
> -- this will NOT update function to have empty search path, search path will
> remain "MY_SCHEMA", as at previous "create or replace" call
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL;

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?
It it part of the "OR REPLACE" goal?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +



pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #15991: Troubles about Management Tools for Postgre.
Next
From: Bruce Momjian
Date:
Subject: Re: erro in Instaling PostegreSQL 11