PostgreSQL 查找当前数据库的所有表

实现的功能类似MySQL:

show tables;

在 PostgreSQL 中需要写:

select * from pg_tables where schemaname = 'public';

返回结果类似如下:

schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers | rowsecurity ------------+-----------+------------+------------+------------+----------+-------------+------------- public     | deploy    | postgres   |            | t          | f        | f           | f public     | deploy2   | postgres   |            | f          | f        | f           | f(2 rows)

未经允许不得转载!PostgreSQL 查找当前数据库的所有表