If your Postgresql database has multiple schema, then functions such as rake db:schema:dump fail.
This seems to be due to a faulty PostgreSQLAdapter.tables method, which doesn't currently strip trailing and leading spaces. Consequently, when multiple schema are present, the query being executed to determine the table names is matching strings which include leading spaces.
Eg: in my case I ended up having an additional 'mediawiki' schema in addition to 'public' after installing mediawiki, and this meant the ConnectionAdapter was calling:
SELECT tablename
FROM pg_tables
WHERE schemaname IN ('mediawiki',' public')
instead of
SELECT tablename
FROM pg_tables
WHERE schemaname IN ('mediawiki','public')
The attached patch corrects this minor but annoying defect.