diff options
author | Yasuo Honda <yasuo.honda@gmail.com> | 2017-06-01 13:38:12 +0000 |
---|---|---|
committer | Yasuo Honda <yasuo.honda@gmail.com> | 2017-06-06 13:49:49 +0000 |
commit | eeb83fe9702f861608deab9d6b038f8a510ccc8d (patch) | |
tree | 117dbc3d36c9b7b12bc71624b7bbe23e70f13cc0 | |
parent | d1d39710cc4c525ab8f515eba70cb9ab4134fc64 (diff) | |
download | rails-eeb83fe9702f861608deab9d6b038f8a510ccc8d.tar.gz rails-eeb83fe9702f861608deab9d6b038f8a510ccc8d.tar.bz2 rails-eeb83fe9702f861608deab9d6b038f8a510ccc8d.zip |
PostgreSQL 10 converts unknown OID 705 to text 25
- Rename test cases from `unknown` to `unrecognized` since unknown OID
is one of possible unrecognized types by Rails
- Use "select 'pg_catalog.pg_class'::regclass" whose OID is 2205, which
will not be converted to recognized type in PostgreSQL 10.
activerecord_unittest=# select oid, typname from pg_type where oid in (2205, 2277);
oid | typname
------+----------
2205 | regclass
2277 | anyarray
(2 rows)
Addresses #28868
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index bfc763e1ef..76e0ad60fe 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -324,13 +324,13 @@ module ActiveRecord reset_connection end - def test_only_reload_type_map_once_for_every_unknown_type + def test_only_reload_type_map_once_for_every_unrecognized_type silence_warnings do assert_queries 2, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 1, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 2, ignore_none: true do @connection.select_all "SELECT NULL::anyarray" @@ -340,13 +340,13 @@ module ActiveRecord reset_connection end - def test_only_warn_on_first_encounter_of_unknown_oid + def test_only_warn_on_first_encounter_of_unrecognized_oid warning = capture(:stderr) { - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" } - assert_match(/\Aunknown OID \d+: failed to recognize type of 'anyelement'\. It will be treated as String\.\n\z/, warning) + assert_match(/\Aunknown OID \d+: failed to recognize type of 'regclass'\. It will be treated as String\.\n\z/, warning) ensure reset_connection end |