We are setting up Postgresql 9.5 row level security on a table and need to restrict rows based on session variable.

For example after setting up variable like this

set_config('myvars.user', '100', false);

user can only see rows where user=100.

This seems to be working as required but only issue is how can I restrict user not to set this variable to some other values. I want to force user to call a function once per session and after that user should not be able to change the value of variable.