dockyard/postgres_ext — pull request #33 by skandragon (2012-10-31 20:32:46+00:00)
Title: Caching encoding didn't work in practice (spams database)

This is not a complete fix, but I recommend it be added as-is nonetheless. This removes a useless call to cache the database encoding when we just don't need it yet, which resulted in a call to PostgreSQL server on EVERY COLUMN CREATION. Yea, ooops.

We still want a more complete fix here. I almost suggest that the connection object cache the encoding, and then we can just call ActiveRecord::Base.connection.encoding each time and rely on it caching things.

Of course, if we need to work with older ActiveRecord, we can't rely on that behavior.