summaryrefslogtreecommitdiff
path: root/odoo/sql_db.py
AgeCommit message (Collapse)Author
2016-11-17[IMP] sql_db: Improve error message logging on database querriesDevendra Kavthekar
Purpose: When we have a SQL error, it's not very easy to identify the root of the crash. For example if a mandatory field is not set on a row creation, it difficult to see which field isn't correctly set as a lot of fields are not required and a lot a NULL values are present in the INSERT querry. Specification: Show a proper log message, with the reason (cause) of the sql error. Behavior Modification Examples: Some sample log after applied fix. The new line are those beginning by '+' 2016-10-25 09:59:40,208 21161 INFO ent_master odoo.sql_db: bad query: INSERT INTO "res_partner_category" ("id", "active", "color", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('res_partner_category_id_seq'), true, 10, 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id +REASON: null value in column "name" violates not-null constraint +DETAIL: Failing row contains (27, null, null, 1, null, 10, 1, null, 2016-10-25 09:59:40.207202, t, 2016-10-25 09:59:40.207202). 2016-10-25 10:00:29,710 21161 INFO ent_master odoo.sql_db: bad query: UPDATE "res_partner" SET "parent_id"=1001,"type"='contact',"name"='Course Script',"company_name"=NULL,"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1) +REASON: insert or update on table "res_partner" violates foreign key constraint "res_partner_parent_id_fkey" +DETAIL: Key (parent_id)=(1001) is not present in table "res_partner". 2016-10-25 10:23:28,690 21336 INFO ent_master odoo.sql_db: bad query: DELETE FROM res_country WHERE id IN (235) +REASON: null value in column "country_id" violates not-null constraint +DETAIL: Failing row contains (9, 1, AL, Alabama, null, 1, 2016-10-24 10:19:58.765552, 2016-10-21 09:32:26.939607). +CONTEXT: SQL statement "UPDATE ONLY "public"."res_country_state" SET "country_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "country_id""
2016-09-02[FIX] odoo: rename imports and adapt import hooksRaphael Collet
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet