← Back to team overview

openerp-india team mailing list archive

[Bug 1098780] Re: ir.property records are not properly cleaned up when the record they refer to is deleted

 

Testing on trunk, I found that normally the property will be deleted,
when the record referred to is deleted. So some more  research is needed
in what circumstances the problem occurs. The same code to delete the
properties (in the unlink method of osv) is present in 6.1 as wel...

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1098780

Title:
  ir.property records are not properly cleaned up when the record they
  refer to is deleted

Status in OpenERP Server:
  New

Bug description:
  The list of properties (model ir.property) will in many cases be
  polluted with references to records in models that no longer exist.

  ir.property can dynamically refer to a model through the field res_id.
  This field is filled with the name of the model that is referred to,
  together with the id in the model. For instance res.partner,5 will
  refer to the partner with id 5.

  When partner 5 is deleted / unlinked, the property will remain in the
  system. In some cases this can result in thousands of records in
  ir_property that no longer refer to anything existing.

  For instance to find out which partners that ir_property refers to no
  longer exist, use the following SQL:

  with prop_pos as
      (select position(',' in res_id) as pos, res_id
      from ir_property where not res_id is null),
  prop_res_id as (
      select substring(res_id, 1, pos - 1) as model, pos, substring(res_id, pos + 1)::integer as partner_id
      from prop_pos)
  select * from prop_res_id  where model = 'res.partner' and partner_id not in (select id from res_partner);

  To see which tables ir_property refers to (and a count of records
  referred to):

  select count(*), substring(res_id, 1, (position(',' in res_id) - 1)) as model
  from ir_property where not res_id is null and not res_id = '' group by model;

  I will try to create a wizard reporting on such dangling references
  and/or removing them.

  I found the problem on 6.1 instances, but do not see a reason why it
  could not occur on other versions.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1098780/+subscriptions


References