PostgreSQL查询列出所有表名? [英] PostgreSQL query to list all table names?

查看:2317
本文介绍了PostgreSQL查询列出所有表名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何查询可列出我的Postgres DB中的所有表。

Is there any query available to list all tables in my Postgres DB.

我尝试了一个查询,例如:

I tried out one query like:

SELECT table_name FROM information_schema.tables
                      WHERE table_schema='public' 

但是此查询还会返回视图。

But this query returns views also.

我如何仅获取表名,而不获取视图?

How can i get only table names only, not views?

推荐答案

此查询有何用处(基于手册)?

What bout this query (based on the description from manual)?

SELECT table_name
  FROM information_schema.tables
 WHERE table_schema='public'
   AND table_type='BASE TABLE';

这篇关于PostgreSQL查询列出所有表名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆