DROP SCHEMA IF EXISTS MyTestBugSchema02 CASCADE;
CREATE SCHEMA MyTestBugSchema02;

CREATE OR REPLACE FUNCTION MyTestBugSchema02.afunction( pInput text ) 
returns text
AS $$
begin
 return 'base'; 
END $$ language plpgsql;




DROP SCHEMA IF EXISTS MyTestBugSchema01 CASCADE;
CREATE SCHEMA MyTestBugSchema01;

CREATE OR REPLACE procedure MyTestBugSchema01.baseProc() 
AS $$
declare 
 vr text;
begin
 vr := MyTestBugSchema02.afunction( 'test' )  ; 
END $$ language plpgsql;





DROP SCHEMA IF EXISTS MyTestBugSchema02 CASCADE;
CREATE SCHEMA MyTestBugSchema02;

CREATE OR REPLACE FUNCTION MyTestBugSchema02.afunction( pInput text ) 
returns text
AS $$
begin
 return 'overwrite'; 
END $$ language plpgsql;


select *
from pg_proc p
where not exists (
 select 1 
 from pg_catalog.pg_namespace
 where oid = p.pronamespace
);
