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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

PG Doc comments form
The following bug has been logged on the website:

Bug reference:      15993
Logged by:          Alexander Pavlov
Email address:      [hidden email]
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;