Change the default schema for a user
create schema bla;
-- then create table table_name into this schema
Then I want to change the default schema for user (user postgres
)
I do: ALTER ROLE postgres SET search_path TO bla;
(request returned successfully with no result).
When I try SELECT * FROM table_name
it gives an errorrelation "table_name" does not exist
SELECT * FROM bla.table_name
Works great though .
What's wrong in my attempt to change the default schema for a user?
source to share
I think you need to reconsider this. With ALTER USER ... SET
you change
Default Parameters for Configuration Variables at Run Time
Also from the ALTER ROLE SET
manual :
Role-specific variable settings only take effect at login;
But don't apply the changes to the current session. If you want an immediate change, use:
SET search_path TO bla;
It will change the path at the session level
source to share