[英]How to change default/current schema in sql
Preety basic question from my end that I unfortunately could not find an answer to.不幸的是,我无法找到答案。 In my database I have 2 schemas with their respective tables.
在我的数据库中,我有 2 个模式及其各自的表。 Schema X and schema Y. While I can simply pull the data easily from schema X with
模式 X 和模式 Y。虽然我可以简单地从模式 X 中提取数据
SELECT * FROM employees
I cannot do the same with schema Y, forcing me to use我不能对模式 Y 做同样的事情,迫使我使用
SELECT * FROM SchemaY.customers
My question is, how can I change the current or default schema from X to Y so I can query the tables without the SchemaY.
我的问题是,如何将当前或默认架构从 X 更改为 Y,以便我可以在没有
SchemaY.
情况下查询表SchemaY.
in the table names begining.在表名开头。
Kindest最亲切
Marcin马尔钦
ps: I utilize Postgres and play around in DataGrip. ps:我使用 Postgres 并在 DataGrip 中玩耍。
Change the search path更改搜索路径
set search_path = schemay, public;
You can also do that for your user permanently:您也可以永久为您的用户执行此操作:
alter user current_user
set search_path = schemay, public;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.