diff options
author | Victor Costan <costan@gmail.com> | 2012-11-19 22:38:19 -0500 |
---|---|---|
committer | Victor Costan <costan@gmail.com> | 2012-11-20 10:59:40 -0500 |
commit | a8a60e92409620f795d04bc720f1dd120d6ec7e2 (patch) | |
tree | 197153a76cd2821e8ceaed32c948e02ac9923064 /activerecord/lib | |
parent | abb38feac84da59f6686d9abcce61d2a9a64efa9 (diff) | |
download | rails-a8a60e92409620f795d04bc720f1dd120d6ec7e2.tar.gz rails-a8a60e92409620f795d04bc720f1dd120d6ec7e2.tar.bz2 rails-a8a60e92409620f795d04bc720f1dd120d6ec7e2.zip |
Postgresql doesn't accepts limits on text columns.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 82a0b662f4..f0a03a2a37 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -396,6 +396,13 @@ module ActiveRecord when nil, 0..0x3fffffff; super(type) else raise(ActiveRecordError, "No binary type has byte size #{limit}.") end + when 'text' + # PostgreSQL doesn't support limits on text columns. + # The hard limit is 1Gb, according to section 8.3 in the manual. + case limit + when nil, 0..0x3fffffff; super(type) + else raise(ActiveRecordError, "The limit on text can be at most 1GB - 1byte.") + end when 'integer' return 'integer' unless limit |