Please forgive me if this is all wrong. I'm working from an older version of SS (2.3.1) which was heavily customized and hopelessly out of sync, making an upgrade a major hassle. Anyway, when a page type is changed and a field of the same name exists in both the old and new type, sometimes the field value is not retrieved correctly (the value from the old page type record comes through). I think the fix I came up with would work even with the most current build but it's so simple that I'm doubting it. In sapphire/core/model/DataObject.php > buildSQL change:
$query->from[$tableClass] = "LEFT JOIN \"$tableClass\" ON \"$tableClass\".\"ID\" = \"$baseClass\".\"ID\"";
$query->from[$tableClass] = "LEFT JOIN `$tableClass` ON `$tableClass`.ID = `$baseClass`.ID AND '$tableClass' = `$baseClass`.ClassName";
The latest version of DataObject attempts to fix this by using the array, collidingFields, and then adding a WHEN clause to the query. I actually attempted to flesh this out before I came up with the above and it resulted in some humdongous queries which crashed our live site.
That said, does anyone see anything wrong with the fix I've posted? FWIW, it seems to be working fine on my test machine in that all pages are rendered correctly and the fields which were previously getting the wrong value in the CMS are now correct. (Incidentally, the collision problem can also be resolved by manually deleting the record from the old page type table, but that's a pain to do on the regular.) Thanks in advance.