Originally posted by Unknown
So actually what's happening here is that the attribute can't be saved at all - not just the category changed. The error that got spit out is referencing foreign key constraints in the database (not the attribute key). I looked into it and it looks like there were some missing AttributeQualifier records for that attribute - it's a date field type attribute that had only 3 AttributeQualifier records when there should have been 5 (I don't remember which ones it was missing). This was preventing the attribute from being saved. It looks like maybe these attributes got created during some sort of import so I'm not sure exactly what happened but they likely didn't get created through the UI which has the propensity to cause these kinds of issues. You should be able to modify/save the attributes now.
A note to other developers who stumble on this question: The way I fixed this was by creating a new "Date" field type attribute and making note (visually in the UI) of the current Attribute Qualifiers - in this case there were no non-default attribute qualifiers. I then ran the following SQL:
DELETE FROM [AttributeQualifier]
WHERE AttributeId = 2217
Then
UPDATE [AttributeQualifier]
SET AttributeId = 2217
WHERE AttributeId = 17038
Where 2217 is the broken attribute and 17038 is the sacrificial new attribute I stole the qualifiers from. I then deleted the new attribute through the UI. Then, if there were non-default qualifiers, you'd go back and set them in the UI. I'm sure there's a more methodical way to fix this problem but this is the quick and dirty way I chose to do it.