version ------------------------------------------------------------------------------------------------- PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit (1 row) psql:spbug.psql:3: NOTICE: schema "otherschema" already exists, skipping CREATE SCHEMA psql:spbug.psql:4: NOTICE: schema "thirdschema" already exists, skipping CREATE SCHEMA DROP FUNCTION set_config ------------- otherschema (1 row) CREATE FUNCTION set_config ------------- thirdschema (1 row) psql:spbug.psql:27: NOTICE: SP : otherschema psql:spbug.psql:27: NOTICE: ESP: otherschema execute_show_searchpath ------------------------- (1 row) CREATE OR REPLACE FUNCTION otherschema.execute_show_searchpath() RETURNS void LANGUAGE plpgsql SET search_path TO otherschema AS $function$ DECLARE spvalue text; espvalue text; BEGIN SELECT current_setting('search_path') INTO spvalue; EXECUTE($ex$SELECT current_setting('search_path')$ex$) INTO espvalue; RAISE NOTICE 'SP : %', spvalue; RAISE NOTICE 'ESP: %', espvalue; RETURN; END; $function$