且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Postgres:是否有查询返回给定用户拥有的表?

更新时间:2023-11-20 22:27:04

您可以在目录。目录是表的集合,其中包含有关正在运行的Postgres实例的元数据。因此,使用SQL进行查询很容易。要查找特定用户拥有的所有表,可以查询 pg_tables 。对于尺寸,您可能必须加入 pg_class

You can look up such information in the catalog. The catalog is a collection of tables containing meta data about a running Postgres instance. Therefore it is easy to query with SQL. To find all tables owned by a particular user you can query pg_tables. For sizes you probably have to join pg_class.