Im using this one
SELECT pg_class.relname AS table_name,
pg_attribute.attname AS column_name,
pg_type.typname AS data_type
FROM pg_class,
pg_attribute,
pg_type
WHERE pg_class.relfilenode = pg_attribute.attrelid
AND pg_type.oid = pg_attribute.atttypid
AND pg_class.relname not like 'pg_%'
AND pg_attribute.atttypmod > 0
AND pg_class.reltype > 0
ORDER BY pg_class.relname, pg_attribute.attname