在没有模式的名称的不同模式的PostgreSQL中加入两个表格

发布于 2025-02-13 23:07:12 字数 325 浏览 0 评论 0原文

如何在没有模式名称的情况下在不同的模式中加入两个表?

考虑两个模式,有人桌的用户和带宠物桌的动物。 人和宠物桌具有相同的列ID_Person。

如果我运行此查询:

SELECT pet.name FROM person p
INNER JOIN pet a ON p.id_person = a.id_person

我会收到此错误:“错误:关系“人”不存在”。

我知道我可以为人和宠物指定架构,这是作品,但是在另一种情况下,我看到了没有模式名称的此类查询。

我也知道该模式没有任何看法。

感谢您的帮助。

How it's possible to join two tables in different schemas without the schema's name?

Consider two schemas, USERS with Person table and ANIMALS with Pet Table.
Person and Pet tables have the same column id_person.

If I run this query:

SELECT pet.name FROM person p
INNER JOIN pet a ON p.id_person = a.id_person

I get this error: "ERROR: relation "person" does not exist".

I know that I can specify the schema for Person and Pet, and it's works, but in an other case I've seen a query like this work without schemas name.

I know also that the schemas have no views.

Thanks for your helping.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文