Global Variables in Postgresql
Example:
create or replace function glb(code text)
returns integer language sql as $$
select coalesce( (select current_setting('glb.'||code,true)::integer), 0);
$$;
set glb.user_not_found to -1;
set glb.user_does_not_have_permission to -2;
select glb('user_not_found'), glb('user_does_not_have_permission');