title: Postgresql error while running the migrations on test environment
body: <p>I am running the migrations in the rails test environment as a part of specs suite. When i Run the migrations it throws the below error and I am exactly not sure why is this error occurring, For only one migration Iam running the migration from the backup file like below.</p>
  
  <p><strong>I am using ruby version 1.9.3
  postgres version 9.1.24</strong></p>
  
  <pre><code>class StructureSnapshot &lt; ActiveRecord::Migration
   def up
    execute IO.read("db/sql/20150422144950_structure_snapshot.sql")
   end
  end
  </code></pre>
  
  <p>below is the error when the migrations are run ...</p>
  
  <pre><code>--INSERT INTO schema_migrations (version) VALUES ('20150422144950');
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord- 4.1.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
  /scratch/aime/workspace/SRMA-API Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
  /scratch/aime/workspace/SRMA-API- Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
  /scratch/aime/workspace/SRMA-API- Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
  /scratch/aime/workspace/SRMA-API- Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
  /scratch/aime/installs/ruby-1.9.3-p550/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
  /scratch/aime/workspace/SRMA-API-Rspec/db/migrate/20150422144950_structure_snapshot.rb:3:in `up'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
  /scratch/aime/installs/ruby-1.9.3-p550/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/also_migrate-0.3.6/lib/also_migrate/migrator.rb:24:in `migrate_with_also_migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in &lt;top (required)&gt;'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
  /scratch/aime/installs/ruby-1.9.3-p550/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/gems/rake-10.4.2/bin/rake:33:in `&lt;top (required)&gt;'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
  /scratch/aime/workspace/SRMA-API-Rspec/vendor/bundle/ruby/1.9.1/bin/rake:23:in `&lt;top (required)&gt;'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli/exec.rb:74:in `load'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli/exec.rb:74:in `kernel_load'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli/exec.rb:28:in `run'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli.rb:424:in `exec'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli.rb:27:in `dispatch'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/cli.rb:18:in `start'
  /scratch/aime/installs/ruby-1.9.3-p550/bin/bundle:30:in `block in &lt;main&gt;'
  /scratch/aime/installs/ruby-1.9.3-p550/bundle/gems/bundler-1.16.5/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
  /scratch/aime/installs/ruby-1.9.3-p550/bin/bundle:22:in `&lt;main&gt;'
  </code></pre>