Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Make postgresql faster on development (thanks to @tapajos).

  • Loading branch information...
1 parent 1464742 commit 58ad5e1859caa5e384cc3df2360efc3cfd66c48b @josevalim josevalim committed
8 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -122,6 +122,14 @@ def simplified_type(field_type)
# Extracts the value from a PostgreSQL column default definition.
def self.extract_value_from_default(default)
case default
+ # This is a performance optimization for Ruby 1.9.2 in development.
+ # If the value is nil, we return nil straight away without checking
+ # the regular expressions. If we check each regular expression,
+ # Regexp#=== will call NilClass#to_str, which will trigger
+ # method_missing (defined by whiny nil in ActiveSupport) which
+ # makes this method very very slow.
+ when NilClass
+ nil
# Numeric types
when /\A\(?(-?\d+(\.\d*)?\)?)\z/

0 comments on commit 58ad5e1

Please sign in to comment.
Something went wrong with that request. Please try again.