diff options
author | Miles Georgi <azimux@gmail.com> | 2008-08-17 23:45:25 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-20 13:25:49 -0700 |
commit | 09343166ac213e5fcbd3eb5b21d44606b56afa62 (patch) | |
tree | 5bb8d124d41807a2dda272a08a62c98b47b0dd4d | |
parent | 3a2ff17af66dfb135ead212de458e7f6860c8004 (diff) | |
download | rails-09343166ac213e5fcbd3eb5b21d44606b56afa62.tar.gz rails-09343166ac213e5fcbd3eb5b21d44606b56afa62.tar.bz2 rails-09343166ac213e5fcbd3eb5b21d44606b56afa62.zip |
PostgreSQL: fix transaction bug that can occur if you call change_column with invalid parameters
[#861 state:resolved]
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 856435517a..74da0d9c85 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -761,7 +761,8 @@ module ActiveRecord begin execute "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" - rescue ActiveRecord::StatementInvalid + rescue ActiveRecord::StatementInvalid => e + raise e if postgresql_version > 80000 # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it. begin begin_db_transaction |