Hello!
I've been trying to find a way to prevent these crashes after running rake db:migrate:
ActiveRecord::PreparedStatementCacheExpired: ERROR: cached plan must not change result type
This sometimes happens when my migration adds a new column to a table, but my deploy hadn't finished restarting the Rails server. I think it happens if I run migrations in the middle of a transaction that is already in progress, and this causes my controller action to crash.
I saw the the pgjdbc driver for Java can automatically handle this case with the following option: autosave=conservative
(From StackOverflow.) I'm not 100% sure how this works, but it sounds like the pgjdbc driver can automatically flush the cached plan and handle this case without any errors.
Is there an equivalent setting for the pg driver for Ruby? Or is this something that could be handled further up the stack (e.g. in ActiveRecord, or in my own application?)
Best,
Nathan