    # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 606
          def change_column(table_name, column_name, type, options = {})
            begin
              execute "ALTER TABLE #{table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
            rescue ActiveRecord::StatementInvalid
              # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it.
              begin_db_transaction
              tmp_column_name = "#{column_name}_ar_tmp"
              add_column(table_name, tmp_column_name, type, options)
              execute "UPDATE #{table_name} SET #{quote_column_name(tmp_column_name)} = CAST(#{quote_column_name(column_name)} AS #{type_to_sql(type, options[:limit], options[:precision], options[:scale])})"
              remove_column(table_name, column_name)
              rename_column(table_name, tmp_column_name, column_name)
              commit_db_transaction
            end

            change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)
            change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)
          end