summaryrefslogtreecommitdiff
path: root/addons/report/controllers
diff options
context:
space:
mode:
authorxmo-odoo <xmo@odoo.com>2017-04-11 14:51:53 +0200
committerGitHub <noreply@github.com>2017-04-11 14:51:53 +0200
commitca74b5e1c8a48bcdeb396625ec0d8028a5a9d5f1 (patch)
tree80c175e553f62ff6696272e96019c5d64f7fae5f /addons/report/controllers
parenta8994b40754834b62038fcc0540cad766ac9e278 (diff)
[IMP] convert PG errors through pg93 diag info
Previously availability of meta-information (failing constraint, impacted table and column, …) in pg errors (e.g. constraint check failure) was limited and only available through formatted error messages, which could be localised (by PG itself) so not did getting that information require string extraction it was brittle in the face of localised instances. Postgres 9.3 adds this meta-information to error diagnostic data (`PQresultErrorField`), allowing easy programmatic access to it. Psycopg2 [added a Diagnostic object](http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.Diagnostics) around the time pg9.3 was itself released. Assuming Odoo now requires pg >= 9.3 we can remove the old string munging extraction for diagnostic. * funny story, the handling of 23505 didn't actually work because "duplicate key value violates unique constraint" is a literal part of the error message, I'd misunderstood "value" as a field name because my test model's field was called "value". Makes sense too since you can set UNIQUE constraints on multiple fields (and UNIQUE indices on expressions) * for both errors, it should be possible to use the table_name or constraint metadata to provide messages about sub-model issues (a constraint on an m2o), but that's not currently handled Fixes #15323
Diffstat (limited to 'addons/report/controllers')
0 files changed, 0 insertions, 0 deletions