public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
PostgreSQL: fix transaction bug that can occur if you call change_column with 
invalid parameters

[#861 state:resolved]
azimux (author)
Sun Aug 17 23:45:25 -0700 2008
jeremy (committer)
Wed Aug 20 13:25:49 -0700 2008
commit  09343166ac213e5fcbd3eb5b21d44606b56afa62
tree    5bb8d124d41807a2dda272a08a62c98b47b0dd4d
parent  3a2ff17af66dfb135ead212de458e7f6860c8004
...
761
762
763
764
 
 
765
766
767
...
761
762
763
 
764
765
766
767
768
0
@@ -761,7 +761,8 @@ module ActiveRecord
0
 
0
         begin
0
           execute "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
0
-        rescue ActiveRecord::StatementInvalid
0
+        rescue ActiveRecord::StatementInvalid => e
0
+          raise e if postgresql_version > 80000
0
           # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it.
0
           begin
0
             begin_db_transaction

Comments