Show tables in PostgreSQL
PostgreSQL中show tables (来自MySQL)的替代方法有哪些?
From the psql command line interface, this shows all tables in the current schema:
dt
Programmatically (or from the psql interface too, of course):
SELECT * FROM pg_catalog.pg_tables;
The system tables live in the pg_catalog database.
Login as superuser:
sudo -u postgres psql
You can list all databases and users by l command, (list other commands by ? ).
Now if you want to see other databases you can change user/database by c command like c template1 , c postgres postgres and use d , dt or dS to see tables/views/etc.
(For completeness)
You could also query the (SQL-standard) information schema:
SELECT
table_schema || '.' || table_name
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
AND
table_schema NOT IN ('pg_catalog', 'information_schema');
链接地址: http://www.djcxy.com/p/25500.html
上一篇: 删除PostgreSQL中的所有表?
下一篇: 在PostgreSQL中显示表格
