aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-09 04:41:28 +0900
committerGitHub <noreply@github.com>2019-04-09 04:41:28 +0900
commita497ece3f7046123cb7fe6720f08d40e4ca6019d (patch)
treec60622ef2aa070d520114cc0c321ae1196c5c2cc /activerecord/lib/active_record/connection_adapters/postgresql
parent35d388b2e9639e5f1c1db032ded04dd5cda7bceb (diff)
parent20da6c7eac90526e1f93f8463bd5e12d1e6203a3 (diff)
downloadrails-a497ece3f7046123cb7fe6720f08d40e4ca6019d.tar.gz
rails-a497ece3f7046123cb7fe6720f08d40e4ca6019d.tar.bz2
rails-a497ece3f7046123cb7fe6720f08d40e4ca6019d.zip
Merge pull request #35887 from kamipo/argument_error
Raise `ArgumentError` for invalid `:limit` and `:precision` like as other options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb6
1 files changed, 3 insertions, 3 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 5f27cb0793..c412d1f34c 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -548,21 +548,21 @@ 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}. The limit on binary can be at most 1GB - 1byte."
+ else raise ArgumentError, "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, "No text type has byte size #{limit}. The limit on text can be at most 1GB - 1byte."
+ else raise ArgumentError, "No text type has byte size #{limit}. The limit on text can be at most 1GB - 1byte."
end
when "integer"
case limit
when 1, 2; "smallint"
when nil, 3, 4; "integer"
when 5..8; "bigint"
- else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with scale 0 instead.")
+ else raise ArgumentError, "No integer type has byte size #{limit}. Use a numeric with scale 0 instead."
end
else
super