如何查詢postgreSQL 裏面某個數據庫中所有用戶定義的數據表的名字
@forandever 2011-11-13
1、通過命令行查詢
\d 數據庫 —— 得到所有表的名字
\d 表名 —— 得到表結構
2、通過SQL語句查詢
"select * from pg_tables" —— 得到當前db中所有表的信息(這裏pg_tables是系統視圖)
"select tablename from pg_tables where schemaname='public'" —— 得到所有用戶自定義表的名字(這裏"tablename"字段是表的名字,"schemaname"是schema的名字。用戶自定義的表,如果未經特殊處理,默認都是放在名爲public的schema下)
@for&ever 2011-11-13