Re: [Rails-core] Prepared statements and postgreSQL schemas

2011-10-05 Thread Juan Manuel Cuello
I created a pull request: https://github.com/rails/rails/pull/3232 That patch works for me. On Wed, Oct 5, 2011 at 10:32 AM, Bradley wrote: > I'm interested to see how this would affect my > gem for > multi-tenancy in Rails. I haven't had a chance

Re: [Rails-core] Prepared statements and postgreSQL schemas

2011-10-05 Thread Bradley
I'm interested to see how this would affect my gem for multi-tenancy in Rails. I haven't had a chance to try out Rails 3.1 yet unfortunately, but by the sounds of it, this would totally break it. Have you issued a pull request or talked to the Core

Re: [Rails-core] Prepared statements and postgreSQL schemas

2011-09-13 Thread Juan Manuel Cuello
Yes, that should do the trick, but that workaround could be avoided if we include the current schema as part of the statement's key. Something like: # postgresql_adapter.rb def exec_cache(sql, binds) sql_key = "#{schema_search_path}-#{sql}" unless @statements.key? sql_key nextkey = @state

Re: [Rails-core] Prepared statements and postgreSQL schemas

2011-09-13 Thread Ken Collins
Perhaps if you do something like change schemas, you should clear the caches which deallocates the statements too. If I am reading the code right, ActiveRecord's #reset_column_information will go down to the connection and call #clear_cache! and hence that will deallocate the statements from th

[Rails-core] Prepared statements and postgreSQL schemas

2011-09-13 Thread Juan Manuel Cuello
Hi guys. 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