I've narrowed it down to a template variable, however I've hundreds of values entered for this particular template variable, so I'm trying to find the data error rather than replace the TV.
I ran:
repair table qstrv_site_content;
repair table qstrv_site_tmplvar_contentvalues;
repair table qstrv_site_tmplvar_templates;
(and every other table in the database)
I've tried deleting (DELETE FROM..) all the differences I can find in the above three tables (it had been populated for some other templates).
I've duplicated the template, dissociated the TV, saved, re-associated it, and assigned resources to the duplicate template
I've tried associating resources to the template THEN dissociating the TV, saving and re-associating the TV.
But when this TV is on the template or its duplicate, editing any resource on that template throws a 500 HTTP error. When this TV is on another template, no problem. Comparing before and after databases, these TV values were set previously on these resources on the original template without any problem. There are no duplicates for a given contentid. The TV is associated with the same templates as before. All that has changed is some values have been entered for resources on different templates. (Deleting these tmplvar_value rows doesn't help. Deleting the site_content rows doesn't either - through the MODx manager or in the database.)
qstrv_site_tmplvars.properties, input_properties and output_properties are NULL. qstrv_site_tmplvars.display is empty. I've tried populating them, doesn't help. qstrv_site_tmplvars.editor_type and static are zero.
Please could someone give me some inkling as to what could possibly cause editing to throw the 500 error? (Or anything else at all that might give me a shove towards resolution.)
The problem seems to have arisen when the users started populating the TV on templates other than the original one. The TV is associated with other templates but had not previously been populated.