diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-08 06:17:53 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-08 06:17:53 +0000 |
commit | 4eaa8ba5bec9001e97349e7dfd565c7215085834 (patch) | |
tree | 5ef58d001fcbb69b36f505fac7bb29d6ba4d4c5e /activerecord/lib | |
parent | 99c64829ce71ecf07b576960ea8ff01dfee61be7 (diff) | |
download | rails-4eaa8ba5bec9001e97349e7dfd565c7215085834.tar.gz rails-4eaa8ba5bec9001e97349e7dfd565c7215085834.tar.bz2 rails-4eaa8ba5bec9001e97349e7dfd565c7215085834.zip |
PostgreSQL: support multiline default values. Closes #7533.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7801 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 331f331de7..a5d550c84b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -160,45 +160,45 @@ module ActiveRecord def self.extract_value_from_default(default) case default # Numeric types - when /^-?\d+(\.\d*)?$/ + when /\A-?\d+(\.\d*)?\z/ default # Character types - when /^'(.*)'::(?:character varying|bpchar|text)$/ + when /\A'(.*)'::(?:character varying|bpchar|text)\z/m $1 # Binary data types - when /^'(.*)'::bytea$/ + when /\A'(.*)'::bytea\z/m $1 # Date/time types - when /^'(.+)'::(?:time(?:stamp)? with(?:out)? time zone|date)$/ + when /\A'(.+)'::(?:time(?:stamp)? with(?:out)? time zone|date)\z/ $1 - when /^'(.*)'::interval$/ + when /\A'(.*)'::interval\z/ $1 # Boolean type - when /^true$/ + when 'true' true - when /^false$/ + when 'false' false # Geometric types - when /^'(.*)'::(?:point|line|lseg|box|"?path"?|polygon|circle)$/ + when /\A'(.*)'::(?:point|line|lseg|box|"?path"?|polygon|circle)\z/ $1 # Network address types - when /^'(.*)'::(?:cidr|inet|macaddr)$/ + when /\A'(.*)'::(?:cidr|inet|macaddr)\z/ $1 # Bit string types - when /^B'(.*)'::"?bit(?: varying)?"?$/ + when /\AB'(.*)'::"?bit(?: varying)?"?\z/ $1 # XML type - when /^'(.*)'::xml$/ + when /\A'(.*)'::xml\z/m $1 # Arrays - when /^'(.*)'::"?\D+"?\[\]$/ + when /\A'(.*)'::"?\D+"?\[\]\z/ $1 # Object identifier types - when /^-?\d+$/ + when /\A-?\d+\z/ $1 else # Anything else is blank, some user type, or some function - # and we can't know the value of that, so return nil. + # and we can't know the value of that, so return nil. nil end end |