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 +