Author Topic

Kristof Coomans

Tuesday 10 June 2008 6:22:43 am

Comment26404

Hi Mads

From the selects you did it is not really clear if there is any corruption or not. A content class can have multiple versions (final, draft) of which the attributes are all stored in the ezcontentclass_attribute table. To find any objects that are missing certain attributes, execute something like the following SQL:

SELECT o.id, v.version, a.identifier FROM ezcontentobject_version v, ezcontentobject o, ezcontentclass_attribute a
WHERE
  v.contentobject_id=o.id
  AND a.contentclass_id=o.contentclass_id
  AND a.version=0
  AND a.id NOT IN (SELECT contentclassattribute_id FROM ezcontentobject_attribute WHERE contentobject_id=o.id AND version=v.version)
ORDER BY o.id, v.version, a.placement;

Normally, when using a database with transactions enabled, it should not happen that your content object attributes get inconsistent with the content class definition because all changes are done in 1 transaction. Without transaction support though, inconsistencies might occur. Also see http://issues.ez.no/10203

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org