odoo/odoo — pull request #955 by xmo-odoo (2014-07-07 08:11:17+00:00)
Title: Raise exception when a DB request fetched ids it was not asked for

Tries to warn of issues such as 9a9a0b20: Posgres implicitly converts quoted values to anything (apparently they're untyped, just quoted literals) and Python strings are serialized as quoted values, so it's possible to pass the string `"2"` as an id, and postgres will interpret it as `2` and fetch the corresponding record.

In the old API, this would *at most* lead to an extra entry in a cache somewhere (one for `2` and one for `"2"`) and maybe one less cache hit, but in the new API this leads to a cache incoherence: the system looks for a record for id `"2"` but the database fetch filled the cache for id `2`, the low-level system thus keeps trying to get the missing record and ends up blowing the stack.

This is not ideal, I'm trying to see if it's possible to disable implicit conversion in postgres.

@rco-odoo could you check for that?