Skip to content
This repository
Browse code

Fix postgres bug when change_column is called with invalid parameters. [

#861 state:resolved]

Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 0d74e72e6de7b96e158950a449ea1ccce6f5b8d7 1 parent 49c0e1e
Miles Georgi authored August 17, 2008 lifo committed August 21, 2008
3  activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -761,7 +761,8 @@ def change_column(table_name, column_name, type, options = {})
761 761
 
762 762
         begin
763 763
           execute "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
764  
-        rescue ActiveRecord::StatementInvalid
  764
+        rescue ActiveRecord::StatementInvalid => e
  765
+          raise e if postgresql_version > 80000
765 766
           # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it.
766 767
           begin
767 768
             begin_db_transaction

0 notes on commit 0d74e72

Please sign in to comment.
Something went wrong with that request. Please try again.