postgresql 在 Postgres 中跨模式查询

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1463849/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:52:15  来源:igfitidea点击:

Querying across schemas in Postgres

sqlpostgresqlschema

提问by Josh Moore

I am using Postgres and I have multiple schemas (i.e. S1 and S2). I would like to run a query that uses tables in S1 and S2. is it possible to do something like this:

我正在使用 Postgres 并且我有多个模式(即 S1 和 S2)。我想运行一个使用 S1 和 S2 中的表的查询。是否有可能做这样的事情:

select * from S1.table1, S2.table2

Thanks for all replies.

感谢所有回复。

回答by

Yes. And the syntax is exactly how you wrote.

是的。语法正是你写的。

回答by gc5

Indeed, I think that the correct query is:

事实上,我认为正确的查询是:

select * from S1.table1
UNION ALL
select * from S2.table2