aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-26 02:30:41 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-26 02:34:53 +0900
commit67732efcb658807929be0e968642ee1d90b3c986 (patch)
tree23cccff0890485c9d334cb8ba71d13679ee7a93b /activerecord/lib/active_record/connection_adapters/postgresql
parent7d44d2a4edce4b39a232f83755e38ce1a5279074 (diff)
downloadrails-67732efcb658807929be0e968642ee1d90b3c986.tar.gz
rails-67732efcb658807929be0e968642ee1d90b3c986.tar.bz2
rails-67732efcb658807929be0e968642ee1d90b3c986.zip
Refactor `type_to_sql` to handle converting `limit` to `size` in itself
Also, improving an argument error message for `limit`, extracting around `type_to_sql` code into schema statements, and more exercise tests.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb4
1 files changed, 2 insertions, 2 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 946436f7f9..d694a4f47d 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -548,14 +548,14 @@ module ActiveRecord
# The hard limit is 1GB, because of a 32-bit size field, and TOAST.
case limit
when nil, 0..0x3fffffff; super(type)
- else raise(ActiveRecordError, "No binary type has byte size #{limit}.")
+ else raise ActiveRecordError, "No binary type has byte size #{limit}. The limit on binary can be at most 1GB - 1byte."
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.")
+ else raise ActiveRecordError, "No text type has byte size #{limit}. The limit on text can be at most 1GB - 1byte."
end
when "integer"
case limit