SQL function error

Hello Everyone,

Version 1.13

Sems 1.162.2

Sems unable to find check_states function in database schema switch21

I checked that function exist
I checked that USAGE on schema and EXCUTE on function,

The request if possible to add self healing monitor schema with auto correction. That will help with such conditions and schema skews.
db=# \sf switch21.check_states()
CREATE OR REPLACE FUNCTION switch21.check_states()
RETURNS TABLE(trusted_lb bigint, ip_auth bigint, stir_shaken_trusted_certificates bigint, stir_shaken_trusted_repositories bigint, stir_shaken_signing_certificates bigint, sensors bigint, translations bigint, codec_groups bigint, registrations bigint, radius_authorization_profiles bigint, radius_accounting_profiles bigint, auth_credentials bigint, options_probers bigint)
LANGUAGE plpgsql
COST 10 ROWS 100
AS $function$
BEGIN
RETURN QUERY
SELECT
(select value from sys.states where key = 'load_balancers'),
(select value from sys.states where key = 'customers_auth'),
(select value from sys.states where key = 'stir_shaken_trusted_certificates'),
(select value from sys.states where key = 'stir_shaken_trusted_repositories'),
(select value from sys.states where key = 'stir_shaken_signing_certificates'),
(select value from sys.states where key = 'sensors'),
(select value from sys.states where key = 'translations'),
(select value from sys.states where key = 'codec_groups'),
(select value from sys.states where key = 'registrations'),
(select value from sys.states where key = 'radius_authorization_profiles'),
(select value from sys.states where key = 'radius_accounting_profiles'),
(select value from sys.states where key = 'auth_credentials'),
(select value from sys.states where key = 'options_probers');
END;
$function$
db=#

2026-09-29T12:07:08.281793-04:00 ``domain.com``; sems[51260]: [#a1df6c0] [onError, postgresql:PoolWorker.cpp:276] ERROR: Error of transaction '0x7f11480862b0/SELECT * FROM check_states()' : ERROR: function check_states() does not exist#012LINE 1: SELECT * FROM check_states()#012 ^#012HINT: No function matches the given name and argument types. You might need to add explicit type casts.
2026-09-29T12:07:08.282193-04:00 ``domain.com``; sems[51260]: [#a1df6c0] [onErrorTransaction, postgresql:PoolWorker.cpp:842] ERROR: pg connection routing/master:0x7f11480105c0/domain.com;:5434/sbcprod transaction error: 'ERROR: function check_states() does not exist#012LINE 1: SELECT * FROM check_states()#012 ^#012HINT: No function matches the given name and argument types. You might need to add explicit type casts.#012', transaction size:1, query:SELECT * FROM check_states()
2026-09-29T12:07:08.282241-04:00 ``domain.com``; sems[51260]: [#a1df6c0] [onErrorCode, postgresql:PoolWorker.cpp:290] ERROR: error code: "42883"

It looks like incorrect sems configuration.

That will help with such conditions and schema skews.

There is no such thing as schema skews. Schema modified only by database migrations.

How to make sure that not going to happened ?
What is suggestion to keep schema and permissions in tacked.

There are no proofs that issue caused by schema. You said you have function in database, so probably your sems configured incorrectly - for example connected to completely different database instance.

What is suggestion to keep schema and permissions in tacked.

Suggestion is very simple - do not modify database objects manually.