Skip to content

Commit

Permalink
Fix postgres bug when change_column is called with invalid parameters. [
Browse files Browse the repository at this point in the history
#861 state:resolved]

Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
azimux authored and lifo committed Aug 21, 2008
1 parent 49c0e1e commit 0d74e72
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -761,7 +761,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
Expand Down

0 comments on commit 0d74e72

Please sign in to comment.