Permalink
Browse files

PostgreSQL: fix transaction bug that can occur if you call change_col…

…umn with invalid parameters

[#861 state:resolved]
  • Loading branch information...
1 parent 893d762 commit 6e71a3552921836590ef7b60334cbf92a2f49d1e @azimux azimux committed with tarmo Aug 18, 2008
Showing with 2 additions and 1 deletion.
  1. +2 −1 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -744,7 +744,8 @@ def change_column(table_name, column_name, type, options = {})
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

0 comments on commit 6e71a35

Please sign in to comment.