获取包含特定表名的所有模式的列表

时间:2017-04-19 15:32:31

标签: sql database postgresql search schema

我看过这些问题:

但他们都没有完全回答我的问题。我正在尝试搜索整个PostgreSQL数据库并列出其中包含“组”表的每个模式的名称。

我在想:

SELECT * FROM information_schema.tables WHERE table_name='groups';

但是仍然缺少如何获取包含模式。

1 个答案:

答案 0 :(得分:4)

SELECT DISTINCT table_schema
  FROM information_schema.tables
 WHERE table_name='yourtablename';