postgresql:对于给定的表名,什么是模式名称?

时间:2015-06-03 13:43:22

标签: sql postgresql select data-dictionary

我有一个表名学生,我的数据库中有35个模式。 如何获得表学生所在的模式? (在不同的模式中可能有多个)。

我已经尝试了pg_class,但我不知道如何从那里获取架构名称。

1 个答案:

答案 0 :(得分:3)

您可以从information_schema.tables查询:

SELECT table_catalog, table_schema 
FROM   information_schema.tables 
WHERE  table_name = 'student'