mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
PostgreSQL, warn once per connection per missing OID. Closes #14275.
[Yves Senn & Matthew Draper]
This commit is contained in:
parent
0c9bbc6326
commit
9f62344d95
3 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
* PostgreSQL adapter only warns once for every missing OID per connection.
|
||||
|
||||
Fixes #14275.
|
||||
|
||||
*Matthew Draper*, *Yves Senn*
|
||||
|
||||
* PostgreSQL adapter automatically reloads it's type map when encountering
|
||||
unknown OIDs.
|
||||
|
||||
|
|
|
@ -565,8 +565,8 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
type_map.fetch(oid, fmod) {
|
||||
warn "unknown OID #{oid}: failed to recognize type of #{column_name}"
|
||||
OID::Identity.new
|
||||
warn "unknown OID #{oid}: failed to recognize type of '#{column_name}'. It will be treated as String."
|
||||
type_map[oid] = OID::Identity.new
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -385,6 +385,17 @@ module ActiveRecord
|
|||
reset_connection
|
||||
end
|
||||
|
||||
def test_only_warn_on_first_encounter_of_unknown_oid
|
||||
warning = capture(:stderr) {
|
||||
@connection.select_all "SELECT NULL::anyelement"
|
||||
@connection.select_all "SELECT NULL::anyelement"
|
||||
@connection.select_all "SELECT NULL::anyelement"
|
||||
}
|
||||
assert_match(/\Aunknown OID \d+: failed to recognize type of 'anyelement'. It will be treated as String.\n\z/, warning)
|
||||
ensure
|
||||
reset_connection
|
||||
end
|
||||
|
||||
private
|
||||
def insert(ctx, data)
|
||||
binds = data.map { |name, value|
|
||||
|
|
Loading…
Reference in a new issue