Change default schema for user

一曲冷凌霜 提交于 2019-12-03 16:58:47

问题


create schema bla;

-- then create table table_name into this schema

Then I want change default schema for user (user is postgres)

I do: ALTER ROLE postgres SET search_path TO bla; (Query returned successfully with no result).

When I try SELECT * FROM table_name gives error relation "table_name" does not exist

Though SELECT * FROM bla.table_name works fine.

What is wrong in my attempt to change default schema for user?


回答1:


I think you need to relogin for that. With ALTER USER ... SET you change

Session defaults for run-time configuration variables

Also from ALTER ROLE SET manual:

Role-specific variable settings take effect only at login;

But don't apply changes to current session. If you want immediate change use:

SET search_path TO bla;

It will change path on session level



来源:https://stackoverflow.com/questions/44429178/change-default-schema-for-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!