我需要编写一个从PostgreSQL数据库输出数据的脚本,我不知道这个结构。什么查询将返回数据库中所有表的名称?什么查询将列出表中所有列的名称?
SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog','information_schema'); SELECT column_name FROM information_schema.columns WHERE table_name = 'YourTablesName';
该页面有一些关于从information_schema:http://www.alberton.info/postgresql_meta_info.html检索信息的好消息