aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Georgi <azimux@gmail.com>2008-08-17 23:45:25 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-20 13:25:49 -0700
commit09343166ac213e5fcbd3eb5b21d44606b56afa62 (patch)
tree5bb8d124d41807a2dda272a08a62c98b47b0dd4d
parent3a2ff17af66dfb135ead212de458e7f6860c8004 (diff)
downloadrails-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.rb3
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