This kind of stuff tends to be a but version dependant, but there are two basic approaches you can take, one is to use the information_schema, which is a part of the SQL spec, and therefore not likely to change in future versions, or the system catalogs.
While the information_schema is a bit obtuse at first when you're trying to figure it out, it's not too bad. From the psql prompt, just do this:
set search_path='information_schema';
\d
and you'll see a long list of the things in the information schema. Schemas, and therefore the information_schema, were introduced in 7.3, so if you're on an older version of postgresql this won't work.
To use the built in system catalogs, which are almost guaranteed to change a fair bit from version to version, start psql with the -E switch, which will make it display all the backend queries used by the \ series commands, like \d etc...