[
From Lorenzo Alberton]
New tutorial on how to retrieve PostgreSQL db metadata from the INFORMATION_SCHEMA when available (PostgreSQL v.7.4 or later), or querying the catalogs (pg_class, pg_user, pg_view, etc) in older pgsql versions.
The guide provides some queries to extract the table structure, triggers, views or constraint definitions, and more.
The article continues at
http://www.alberton.info/postgresql_meta_info.html