Page data is inconsistent with database (18,1)

"Page data is inconsistent with database (18,1)"

I recently came across this during a call to a Component Interface, CI.HCR_PERSONAL_DATA_SRV, that interfaced with a rather large Component, Component.PERSONAL_DATA.

(Interestingly when I tested the CI stand-alone it worked fine, never figured out why/no time.

I created a Project that contained *all the objects for Component.PERSONAL_DATA. This can take some time if each page has sub-pages, and in turn they too have sub-pages. Be sure to include each record for each page, and each record's associated PeopleCode.
See this post about how to do a lot of this via a SQL script or similar.

I first checked that all the tables and views for the component had been built correctly after a recent patch. They were fine.

Next I checked PeopleCode, namely SavePreChange and SavePostChange as these are the events most likely to cause the given error. Recall that this error happens when data in the buffer pre save and data in the database post save do not match. I simply went through each piece of code and remarked out likely looking code or entire sections...

...until the error stopped occuring. This pointed me to some custom code on SavePost that was updating a row via SQLExec on table x, new delivered code from the patch was updating table x in the buffer in SavePre. Thus the error. All-in-all took me a lot longer than it took to write this post.