Connect to the database server, switch to Postgres (or other user database), the
psql-- command line terminal into the database, perform the following operations related queries:
Display Database:
\l
Connect to the specified database:
\ C database name
View the current instance under the table:
\dt
By way sql statement query:
SELECT tablename FROM pg_tables;
Lookup table structure and field information a particular table
\ D tablename-- actual table name
By way sql statement query:
SELECT a.attnum, a.attname AS field, t.typname AS type, a.attlen AS length, a.atttypmod AS lengthvar , a.attnotnull AS notnull, b.description AS comment FROM pg_class c, pg_attribute a LEFT JOIN pg_description b ON a.attrelid = b.objoid AND a.attnum = b.objsubid, pg_type t WHERE c.relname = '实际的表名' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY a.attnum;