Timur,
There was a postgres SchemaProvider published here in August of 2006 by a user Thav. I've looked at the source code, and it may provide some insight to you into the inner workings of the PostgreSQL schema tables, particularly the queries used in his GetForeignKeys and GetReferenceKeys methods which are called by his GetTableKeys method.
postgres_provider.zip
Fwiw, his provider gives me a null reference exception in his Add call at the end of the GetForeignKeys method, so watch out there. I've looked at your code, and you have pretty much the same things he does, except you need the foreignKeyTableOwner, foreignKeyTable, primaryKeyTableOwner, and primaryKeyTable strings filled in for your call to the TableKeySchema constructor in your Add call. Is this correct, or not?
I am very interested in getting a Postgres SchemaProvider going for Codesmith, as we use Postgres a great deal at my work. I'm very surprised that Codesmith would provide a SchemaProvider for MYSQL and not for PostgreSQL. That is the only thing that has prevented us from purchasing Codesmith so far.
I am certainly not an expert on the inner workings of PostgreSQL, but if I can be of assistance in your project, please let me know.