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
Tarmo Tänav (committer)
Sun Aug 24 09:38:31 -0700 2008
commit  6e71a3552921836590ef7b60334cbf92a2f49d1e
tree    6d978d319740df5ae8d004d91d134eb834d61d1c
parent  893d76251f8dc34c79f43d95a66345ec5e44c466
...
744
745
746
747
 
 
748
749
750
...
744
745
746
 
747
748
749
750
751
0
@@ -744,7 +744,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