Hello
Please try on latest minor 10.5 version. I can not reproduce with my 10.5 version.
Also show your log at the time of error.
postgres=# CREATE SCHEMA test_schema;
CREATE SCHEMA
postgres=# CREATE FUNCTION custom_eq(int, int)
postgres-# RETURNS BOOL
postgres-# LANGUAGE SQL IMMUTABLE AS
postgres-# $$
postgres$# SELECT $1 = $2;
postgres$# $$;
CREATE FUNCTION
postgres=# ALTER FUNCTION custom_eq(int, int) SET SCHEMA test_schema;
ALTER FUNCTION
postgres=# select test_schema.custom_eq(1,2);
custom_eq
-----------
f
regards, Sergei