aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/explain_registry.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-20 14:14:12 +0900
committerGitHub <noreply@github.com>2017-08-20 14:14:12 +0900
commit1a2fe7e373a67b670ca17e0d91d59bfbe0c48072 (patch)
tree086241c68754a8ba8ecacb0c0358ed4e92883904 /activerecord/lib/active_record/explain_registry.rb
parent770149b02a8327476372f082fc2c7054fb90e688 (diff)
downloadrails-1a2fe7e373a67b670ca17e0d91d59bfbe0c48072.tar.gz
rails-1a2fe7e373a67b670ca17e0d91d59bfbe0c48072.tar.bz2
rails-1a2fe7e373a67b670ca17e0d91d59bfbe0c48072.zip
Register integer types limit correctly for postgresql adapter (#26386)
currently integer types extracts the `limit` from `sql_type`. But the lookup key of type map is the `oid` in postgresql adapter. So in most case `sql_type` is passed to `extract_limit` as `""` and `limit` is extracted as `nil`. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L445 In mysql2 adapter, `limit` is registered correctly without extracting from `sql_type`. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L678-L682 Postgresql adapter should also be registered correctly. ``` ruby conn = ActiveRecord::Base.connection conn.select_all("SELECT 1::smallint, 2::integer, 3::bigint").column_types.map do |name, type| [name, type.limit] end ``` Before: ``` ruby # => [["int2", nil], ["int4", nil], ["int8", nil]] ``` After: ``` ruby # => [["int2", 2], ["int4", 4], ["int8", 8]] ```
Diffstat (limited to 'activerecord/lib/active_record/explain_registry.rb')
0 files changed, 0 insertions, 0 deletions