I’m using a postgreSQL with multiple schemas. To change between schemas I use the ‘SET schema TO …’ statement. That works ok in rails 3.0.
Rails 3.1 uses prepared statements and does not take into account the ‘schema_search_path’. This is a big problem because the statement is prepared once and then the same prepared statement is executed many times no matter if you changed the schema, i.e, the prepared statement is executed ALWAYS for the same schema, the one set when the statement was prepared.
I migrated yesterday from 3.0 to 3.1 and ended up with all my new data (INSERT operations) into the same schema.
‘exec_cache’ method in postgresql_adapter.rb uses the sql string as the cache key. Maybe we could include also the ‘schema_search_path’.
I didn’t want to go into details here, but I could create an issue or a pull request if this approach seems reasonably.