问题
Hi Im trying to set the client_min_messages = error to a role using the postgres user, but when I login in the role I check current_setting('client_min_messages') and I get DEFAULT VALUE (notice). Ive already tried restarting config and also done some tests.
To summarize I did:
- Login with postgres role.
- check default values of client_min_messages(notice) and log_min_messages(warning).
- ALTER ROLE anne SET client_min_messages = error;
- ALTER ROLE anne SET log_min_messages = panic;
- SELECT pg_reload_conf();
- Logout postgres.
- Login anne.
- check SELECT current_setting('client_min_messages'), returning NOTICE(default value).
- check SELECT current_setting('log_min_messages'), returning panic(non default value).
- Test the code below
begin;
do $$
begin
raise info ' client_min_messages: %',current_setting('client_min_messages'); -- i get "notice"
raise debug ' time : %', NOW();
raise notice ' time : %', NOW();
raise warning ' time : %', NOW();
end $$;
I mean, I have to set client_min_messages every time I log with an user? So the Alter Role/User SET client_min_messages is useless?
I've tried changing login_min_messages to an specific role and when I login with the role the configuration remains ok(not default value).
回答1:
The method should work. It worked for me.
Do you have any environment variables (like PGOPTIONS) set or explicit call out of the set client_min_messages
command in the session?
来源:https://stackoverflow.com/questions/61256250/set-client-min-messages-to-specific-role-postgres