whew.. after some more debugging, it would appear that the problem
lies somewhere in the page stuff, which I know less than nothing
about.
Here's the point where I'm at: heapam.c line 442 a macro call to
HeapTupleSatisfies graps our data for us (the messed up struct), which
actually calls the PageGetItem macro for the data.
but, the curious thing is that the relation pointer that gets passed
to both heapgettup and the macro calls contains the correct struct in
relation->rd_att->attrs[0], but then a faulty one is being returned by
PageGetItem. PageGetItem just appears to return a pointer somewhere
in the page.. where does this page stuff get written? I'm not sure
how much farther I can go.. I'll check out the backend flowchart for
more info.
I might also do a diff to see which page stuff has changed.. Is it
possible to back out the atttypmod changes to see if that fixes it?